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 version dependence to numpy has not been given obviously #93

Open
ryankamanri opened this issue Aug 26, 2023 · 1 comment
Open

The version dependence to numpy has not been given obviously #93

ryankamanri opened this issue Aug 26, 2023 · 1 comment

Comments

@ryankamanri
Copy link

I found the error when i use the latest version of pyworld(0.3.4) with the numpy version 1.22.4:

concurrent.futures.process._RemoteTraceback: 
"""
Traceback (most recent call last):
  File "__init__.cython-30.pxd", line 984, in numpy.import_array
RuntimeError: module compiled against API version 0x10 but this version of numpy is 0xf . Check the section C-API incompatibility at t
he Troubleshooting ImportError section at https://numpy.org/devdocs/user/troubleshooting-importerror.html#c-api-incompatibility for in
dications on how to solve this problem .

 File "${SOMEWHERE}/foo.py", line 2, in <modul
e>
    import pyworld
  File "C:\ProgramData\Anaconda3\lib\site-packages\pyworld\__init__.py", line 17, in <module>
    from .pyworld import *
  File "pyworld\\pyworld.pyx", line 6, in init pyworld.pyworld
  File "__init__.cython-30.pxd", line 986, in numpy.import_array
ImportError: numpy.core.multiarray failed to import
"""

when I change the version of pyworld to 0.3.0 it works normally.
but it has not any remind in pip.

pyworld==0.3.4
├── Cython [required: >=0.24, installed: 0.29.23]
└── numpy [required: Any, installed: 1.22.4]
@sabonerune
Copy link

There is a workaround below.

  1. rebuild pyworld
    If you don't have it installed, please install MSVC.
pip install wheel setuptools numpy==1.22.4 Cython
pip install --no-build-isolation --no-binary :all: pyworld
  1. use Python>=3.9

The root cause is numpy's ABI compatibility.
Nunpy - Build-time dependency

Before NumPy 1.25, the NumPy C-API was not backwards compatible. This means that when compiling with a NumPy version earlier than 1.25 you have to compile with the oldest version you wish to support. This can be done by using oldest-supported-numpy. Please see the NumPy 1.24 documentation.

So changing pyploject.toml to:

requires = [
"wheel",
"setuptools",
"numpy",
"cython",
]

-    "numpy",
+    "numpy>=1.25.0; python_version>='3.9'",
+    "oldest-supported-numpy; python_version<'3.9'",

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

2 participants