conda-forge / lammps-feedstock

A conda-smithy repository for lammps.
BSD 3-Clause "New" or "Revised" License
10 stars 14 forks source link

liblammps.so: undefined symbol: lammps_last_thermo #212

Closed MicPellegrino closed 1 week ago

MicPellegrino commented 1 week ago

Solution to issue cannot be found in the documentation.

Issue

When installing and including lammps in a virtual environment from conda-forge (using mamba, in my case) I get the following error upon running lmp = lammps.lammps():

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[7], line 1
----> 1 lmp = lammps.lammps()

File ~/lammps-2Aug2023/python/lammps/core.py:275, in lammps.__init__(self, name, cmdargs, ptr, comm)
    272 self.lib.lammps_get_thermo.argtypes = [c_void_p, c_char_p]
    273 self.lib.lammps_get_thermo.restype = c_double
--> 275 self.lib.lammps_last_thermo.argtypes = [c_void_p, c_char_p, c_int]
    276 self.lib.lammps_last_thermo.restype = c_void_p
    278 self.lib.lammps_encode_image_flags.restype = self.c_imageint

File ~/mambaforge/envs/workflow-hea/lib/python3.8/ctypes/__init__.py:382, in CDLL.__getattr__(self, name)
    380 if name.startswith('__') and name.endswith('__'):
    381     raise AttributeError(name)
--> 382 func = self.__getitem__(name)
    383 setattr(self, name, func)
    384 return func

File ~/mambaforge/envs/workflow-hea/lib/python3.8/ctypes/__init__.py:387, in CDLL.__getitem__(self, name_or_ordinal)
    386 def __getitem__(self, name_or_ordinal):
--> 387     func = self._FuncPtr((name_or_ordinal, self))
    388     if not isinstance(name_or_ordinal, int):
    389         func.__name__ = name_or_ordinal

AttributeError: /home/michele/mambaforge/envs/workflow-hea/lib/python3.8/lib-dynload/../../liblammps.so: undefined symbol: lammps_last_thermo

I don't get this error when building LAMMPS (shared library and Python API) from the latest release using cmake.

Installed packages

