\( \usepackage{euler} % must be loaded before fontspec for the whole doc (below); this must be kept for pngmath, however \usepackage{hyperref} \usepackage{amsmath} \usepackage{amsbsy} %\usepackage{mathabx} \usepackage{underscore} \usepackage[all]{xy} % Metadata of the pdf output \hypersetup{pdftitle={Yade Documentation}} \hypersetup{pdfauthor={Smilauer, V., et al.}} \hypersetup{pdfkeywords={Discrete element method, granular materials, contact law, hydromechanical coupling}} % symbols \renewcommand{\mat}{\boldsymbol} \renewcommand{\vec}{\boldsymbol} \renewcommand{\tens}{\boldsymbol} %normalized and locfram here \def\normalized#1{\widehat{#1}} \def\locframe#1{\widetilde{#1}} % timestep \def\Dt{\Delta t} \def\Dtcr{\Dt_{\rm cr}} % algorithm complexity \def\bigO#1{{\mathcal{O}(#1)}} % variants for greek symbols \let\epsilon\varepsilon \let\theta\vartheta \let\phi\varphi % shorthands \let\sig\sigma \let\eps\epsilon % variables at different points of time \def\prev#1{#1^-} \def\pprev#1{#1^\ominus} \def\curr#1{#1^{\circ}} \def\nnext#1{#1^\oplus} \def\next#1{#1^+} % shorthands for geometry \def\currn{\curr{\vec{n}}} \def\currC{\curr{\vec{C}}} \def\uT{\vec{u}_T} \def\curruT{\curr{\vec{u}}_T} \def\prevuT{\prev{\vec{u}}_T} \def\currn{\curr{\vec{n}}} \def\prevn{\prev{\vec{n}}} % motion \def\pprevvel{\pprev{\dot{\vec{u}}}} \def\nnextvel{\nnext{\dot{\vec{u}}}} \def\curraccel{\curr{\ddot{\vec{u}}}} \def\prevpos{\prev{\vec{u}}} \def\currpos{\curr{\vec{u}}} \def\nextpos{\next{\vec{u}}} \def\curraaccel{\curr{\dot{\vec{\omega}}}} \def\pprevangvel{\pprev{\vec{\omega}}} \def\nnextangvel{\nnext{\vec{\omega}}} \def\loccurr#1{\curr{\locframe{#1}}} \def\numCPU{n_{\rm cpu}} \DeclareMathOperator{\Align}{Align} \DeclareMathOperator{\sign}{sgn} % sorting algorithms \def\isleq#1{\currelem{#1}\ar@/^/[ll]^{\leq}} \def\isnleq#1{\currelem{#1}\ar@/^/[ll]^{\not\leq}} \def\currelem#1{\fbox{$#1$}} \def\sortSep{||} \def\sortInv{\hbox{\phantom{||}}} \def\sortlines#1{\xymatrix@=3pt{#1}} \def\crossBound{||\mkern-18mu<} \)

# yade.libVersions module

The `yade.libVersions` module tracks versions of all libraries it was compiled with. Example usage is as follows:

    from yade.libVersions import *
    if(getVersion('cgal') > (4,9,0)):
            …
    else:
            …

To obtain a list of all libraries use the function libVersions.printAllVersions.

All libraries listed in prerequisites are detected by this module.

Note

If we need a version of some library not listed in prerequisites, then it must also be added to that list.

When adding a new version please have a look at these three files:

1. py/_libVersions.cpp: detection of versions from `#include` files by C++.

2. py/libVersions.py.in: python module which is constructed by cmake during compilation. All `*.in` files are processed by cmake.

3. cMake/FindMissingVersions.cmake: forced detection of library with undetectable version.

Hint

The safest way to compare versions is to use builtin python tuple comparison e.g. `if(cgalVer > (4,9,0) and cgalVer < (5,1,1)):`.

yade.libVersions.getAllVersions(rstFormat=False)
  Returns:

    `str` - this function returns the result of printAllVersions(rstFormat) call inside a string variable.

yade.libVersions.getAllVersionsCmake()

  This function returns library versions as provided by cmake during compilation.

  Returns:

    dictionary in following format: `{ "libName" : [ (major, minor, patchlevel) , "versionString" ] }`

  As an example the dict below reflects what libraries this documentation was compiled with (here are only those detected by CMAKE):

      Yade [1]: from yade.libVersions import *

      Yade [2]: getAllVersionsCmake()
      Out[2]:
      {'cmake': [(4, 2, 3), '4.2.3'],
       'compiler': [(15, 2, 0), '/usr/bin/c++ 15.2.0'],
       'boost': [(1, 90, 0), '1.90.0'],
       'freeglut': [(3, 0, 0), '3.0.0'],
       'python': [(3, 14, 4), '3.14.4'],
       'eigen': [(3, 4, 0), '3.4.0'],
       'vtk': [(9, 5, 2), '9.5.2'],
       'mpi': [(3, 1, 0), '3.1'],
       'numpy': [(2, 3, 5), '2.3.5'],
       'ipython': [(9, 11, 0), '9.11.0'],
       'sphinx': [(8, 2, 3), '8.2.3'],
       'mpi4py': [(4, 1, 1), '4.1.1'],
       'mpfr': [(4, 2, 2), '4.2.2'],
       'mpc': [(1, 3, 1), '1.3.1'],
       'mpmath': [(1, 3, 0), '1.3.0'],
       'tkinter': [(8, 6, 0), '8.6'],
       'pygraphviz': [(1, 14, 0), '1.14'],
       'Xlib': [(0, 33, 0), '(0,33)']}

  Note

  Please add here detection of other libraries when yade starts using them or if you discover how to extract from cmake a version which I didn’t add here.

yade.libVersions.getArchitecture()
  Returns:

    string containing processor architecture name, as reported by `uname -m` call or from `CMAKE_HOST_SYSTEM_PROCESSOR` cmake variable.

yade.libVersions.getLinuxVersion()
  Returns:

    string containing linux release and version, preferably the value of `PRETTY_NAME` from file `/etc/os-release`.

yade.libVersions.getVersion(libName)

  This function returns the tuple `(major, minor, patchlevel)` with library version number. The `yade --test` in file py/tests/libVersions.py tests that this version is the same as detected by cmake and C++. If only one of those could detect the library version, then this number is used.

  Parameters:

    libName (string) – the name of the library

  Returns:

    tuple in format `(major, minor, patchlevel)` if `libName` exists. Otherwise it returns `None`.

  Note

  library openblas has no properly defined version in header files, this function will return `(0,0,0)` for openblas. Parsing the version string would be unreliable. The mpi version detected by cmake sometimes is different than version detected by C++, this needs further investigation.

yade.libVersions.printAllVersions(rstFormat=False)

  This function prints a nicely formatted table with library versions.

  Parameters:

    rstFormat (bool) – whether to print table using the reStructuredText formatting. Defaults to `False` and prints using Gitlab markdown rules so that it is easy to paste into gitlab discussions.

  As an example the table below actually reflects with what libraries this documentation was compiled:

      Yade [1]: printAllVersions()

      ```
      Yade version   :  2026.1.0
      Yade features  :  LOGGER USEFUL_ERRORS COMPLEX_MP MPFR MPC VTK OPENMP GTS QT5 MPI LS_DEM FEMLIKE GL2PS LBMFLOW POTENTIAL_PARTICLES
      Yade config dir:  ~/.config/yade-double
      Yade precision :  53 bits, 15 decimal places, with mpmath, PrecisionDouble
      Yade RealHP<…> :  (15, 33, 45, 60, 120, 150, 300) decimal digits in C++, (15, 33) decimal digits accessible from python
      ```

      Libraries used :

      | library       | cmake                 | C++                 |
      | ------------- | --------------------- | ------------------- |
      | Xlib          | (0,33)                |                     |
      | boost         | 1.90.0                | 1.90.0              |
      | cmake         | 4.2.3                 |                     |
      | compiler      | /usr/bin/c++ 15.2.0   | gcc 15.2.0          |
      | eigen         | 3.4.0                 | 3.4.0               |
      | freeglut      | 3.0.0                 |                     |
      | gl            |                       | 20220530            |
      | ipython       | 9.11.0                |                     |
      | mpc           | 1.3.1                 | 1.3.1               |
      | mpfr          | 4.2.2                 | 4.2.2               |
      | mpi           | 3.1                   | ompi:5.0.10         |
      | mpi4py        | 4.1.1                 |                     |
      | mpmath        | 1.3.0                 |                     |
      | numpy         | 2.3.5                 |                     |
      | openblas      |                       |  OpenBLAS 0.3.32    |
      | pygraphviz    | 1.14                  |                     |
      | python        | 3.14.4                | 3.14.4              |
      | qglviewer     |                       | 2.8.0               |
      | qt            |                       | 5.15.18             |
      | sphinx        | 8.2.3                 |                     |
      | sqlite        |                       | 3.46.1              |
      | tkinter       | 8.6                   |                     |
      | vtk           | 9.5.2                 | 9.5.2               |

      ```
      Linux version  :  Ubuntu Resolute Raccoon (development branch)
      Architecture   :  amd64
      Little endian  :  True
      ```

  Note

  For convenience at startup `from yade.libVersions import printAllVersions` is executed, so that this function is readily accessible.

yade._libVersions.getAllVersionsCpp() → dict

  This function returns library versions as discovered by C++ during compilation from all the `#include` headers. This can be useful in debugging to detect some library `.so` conflicts.

  Returns:

    dictionary in folowing format: `{ "libName" : [ (major, minor, patch) , "versionString" ] }`

  As an example the dict below reflects what libraries this documentation was compiled with (here are only those detected by C++):

      Yade [1]: from yade.libVersions import *

      Yade [2]: getAllVersionsCpp()
      Out[2]:
      {'compiler': [(15, 2, 0), 'gcc 15.2.0'],
       'boost': [(1, 90, 0), '1.90.0'],
       'qt': [(5, 15, 18), '5.15.18'],
       'gl': [(2022, 5, 30), '20220530'],
       'qglviewer': [(2, 8, 0), '2.8.0'],
       'python': [(3, 14, 4), '3.14.4'],
       'eigen': [(3, 4, 0), '3.4.0'],
       'sqlite': [(3, 46, 1), '3.46.1'],
       'vtk': [(9, 5, 2), '9.5.2'],
       'cgal': [],
       'suitesparse': [],
       'openblas': [(0, 0, 0), ' OpenBLAS 0.3.32 '],
       'metis': [],
       'mpi': [(5, 0, 10), 'ompi:5.0.10'],
       'clp': [],
       'coinutils': [],
       'mpfr': [(4, 2, 2), '4.2.2'],
       'mpc': [(1, 3, 1), '1.3.1']}

  Note

  Please add here C++ detection of other libraries when yade starts using them.