Re: [hoomd-users] Hoomd python import error

35 views
Skip to first unread message

Joshua Anderson

unread,
Aug 9, 2021, 1:32:52 PMAug 9
to hoomd...@googlegroups.com
Alexander,

I have not seen this error before. I searched and found some discussion suggesting it may result from having Python>= 3.7 at build time and and 3.6 execution time: https://github.com/ga0/pyprotect/issues/11
------
Joshua A. Anderson, Ph.D.
Research Area Specialist, Chemical Engineering, University of Michigan

> On Aug 6, 2021, at 3:49 PM, Alexander Patapoff <awpat...@gmail.com> wrote:
>
> Hello,
>
> I am having some issues with getting the hoomd package to work with my python dist. There are no errors when compiling the source and then binding to python using the "make -j4" and "make install" commands. However, upon importing hoomd I get an error:
>
> >>> import hoomd
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File "/gpfs/projects/softmatter/apatapof/pydev/lib64/python3.6/site-packages/hoomd/__init__.py", line 50, in <module>
> from hoomd import _hoomd;
> ImportError: /gpfs/projects/softmatter/apatapof/pydev/lib64/python3.6/site-packages/hoomd/_hoomd.cpython-36m-x86_64-linux-gnu.so: undefined symbol: PyThread_tss_get
>
> the python version I am using is 3.6.0
> Does anyone have any suggestions or ideas for fixing this?
>
> Thanks in advance,
> Alexander
>
>
>
> --
> You received this message because you are subscribed to the Google Groups "hoomd-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to hoomd-users...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/hoomd-users/61bbec7c-9952-49cb-8f08-e41f8f599713n%40googlegroups.com.

Eric Irrgang

unread,
Aug 10, 2021, 8:26:40 AMAug 10
to hoomd...@googlegroups.com
To add to what Josh mentions:
PyThread_tss_get was added in Python 3.7, but your package seems to have been finally linked, at least, for Python 3.6.

The most common source of this sort of problem, I find, is when multiple conflicting versions of Python are detected by the older CMake machinery. The first step, I would say, is to take a close look at the CMake output in a clean build directory to see if the Python interpreter and libraries are consistent (and 3.6) and/or just make sure that only your intended Python installation is discoverable during build.

FWIW, the most recent versions of CMake and pybind have much more robust Python detection, but for venv use cases (it looks like this is a venv?) it can be necessary to use the Python_FIND_VIRTUALENV option (in CMake 3.15 and higher): https://cmake.org/cmake/help/latest/module/FindPython.html
(Recent versions of pybind11 use the newer CMake FindPython machinery.)

Joshua Anderson

unread,
Aug 10, 2021, 12:07:35 PMAug 10
to hoomd...@googlegroups.com
HOOMD-blue does not use the new FindPython machinery, even in the v3 betas. I target CMake 3.9 as a minimum version for compatibility with LTS Linux distributions.

That being said, I have not tested venv builds of HOOMD 2.x and I doubt that CMake is properly configured for that. The v3 betas do work with venv and are tested with that configuration regularly.
------
Joshua A. Anderson, Ph.D.
Research Area Specialist, Chemical Engineering, University of Michigan

> To view this discussion on the web visit https://groups.google.com/d/msgid/hoomd-users/CANMuMvn6qjjxgfDeFUyUQ%2BJ2ShBHdhPrkTNLsBaJUyLcBZpuuA%40mail.gmail.com.

Reply all
Reply to author
Forward
0 new messages