pyamgx
pyamgx copied to clipboard
The issues on building on windows
@shwina after python setuyp.py install ,this error occurred.
Did you install into a Conda environment? If so, did you activate the environment before launching the Python interpreter?
@shwina I have installed the
- numpy
- scipy
- cudatoolkit=9.0
- amgx
and I use the base environment
Thanks - I'm not sure what the issue is and I'm unable to diagnose currently without access to a Windows machine. I suspect that the path to the AMGX libraries is missing from the PATH
. Can you inspect the value of the PATH
?
@pyramidpoint were you able to resolve this or are you still having this issue?
@shwina I still have this problem but I can implement it in C,win10,vs2015
@shwina Hi~ I am trying to build pyamgx on windows, but run into this error
could you help me with this, please? FYI, I have built amgx by msvc2017 and set windows environment variable AMGX_DIR.
Many thanks in advance!
Hi @lacrymose. Unfortunately, I don't have access to a Windows machine to test currently, but it looks like the problem you're encountering is similar to the one described here: https://github.com/Unidata/netcdf4-python/issues/460
Could I ask you to try the fix for that issue (https://github.com/Unidata/netcdf4-python/pull/461)?
Specifically, you would have to change this part of setup.py
:
from Cython.Build import cythonize
ext = cythonize([
Extension(
'pyamgx',
sources=['pyamgx/pyamgx.pyx'],
depends=['pyamgx/*.pyx, pyamgx/*.pxi'],
libraries=['amgxsh'],
language='c',
include_dirs = [
numpy.get_include(),
] + AMGX_include_dirs,
library_dirs = [
numpy.get_include(),
] + AMGX_lib_dirs,
runtime_library_dirs = [
numpy.get_include(),
] + AMGX_lib_dirs,
)])
to this:
if sys.platform == "win32":
runtime_lib_dirs = []
else:
runtime_lib_dirs = [numpy.get_include(),] + AMGX_lib_dirs
from Cython.Build import cythonize
ext = cythonize([
Extension(
'pyamgx',
sources=['pyamgx/pyamgx.pyx'],
depends=['pyamgx/*.pyx, pyamgx/*.pxi'],
libraries=['amgxsh'],
language='c',
include_dirs = [
numpy.get_include(),
] + AMGX_include_dirs,
library_dirs = [
numpy.get_include(),
] + AMGX_lib_dirs,
runtime_lib_dirs=runtime_lib_dirs
)])
If that works, you are more than welcome to submit the change as a PR to this repository.
Hi @lacrymose. Unfortunately, I don't have access to a Windows machine to test currently, but it looks like the problem you're encountering is similar to the one described here: Unidata/netcdf4-python#460
Could I ask you to try the fix for that issue (Unidata/netcdf4-python#461)? ...
I can confirm that it works. But as runtime_lib_dirs
are removed, Windows needs some help to locate the runtime library. Or error like this will occur.
@shwina after python setuyp.py install ,this error occurred.
This can be done by either adding amgxsh.dll
into PATH
manually
set PATH=path/to/your/library;%PATH%
:: for example
:: set PATH=path/to/your/AMGX/build/Release;%PATH%
or build the package with the runtime as component like:
if sys.platform == "win32":
# find the path to .dll runtime
data_files = [('', [os.path.join(AMGX_BUILD_DIR, 'Release/amgxsh.dll')])]
else:
data_files = []
...
setup(...
data_files=data_files,
...)
A complete version can be fount here (with another pr's fix merged for compatibility with AMGX 2.4.0).
Hi @yanang007
Thanks for the update! While I don't actively develop this package anymore, I would be happy to merge a PR if you opened one.
Hi @shwina, sure! I could make a pr after making it more generic!