paulscherrerinstitute / cbf

GNU General Public License v3.0
12 stars 9 forks source link

Support for Python 3.10 and later #15

Closed sstendahl closed 1 year ago

sstendahl commented 1 year ago

Hello,

I develop my own tool for data reduction and analysis of GISAXS data as obtained at Petra III, and have gladly been using this cbf module to import said data. However, I haven't been able to install the cbf module on any more recent version of Python than Python 3.9.

If I try to install cbf in any newer version of Python using pip, I get this error (output is from Fedora 37 using Python 3.11):

Collecting cbf
  Using cached cbf-1.1.5.tar.gz (19 kB)
  Preparing metadata (setup.py) ... done
Requirement already satisfied: numpy in /var/home/sjoerd/.local/lib/python3.11/site-packages (from cbf) (1.23.4)
Using legacy 'setup.py install' for cbf, since package 'wheel' is not installed.
Installing collected packages: cbf
  Running setup.py install for cbf ... error
  error: subprocess-exited-with-error

  × Running setup.py install for cbf did not run successfully.
  │ exit code: 1
  ╰─> [14 lines of output]
      running install
      /usr/lib/python3.11/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-cpython-311
      copying cbf.py -> build/lib.linux-x86_64-cpython-311
      running build_ext
      building 'cbf_c' extension
      creating build/temp.linux-x86_64-cpython-311
      creating build/temp.linux-x86_64-cpython-311/src
      gcc -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DVERSION=\"1.1.5\" -DCBF_VERSION=\"0.0.1\" -I/usr/include/python3.11 -c src/cbf.cpp -o build/temp.linux-x86_64-cpython-311/src/cbf.o -O3
      error: command 'gcc' failed: No such file or directory
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> cbf

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

I package my application as a Flatpak in Linux, where I use a runtime that already contains a Python environment by default. The current runtime I'm using ships with Python 3.9.9, but eventually it will go EOL (planned in 2023 I think) at which point I will need to upgrade to a newer runtime which ships Python 3.10 or newer. I can compile Python myself at that point, but for the sake of future compatibility (also for this module) it would be nice if I could ship with a modern Python version as well. Similar issues persist on Windows (where I managed to get everything working with Python 3.8 in the end), so I'm pretty sure it's "just" a compatibility issue with the latest python versions.

Are there any plans to add support for newer Python versions?

sstendahl commented 1 year ago

So I've recently migrated to Fedora Silverblue 37, and created a new development toolbox. I had issues installing cbf on a newer Python version in the past, and after this error I assumed it was still not fixed yet so decided to file this issue.

After closely examining my output however, I noticed that I hadn't installed certain components yet in my new devel-toolbox. (Including wheel and gcc). After installing these dependencies, it all works on the latest Python 3.11. Apologies for the unnecessary report, will close this issue now.