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

The issues on building on windows #17

Open
pyramidpoint opened this issue Apr 15, 2019 · 11 comments
Open

The issues on building on windows #17

pyramidpoint opened this issue Apr 15, 2019 · 11 comments

Comments

@pyramidpoint
Copy link

No description provided.

@pyramidpoint
Copy link
Author

@shwina after python setuyp.py install ,this error occurred.
image

@shwina
Copy link
Owner

shwina commented Apr 15, 2019

Did you install into a Conda environment? If so, did you activate the environment before launching the Python interpreter?

@pyramidpoint
Copy link
Author

@shwina I have installed the
- numpy
- scipy
- cudatoolkit=9.0
- amgx
and I use the base environment

@shwina
Copy link
Owner

shwina commented Apr 17, 2019

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?

@shwina
Copy link
Owner

shwina commented Apr 25, 2019

@pyramidpoint were you able to resolve this or are you still having this issue?

@pyramidpoint
Copy link
Author

@shwina I still have this problem but I can implement it in C,win10,vs2015

@lacrymose
Copy link

@shwina Hi~ I am trying to build pyamgx on windows, but run into this error
image
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!

@shwina
Copy link
Owner

shwina commented Aug 18, 2020

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)?

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.

@yanang007
Copy link
Contributor

yanang007 commented Dec 31, 2023

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. image

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).

@shwina
Copy link
Owner

shwina commented Dec 31, 2023

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.

@yanang007
Copy link
Contributor

Hi @shwina, sure! I could make a pr after making it more generic!

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