Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with building the python interface #92

Open
flotang-gtt opened this issue Aug 2, 2022 · 3 comments
Open

Problem with building the python interface #92

flotang-gtt opened this issue Aug 2, 2022 · 3 comments

Comments

@flotang-gtt
Copy link

Hi,
when following the directions from https://nomad-4-user-guide.readthedocs.io/en/latest/LibraryMode.html#pynomad-interface, in combination with the info in the readme of the python interface (there's a bit of a difference between these two, fyi, in the online version, the quite necessary --config Release option, without which the build fails when linking), a .pyd file is generated and an .egg is put into the site-packages, everything seemingly working fine.

However, importing with pynomad does not work: ImportError: DLL load failed while importing PyNomad: The specified module could not be found.

Given the instructions mentioned above are working with the "old" msvc versions, it may be relevant that I tried it using -G"Visual Studio 17 2022" which does not support an [Arch] option because w32 is deprecated (I think).

Any hints?

@DanielFNG
Copy link

DanielFNG commented Aug 4, 2022

I'm getting the same issue. I have tried using Visual Studio 2019 and now 2022 but both give the same error.

CMake command:

cmake -DBUILD_INTERFACE_PYTHON=ON -S . -B build/release -G"Visual Studio 17 2022" -A x64

Most of the build goes fine, but I get this warning:

C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(245,5): warning MSB8065: Custom build for item "C:\nomad\build\release\CMakeFiles\22394b8fd786518d0fbe36821e717628\PyNomad.so.rule" succeeded, but specified output "c:\nomad\build\release\interfaces\pynomad\pynomad.so" has not been created. This may cause incremental build to work incorrectly. [C:\nomad\build\release\interfaces\PyNomad\pynomad.vcxproj]

Then after installing etc I get the same import message mentioned above when trying to import PyNomad. Installation has gone fine on my MacOS and Linux machines, only the Windows machine is causing issues.

@canunlusoy
Copy link

I am having the same issue. I run the following:

cmake -DBUILD_INTERFACE_PYTHON=ON -S . -B build/release -G "Visual Studio 17 2022" -A x64

cmake --build build/release --config Release
(I get the same warning @DanielFNG posted)

cmake --install build/release

and when I try to import it (by extending my PYTHONPATH to include the PyNomad folder), I get the error @flotang-gtt posted.

@ctribes
Copy link
Contributor

ctribes commented Aug 18, 2022

I don't have a PYTHONPATH variable but I have the path to Nomad libraries directory (c:/Users/ctribes\Documents\GitHub\nomad\build\release\bin in my case) in the %PATH% variable.

When building Nomad with Python interface I don't see any mention of PyNomad.so. The build process creates an PyNomad.cp38-win_amd64.lib and PyNomad.cp38-win_amd64.exp. From that, a PyNomad.cp38-win_amd64.pyd files is created and copied into the .....\AppData\Roaming\Python\Python38\site-packages.
I perform Nomad building in an Anaconda prompt shell.

The pyd file is the dynamic link library loaded with doing the import PyNomad in Python shell for windows. This library calls for libnomad dlls upon running. Hence, the nomad libraries directory must be in the %PATH%.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants