pik-copan / pyunicorn

Unified Complex Network and Recurrence Analysis Toolbox
http://pik-potsdam.de/~donges/pyunicorn/
Other
195 stars 86 forks source link

ModuleNotFoundError: No module named 'pyunicorn.core._ext.numerics' #130

Closed sofiafarina closed 2 years ago

sofiafarina commented 4 years ago

Hello,

when I try to run the climate tutorial I get the following error:

from ._ext.numerics import _local_cliquishness_4thorder, \

ModuleNotFoundError: No module named 'pyunicorn.core._ext.numerics'

There's the numerics file but with a different extension. What should I do?

Thank you very much.

jkroenke commented 4 years ago

How did you install pyunicorn? If you directly download it from the source you have to cythonize the _ext/numerics.pyx files yourself, e.g., by running 'python setup.py build'. After that, there should be corresponding _ext/numerics.c files.

sofiafarina commented 4 years ago

Thank you very much for your help. I cythonized it as you suggested and I have now the numerics.c file in the core folder but I still get the error:

from pyunicorn import climate File "/Users/Sofia/Desktop/pyunicorn-master/pyunicorn/init.py", line 46, in from .core import * File "/Users/Sofia/Desktop/pyunicorn-master/pyunicorn/core/init.py", line 44, in from .network import Network, NetworkError, nz_coords, cached_const File "/Users/Sofia/Desktop/pyunicorn-master/pyunicorn/core/network.py", line 52, in from ._ext.numerics import _local_cliquishness_4thorder, \ ModuleNotFoundError: No module named 'pyunicorn.core._ext.numerics'

Thank you, Sofia

jkroenke commented 4 years ago

What python and cython versions do you use?

sofiafarina commented 4 years ago

Python version 3.6.4 Cython version 0.27.3

thank you!

sofiafarina commented 4 years ago

I also updated them to the latest versions but I still get the error.

jkroenke commented 4 years ago

Ok, the problem is that the .pyx files are cythonized to .c files within the folder. However, the object files created by the C compiler are only generated into the pyunicorn/build directory. When you copy the corresponding .so file from pyunicorn/build/.../_ext/numerics to your original directory the import of the cython modules should work. I'm still thinking of a better solution without manually copying.

sofiafarina commented 4 years ago

Okay, sorry but I am not sure: which file do I have to copy and where? Thank you again!

sofiafarina commented 4 years ago

I mean, in the searched folder there are numerics.c and numerics.pyx..

Schermata 2019-11-09 alle 16 10 01
jkroenke commented 4 years ago

When you run 'python setup.py build' a build folder should be generated in the top-level pyunicorn folder. In that folder you should find .so files in the corresponding */_ext/numerics folders. If you copy these files into your source directory, the pyunicorn import should work.

sofiafarina commented 4 years ago

I copied the numerics.o file into my source directory but I still get the same error maybe it is because it is looking for .../numerics (so there's no extension) but the files are: numerics.c, numerics.pyx, numerics.o (this last one copied from the build folder)..?

Thank you

hadware commented 4 years ago

I have the same error here on a Python3.7 conda environment. I'll try to find some fix.

seongsilheo commented 4 years ago

Hi, I also can not find the .so file. I can just see numerics.o from the build folder. I also copy that file to my directory. So the file are : numerics.c, numerics.pyx, numerics.o I still have the ModuleNotFoundError issue. (No module named pyunicorn.core._ext.numerics)

Anyone knows how to fix this issue? Thank you.

Mattyboi123 commented 4 years ago

@seongsilheo have you been able to get this working yet? I still can not :(

lenas95 commented 2 years ago

Hi, if the issue is still pending I tried to mimic the issue as I had the same problem. I solved it by:

Please comment on further issues or if this resolved the problem Greetings

ntfrgl commented 2 years ago

Thank you for reporting this issue, and please accept our apologies for our delay in providing a rigorous solution. This set of problems should be fully resolved with the commit linked above, which will be reflected in an upcoming new release including official wheels. I'm tentatively closing this ticket, but please let us know in case you have any trouble installing pyunicorn from the current master branch, in which case we will attempt to find a solution as quickly as possible.

Cython is now declared as a build dependency, which means that your Python package manager (e.g., pip) is responsible for automatically providing the Cython compiler without any user intervention. After the package installation process is completed, Cython is not required as a runtime dependency. The version information is now retrieved via importlib.metadata from the Python standard library.