Rolf-Hempel / PlanetarySystemStacker

Produce a sharp image of a planetary system object (moon, sun, planets) from many seeing-affected frames according to the "lucky imaging" technique.
274 stars 32 forks source link

PlanetarySystemStacker fails to execute when installed on Fedora Linux via PIP #60

Closed starsforeveryone closed 1 year ago

starsforeveryone commented 1 year ago

Hello dear developers,

thank you very much for creating an open source, platform-independent, planetary stacking software!

When trying to install it on the latest Fedora Linux 37, the installation via PIP works: pip install planetary-system-stacker

However, executing the software via calling the "PlanetarySystemStacker" command fails:

RuntimeError: module compiled against API version 0x10 but this version of numpy is 0xf
Traceback (most recent call last):
  File "/home/xxxxxx/.local/bin/PlanetarySystemStacker", line 5, in <module>
    from planetary_system_stacker.planetary_system_stacker import main
  File "/home/xxxxxx/.local/lib/python3.11/site-packages/planetary_system_stacker/planetary_system_stacker.py", line 38, in <module>
    import matplotlib
  File "/home/xxxxxx/.local/lib/python3.11/site-packages/matplotlib/__init__.py", line 113, in <module>
    from . import _api, _version, cbook, _docstring, rcsetup
  File "/home/xxxxxx/.local/lib/python3.11/site-packages/matplotlib/rcsetup.py", line 27, in <module>
    from matplotlib.colors import Colormap, is_color_like
  File "/home/xxxxxx/.local/lib/python3.11/site-packages/matplotlib/colors.py", line 56, in <module>
    from matplotlib import _api, _cm, cbook, scale
  File "/home/xxxxxx/.local/lib/python3.11/site-packages/matplotlib/scale.py", line 22, in <module>
    from matplotlib.ticker import (
  File "/home/xxxxxx/.local/lib/python3.11/site-packages/matplotlib/ticker.py", line 138, in <module>
    from matplotlib import transforms as mtransforms
  File "/home/xxxxxx/.local/lib/python3.11/site-packages/matplotlib/transforms.py", line 49, in <module>
    from matplotlib._path import (
ImportError: numpy.core.multiarray failed to import

Thank you very much for fixing!

timing commented 1 year ago

I would love to run PSS "in the cloud", but I also have numpy issues. I have a fresh Ubuntu 22.04 install on a VPS, I only did the following:

sudo apt update
sudo apt install planetary-system-stacker

a whole lot of stuff was installed, and then when I run the cli example from the PDF documentation I get this:

PlanetarySystemStacker 01022023205211-trimmed.mov -p -b 4 -s 25 -a 52 -w 20 –n --drizzle 1.5x
Traceback (most recent call last):
  File "/usr/bin/PlanetarySystemStacker", line 33, in <module>
    sys.exit(load_entry_point('planetary-system-stacker==0.8.31', 'console_scripts', 'PlanetarySystemStacker')())
  File "/usr/bin/PlanetarySystemStacker", line 25, in importlib_load_entry_point
    return next(matches).load()
  File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 171, in load
    module = import_module(match.group('module'))
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/tijmen/.local/lib/python3.10/site-packages/planetary_system_stacker/planetary_system_stacker.py", line 64, in <module>
    from workflow import Workflow
  File "/home/tijmen/.local/lib/python3.10/site-packages/planetary_system_stacker/workflow.py", line 40, in <module>
    from stack_frames import StackFrames
  File "/home/tijmen/.local/lib/python3.10/site-packages/planetary_system_stacker/stack_frames.py", line 33, in <module>
    from numpy import int as np_int
ImportError: cannot import name 'int' from 'numpy' (/home/tijmen/.local/lib/python3.10/site-packages/numpy/__init__.py)
JingyuQian commented 1 year ago

@timing np.int was deprecated in version 1.20.0 in favor of built-in int type. Since the setup script doesn't specify a numpy version, I'm guessing the version you installed is too new. Would you like to try downgrading numpy to see if the issue persists?

timing commented 1 year ago

Thanks, sadly apt does not allow to downgrade that far. And via pip the compilation errors:

pip3 install --force-reinstall -v "numpy==1.19.5"
error: Command "x86_64-linux-gnu-gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DNPY_INTERNAL_BUILD=1 -DHAVE_NPY_CONFIG_H=1 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -Ibuild/src.linux-x86_64-3.10/numpy/core/src/umath -Ibuild/src.linux-x86_64-3.10/numpy/core/src/npymath -Ibuild/src.linux-x86_64-3.10/numpy/core/src/common -Inumpy/core/include -Ibuild/src.linux-x86_64-3.10/numpy/core/include/numpy -Inumpy/core/src/common -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/src/npysort -I/usr/include/python3.10 -Ibuild/src.linux-x86_64-3.10/numpy/core/src/common -Ibuild/src.linux-x86_64-3.10/numpy/core/src/npymath -c build/src.linux-x86_64-3.10/numpy/core/src/multiarray/scalartypes.c -o build/temp.linux-x86_64-3.10/build/src.linux-x86_64-3.10/numpy/core/src/multiarray/scalartypes.o -MMD -MF build/temp.linux-x86_64-3.10/build/src.linux-x86_64-3.10/numpy/core/src/multiarray/scalartypes.o.d -std=c99" failed with exit status 1
  error: subprocess-exited-with-error

  × Building wheel for numpy (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> See above for output.

  note: This error originates from a subprocess, and is likely not a problem with pip.
  full command: /usr/bin/python3 /usr/lib/python3/dist-packages/pip/_vendor/pep517/in_process/_in_process.py build_wheel /tmp/tmp9q2o05p9
  cwd: /tmp/pip-install-zmprne37/numpy_7ec7aded6f164fb4a0e58452540aa509
  Building wheel for numpy (pyproject.toml) ... error
  ERROR: Failed building wheel for numpy
Failed to build numpy
ERROR: Could not build wheels for numpy, which is required to install pyproject.toml-based projects
JingyuQian commented 1 year ago

@timing Just FYI, the setup.py specified numpy==1.18.4 but setup_linux.py did not.

Apart from this, it's weird that your pip install command resulted in building numpy wheel package locally instead of downloading pre-built from online. Could you try

pip3 uninstall numpy
pip3 install numpy==1.18.4

to see if it works? If it still fails then I'm out of options...

timing commented 1 year ago

Also different compilation errors. I won't bother you with the details :-D.

timing commented 1 year ago

Oh well, trying again on Ubuntu 20.04 instead of 22.04:

apt update apt install python3 python3-pip apt install python3-numpy (to be sure I don't get the newest numpy from pip)

pip3 install planetary-system-stacker

ERROR: scipy 1.10.0 has requirement numpy<1.27.0,>=1.19.5, but you'll have numpy 1.17.4 which is incompatible.
ERROR: astropy 5.2 has requirement numpy>=1.20, but you'll have numpy 1.17.4 which is incompatible.
ERROR: matplotlib 3.6.2 has requirement numpy>=1.19, but you'll have numpy 1.17.4 which is incompatible.
ERROR: tifffile 2022.10.10 has requirement numpy>=1.19.2, but you'll have numpy 1.17.4 which is incompatible.
timing commented 1 year ago

After some hacking around with package versions it works, I had to however add this to the code to alignment_points.py, also because of version differences

try:
    from skimage.registration import phase_cross_correlation
except ImportError:
    from skimage.feature import register_translation as phase_cross_correlation

source: https://github.com/scikit-image/scikit-image/issues/4982

JingyuQian commented 1 year ago

Congrats on solving the issue. I think normally people would use a virtual environment to run Python projects (conda, for example) to not tamper with the system Python3 environment. Hope that PSS can improve upon this.

Rolf-Hempel commented 1 year ago

Hi Tijmen,

many thanks for solving this issue. As I commented on the pull request page, I accepted your pull request. I will update PSS on PyPI today.

All the best, Rolf