_libgcc_mutex              0.1           conda_forge         conda-forge
  _openmp_mutex              4.5           2_gnu               conda-forge
  atk-1.0                    2.36.0        ha1a6a79_0          anaconda   
  boltons                    23.0.0        pyhd8ed1ab_0        conda-forge
  brotlipy                   0.7.0         py310h5764c6d_1005  conda-forge
  bzip2                      1.0.8         h7f98852_4          conda-forge
  c-ares                     1.34.3        heb4867d_0          conda-forge
  ca-certificates            2024.8.30     hbcca054_0          conda-forge
  cairo                      1.18.0        hebfffa5_3          conda-forge
  certifi                    2024.8.30     pyhd8ed1ab_0        conda-forge
  cffi                       1.15.1        py310h255011f_3     conda-forge
  charset-normalizer         3.1.0         pyhd8ed1ab_0        conda-forge
  colorama                   0.4.6         pyhd8ed1ab_0        conda-forge
  conda                      23.3.1        py310hff52083_0     conda-forge
  conda-package-handling     2.0.2         pyh38be061_0        conda-forge
  conda-package-streaming    0.7.0         pyhd8ed1ab_1        conda-forge
  cpp-expected               1.1.0         hf52228f_0          conda-forge
  cryptography               40.0.1        py310h34c0648_0     conda-forge
  expat                      2.5.0         hcb278e6_1          conda-forge
  fmt                        11.0.2        h434a139_0          conda-forge
  font-ttf-dejavu-sans-mono  2.37          hd3eb1b0_0          anaconda   
  font-ttf-inconsolata       2.001         hcb22688_0          anaconda   
  font-ttf-source-code-pro   2.030         hd3eb1b0_0          anaconda   
  font-ttf-ubuntu            0.83          h8b1ccd4_0          anaconda   
  fontconfig                 2.14.2        h14ed4e7_0          conda-forge
  fonts-anaconda             1             h8fa9717_0          anaconda   
  fonts-conda-ecosystem      1             hd3eb1b0_0          anaconda   
  freetype                   2.12.1        h267a509_2          conda-forge
  fribidi                    1.0.10        h7b6447c_0          anaconda   
  gdk-pixbuf                 2.42.10       h05c8ddd_0          conda-forge
  gettext                    0.21.1        h27087fc_0          conda-forge
  glib                       2.82.2        h44428e9_0          conda-forge
  glib-tools                 2.82.2        h4833e2c_0          conda-forge
  gobject-introspection      1.72.0        py310hbb6d50b_1     anaconda   
  graphite2                  1.3.14        h295c915_1          anaconda   
  graphviz                   9.0.0         h78e8752_1          conda-forge
  gtk2                       2.24.33       h73c1081_2          anaconda   
  gts                        0.7.6         hb67d8dd_3          anaconda   
  harfbuzz                   9.0.0         hda332d3_1          conda-forge
  icu                        75.1          he02047a_0          conda-forge
  idna                       3.4           pyhd8ed1ab_0        conda-forge
  jpeg                       9e            h7f8727e_0          anaconda   
  jsonpatch                  1.32          pyhd8ed1ab_0        conda-forge
  jsonpointer                2.0           py_0                conda-forge
  keyutils                   1.6.1         h166bdaf_0          conda-forge
  krb5                       1.21.3        h659f571_0          conda-forge
  ld_impl_linux-64           2.40          h41732ed_0          conda-forge
  lerc                       4.0.0         h27087fc_0          conda-forge
  libarchive                 3.7.4         hfca40fe_0          conda-forge
  libcurl                    8.10.1        hbbe4b11_0          conda-forge
  libdeflate                 1.17          h0b41bf4_0          conda-forge
  libedit                    3.1.20191231  he28a2e2_2          conda-forge
  libev                      4.33          h516909a_1          conda-forge
  libexpat                   2.5.0         hcb278e6_1          conda-forge
  libffi                     3.4.2         h7f98852_5          conda-forge
  libgcc                     14.2.0        h77fa898_1          conda-forge
  libgcc-ng                  14.2.0        h69a702a_1          conda-forge
  libgd                      2.3.3         h695aa2c_1          anaconda   
  libglib                    2.82.2        h2ff4ddf_0          conda-forge
  libgomp                    14.2.0        h77fa898_1          conda-forge
  libiconv                   1.17          h166bdaf_0          conda-forge
  libmamba                   2.0.3         hf72d635_0          conda-forge
  libmambapy                 2.0.3         py310h6639945_0     conda-forge
  libnghttp2                 1.64.0        h161d5f1_0          conda-forge
  libnsl                     2.0.0         h7f98852_0          conda-forge
  libpng                     1.6.44        hadc24fc_0          conda-forge
  librsvg                    2.58.0        hce6bd6c_0          conda-forge
  libsolv                    0.7.30        h3509ff9_0          conda-forge
  libsqlite                  3.47.0        hadc24fc_1          conda-forge
  libssh2                    1.11.0        h0841786_0          conda-forge
  libstdcxx                  14.2.0        hc0a3c3a_1          conda-forge
  libstdcxx-ng               14.2.0        h4852527_1          conda-forge
  libtiff                    4.5.0         h6adf6a1_2          conda-forge
  libtool                    2.4.6         h6a678d5_1009       anaconda   
  libuuid                    2.38.1        h0b41bf4_0          conda-forge
  libwebp-base               1.4.0         hd590300_0          conda-forge
  libxcb                     1.17.0        h8a09558_0          conda-forge
  libxml2                    2.13.5        hb346dea_0          conda-forge
  libzlib                    1.3.1         hb9d3cd8_2          conda-forge
  lz4-c                      1.9.4         hcb278e6_0          conda-forge
  lzo                        2.10          h516909a_1000       conda-forge
  mamba                      2.0.3         hfdd0a45_0          conda-forge
  ncurses                    6.3           h27087fc_1          conda-forge
  ninja                      1.10.2        h06a4308_5          anaconda   
  ninja-base                 1.10.2        hd09550d_5          anaconda   
  nlohmann_json              3.11.3        he02047a_1          conda-forge
  openssl                    3.4.0         hb9d3cd8_0          conda-forge
  packaging                  23.1          pyhd8ed1ab_0        conda-forge
  pango                      1.54.0        h4c5309f_1          conda-forge
  pcre2                      10.44         hba22ea6_2          conda-forge
  pip                        23.0.1        pyhd8ed1ab_0        conda-forge
  pixman                     0.43.2        h59595ed_0          conda-forge
  pluggy                     1.0.0         pyhd8ed1ab_5        conda-forge
  pthread-stubs              0.4           hb9d3cd8_1002       conda-forge
  pybind11-abi               4             hd8ed1ab_3          conda-forge
  pycosat                    0.6.4         py310h5764c6d_1     conda-forge
  pycparser                  2.21          pyhd8ed1ab_0        conda-forge
  pydot                      3.0.2         py310hff52083_0     conda-forge
  pygraphviz                 1.13          py310ha555b4d_0     conda-forge
  pyopenssl                  23.1.1        pyhd8ed1ab_0        conda-forge
  pyparsing                  3.2.0         pyhd8ed1ab_1        conda-forge
  pysocks                    1.7.1         pyha2e5f31_6        conda-forge
  python                     3.10.11       he550d4f_0_cpython  conda-forge
  python-graphviz            0.20.1        pyh22cad53_0        conda-forge
  python_abi                 3.10          3_cp310             conda-forge
  readline                   8.2           h8228510_1          conda-forge
  reproc                     14.2.4        h0b41bf4_0          conda-forge
  reproc-cpp                 14.2.4        hcb278e6_0          conda-forge
  requests                   2.28.2        pyhd8ed1ab_1        conda-forge
  ruamel.yaml                0.17.21       py310h1fa729e_3     conda-forge
  ruamel.yaml.clib           0.2.7         py310h1fa729e_1     conda-forge
  setuptools                 65.6.3        pyhd8ed1ab_0        conda-forge
  simdjson                   3.10.1        h84d6215_0          conda-forge
  spdlog                     1.14.1        hed91bc2_1          conda-forge
  tk                         8.6.13        noxft_h4845f30_101  conda-forge
  toolz                      0.12.0        pyhd8ed1ab_0        conda-forge
  tqdm                       4.65.0        pyhd8ed1ab_1        conda-forge
  tzdata                     2023c         h71feb2d_0          conda-forge
  urllib3                    1.26.15       pyhd8ed1ab_0        conda-forge
  wheel                      0.40.0        pyhd8ed1ab_0        conda-forge
  xorg-libice                1.1.1         hb9d3cd8_1          conda-forge
  xorg-libsm                 1.2.4         he73a12e_1          conda-forge
  xorg-libx11                1.8.10        h4f16b4b_0          conda-forge
  xorg-libxau                1.0.11        hb9d3cd8_1          conda-forge
  xorg-libxdmcp              1.1.5         hb9d3cd8_0          conda-forge
  xorg-libxext               1.3.6         hb9d3cd8_0          conda-forge
  xorg-libxrender            0.9.11        hb9d3cd8_1          conda-forge
  xorg-xorgproto             2024.1        hb9d3cd8_1          conda-forge
  xz                         5.2.6         h166bdaf_0          conda-forge
  yaml-cpp                   0.8.0         h59595ed_0          conda-forge
  zlib                       1.3.1         hb9d3cd8_2          conda-forge
  zstandard                  0.19.0        py310hdeb6495_1     conda-forge
  zstd                       1.5.6         ha6fb4c9_0          conda-forge

Environment info

In the `.yml` file:

name: my-workflow
channels:
  - conda-forge
  - defaults
dependencies:
  - python==3.8
  - matplotlib
  - nglview
  - notebook
  - numpy
  - pandas
  - compilers
  - openmpi
  - cmake
  - lammps
  - mdanalysis
jan-janssen commented 1 week ago

This is a bit surprising you installed:

 python                     3.10.11       he550d4f_0_cpython  conda-forge

So it does not seem to be related to the Python 3.8 version you use to call the LAMMPS version.

MicPellegrino commented 1 week ago

Ok, I realized I copy-pasted an old .yml file. I've changed it to python>=3.10 (for a totally different reason) and now it works, so it was only a Python version problem (apparently I had it changed already before calling mamba list).

jan-janssen commented 1 week ago

@MicPellegrino Sounds good to me - I am going to move ahead and close the issue, feel free to reopen it in case the issue comes up again.