Importing the C API fails on Windows
See original GitHub issueI am trying to build a C++ Python extension (with pybind11) that uses MPI and mpi4py on Windows. I am working in a conda environment and I installed mpi4py as follows:
conda install mpi4py -c conda-forge --yes
The following:
// import the mpi4py API
if (import_mpi4py() < 0) {
throw std::runtime_error("Could not load mpi4py API.");
}
throws the exception with traceback:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\IEUser\VeloxChemMP\build_dbg_14.27\lib\python3.8\site-packages\veloxchem\__init__.py", line 2, in <module>
from .veloxchemlib import AtomBasis
ImportError: Could not load mpi4py API.
Running mpiexec -n 4 python -c “from mpi4py import MPI; comm = MPI.COMM_WORLD; print(comm.Get_rank())”
works as expected. I am not sure whether this is a bug or some silly mistake I am making.
This issue was migrated from moved from BitBucket #177
Issue Analytics
- State:
- Created 3 years ago
- Comments:60 (38 by maintainers)
Top Results From Across the Web
mpi4py / mpi4py / issues / #177 - Importing the C API fails on Windows
I am trying to build a C++ Python extension (with pybind11) that uses MPI and mpi4py on Windows. I am working in a...
Read more >Python gives error when importing simple C extension module
When I rename hello. dll to hello. pyd I get a different error ">>> import hello Traceback (most recent call last): File "<stdin>",...
Read more >Import error (on Windows): dependency? · Issue #1084 - GitHub
The code import amici fails even though installation via pip install amici works without error (which was also checked using verbose mode).
Read more >Changelog — Python 3.11.1 documentation
bpo-40280: subprocess now imports Windows-specific imports when msvcrt module is available, and POSIX-specific imports on all other ...
Read more >LoadLibraryA function (libloaderapi.h) - Win32 apps
If the function cannot find the module, the function fails. When specifying a path, be sure to use backslashes (\), not forward slashes...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I’ll merge the
bugfix/msmpi
branch soon.I will keep using the
#ifdef ... #define ...
in my code, keeping an eye out for new releases. Thanks!