pik-copan / pyunicorn

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

Bug in __init__.py referencing setup.version #146

Closed jcabraham closed 2 years ago

jcabraham commented 3 years ago

This might be a regression, because this issue was raised in 2019. I assert that a clean install of pyunicorn won't run, as its init.py module calls setup.version, but setup (which is one directory above _init.py) is not on the path.

Error message:

$ docker run --rm -it test-pyunicorn
Traceback (most recent call last):
  File "test.py", line 2, in <module>
    from pyunicorn.timeseries import RecurrenceNetwork
  File "/usr/local/lib/python3.7/site-packages/pyunicorn/__init__.py", line 43, in <module>
    from setup import __version__
ModuleNotFoundError: No module named 'setup'
make: *** [run] Error 1

test.py is from the pyunicorn website:

import numpy as np
from pyunicorn.timeseries import RecurrenceNetwork

x = np.sin(np.linspace(0, 10 * np.pi, 1000))
net = RecurrenceNetwork(x, recurrence_rate=0.05)
print(net.transitivity())

Dockerfile to reproduce this error:

FROM python:3.7-buster

RUN apt update -y
RUN apt-get install -y gfortran

RUN pip3 install \
  Cython \
  matplotlib \
  netCDF4 \
  nolds \
  numpy \
  pandas \
  python-igraph \
  pyedflib \
  pyrqa \
  PyWavelets \
  scipy \
  six

RUN pip3 install pyunicorn
COPY test.py .
ENTRYPOINT python3 test.py

[Bug report updated: removed install of curl, openjdk, apt-utils from Dockerfile]

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