MITHaystack/digital_rf

Can't install DRF on Ubuntu 24.04 LTS

Closed this issue · 14 comments

I can't find DRF in the repo for Ubuntu 24.04 LTS and pip3 installation fails:

wsprdaemon@rx888:~/wsprdaemon$ cat /etc/os-release
PRETTY_NAME="Ubuntu 24.04 LTS"
NAME="Ubuntu"
VERSION_ID="24.04"
VERSION="24.04 LTS (Noble Numbat)"
VERSION_CODENAME=noble
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=noble
LOGO=ubuntu-logo
wsprdaemon@rx888:~/wsprdaemon$  apt-cache pkgnames | grep -i digital.*rf
wsprdaemon@rx888:~/wsprdaemon$ sudo pip3 install --break-system-packages digital_rf
Collecting digital_rf
  Using cached digital_rf-2.6.8.tar.gz (1.2 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [32 lines of output]
      <string>:168: SyntaxWarning: invalid escape sequence '\g'
      /tmp/pip-install-xeysqljs/digital-rf_4e1c53f7c3134998930322fdfdc9c2ba/versioneer.py:432: SyntaxWarning: invalid escape sequence '\s'
        ] = '''
      Traceback (most recent call last):
        File "/usr/lib/python3/dist-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/usr/lib/python3/dist-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/usr/lib/python3/dist-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
                 ^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-9li51u1i/overlay/local/lib/python3.12/dist-packages/setuptools/build_meta.py", line 325, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-9li51u1i/overlay/local/lib/python3.12/dist-packages/setuptools/build_meta.py", line 295, in _get_build_requires
          self.run_setup()
        File "/tmp/pip-build-env-9li51u1i/overlay/local/lib/python3.12/dist-packages/setuptools/build_meta.py", line 487, in run_setup
          super().run_setup(setup_script=setup_script)
        File "/tmp/pip-build-env-9li51u1i/overlay/local/lib/python3.12/dist-packages/setuptools/build_meta.py", line 311, in run_setup
          exec(code, locals())
        File "<string>", line 185, in <module>
        File "/tmp/pip-install-xeysqljs/digital-rf_4e1c53f7c3134998930322fdfdc9c2ba/versioneer.py", line 1524, in get_version
          return get_versions()["version"]
                 ^^^^^^^^^^^^^^
        File "/tmp/pip-install-xeysqljs/digital-rf_4e1c53f7c3134998930322fdfdc9c2ba/versioneer.py", line 1451, in get_versions
          cfg = get_config_from_root(root)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-install-xeysqljs/digital-rf_4e1c53f7c3134998930322fdfdc9c2ba/versioneer.py", line 346, in get_config_from_root
          parser = configparser.SafeConfigParser()
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      AttributeError: module 'configparser' has no attribute 'SafeConfigParser'. Did you mean: 'RawConfigParser'?
      [end of output]

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

× Getting requirements to build wheel 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.
wsprdaemon@rx888:~/wsprdaemon$

This is happening because Ubuntu 24.04 is using Python 3.12, and the 2.6.8 release is not compatible. I just made a 2.6.9 release with the fixes for Python 3.12. You can try it now and hopefully get better results!

Clearly I have more work to do with the Python build tools. Until then, you can try installing using the conda-forge package which is my primary workflow, or as a last resort installing from source.

I tried this in an Ubuntu 24.04 Docker container, and I got a similar output that was more illuminating:

Building wheels for collected packages: digital_rf
  Building wheel for digital_rf (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Building wheel for digital_rf (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [43 lines of output]
      Failed to load config from /tmp/pip-install-3_hdi_z9/digital-rf_196dd17ba4c54cd5b0bc8f5e3ba3ada0/pyproject.toml: 'tool'
      Try to load it from setup.cfg
      running bdist_wheel
      running build
      running build_py
      Failed to load config from /tmp/pip-install-3_hdi_z9/digital-rf_196dd17ba4c54cd5b0bc8f5e3ba3ada0/pyproject.toml: 'tool'
      Try to load it from setup.cfg
      Failed to load config from /tmp/pip-install-3_hdi_z9/digital-rf_196dd17ba4c54cd5b0bc8f5e3ba3ada0/pyproject.toml: 'tool'
      Try to load it from setup.cfg
      creating build
      creating build/lib.linux-x86_64-cpython-312
      creating build/lib.linux-x86_64-cpython-312/digital_rf
      copying digital_rf/util.py -> build/lib.linux-x86_64-cpython-312/digital_rf
      copying digital_rf/ringbuffer.py -> build/lib.linux-x86_64-cpython-312/digital_rf
      copying digital_rf/digital_rf_deprecated_hdf5.py -> build/lib.linux-x86_64-cpython-312/digital_rf
      copying digital_rf/list_drf.py -> build/lib.linux-x86_64-cpython-312/digital_rf
      copying digital_rf/__init__.py -> build/lib.linux-x86_64-cpython-312/digital_rf
      copying digital_rf/drf_command.py -> build/lib.linux-x86_64-cpython-312/digital_rf
      copying digital_rf/_version.py -> build/lib.linux-x86_64-cpython-312/digital_rf
      copying digital_rf/watchdog_drf.py -> build/lib.linux-x86_64-cpython-312/digital_rf
      copying digital_rf/digital_metadata.py -> build/lib.linux-x86_64-cpython-312/digital_rf
      copying digital_rf/mirror.py -> build/lib.linux-x86_64-cpython-312/digital_rf
      copying digital_rf/digital_rf_hdf5.py -> build/lib.linux-x86_64-cpython-312/digital_rf
      creating build/lib.linux-x86_64-cpython-312/gr_digital_rf
      copying gr_digital_rf/vector.py -> build/lib.linux-x86_64-cpython-312/gr_digital_rf
      copying gr_digital_rf/__init__.py -> build/lib.linux-x86_64-cpython-312/gr_digital_rf
      copying gr_digital_rf/digital_rf_sink.py -> build/lib.linux-x86_64-cpython-312/gr_digital_rf
      copying gr_digital_rf/digital_rf_source.py -> build/lib.linux-x86_64-cpython-312/gr_digital_rf
      copying gr_digital_rf/raster.py -> build/lib.linux-x86_64-cpython-312/gr_digital_rf
      UPDATING build/lib.linux-x86_64-cpython-312/digital_rf/_version.py
      set build/lib.linux-x86_64-cpython-312/digital_rf/_version.py to '2.6.9'
      running build_ext
      INFO: pkg-config not installed. Defaulting to HDF5_ROOT="/usr"
      building 'digital_rf._py_rf_write_hdf5' extension
      creating build/temp.linux-x86_64-cpython-312
      creating build/temp.linux-x86_64-cpython-312/lib
      x86_64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -I/tmp/pip-install-3_hdi_z9/digital-rf_196dd17ba4c54cd5b0bc8f5e3ba3ada0/include -I/usr/include/python3.12 -I/tmp/pip-build-env-c8h42f18/overlay/local/lib/python3.12/dist-packages/numpy/core/include -I/usr/include -I/opt/local/include -I/usr/local/include -c lib/py_rf_write_hdf5.c -o build/temp.linux-x86_64-cpython-312/lib/py_rf_write_hdf5.o
      In file included from lib/py_rf_write_hdf5.c:24:
      /tmp/pip-install-3_hdi_z9/digital-rf_196dd17ba4c54cd5b0bc8f5e3ba3ada0/include/digital_rf.h:46:10: fatal error: hdf5.h: No such file or directory
         46 | #include "hdf5.h"
            |          ^~~~~~~~
      compilation terminated.
      error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for digital_rf
Failed to build digital_rf
ERROR: Could not build wheels for digital_rf, which is required to install pyproject.toml-based projects

I then had to apt install libhdf5-dev pkg-config to have all of the necessary dependencies to complete the build. Can you ensure these non-Python external dependencies before running pip3 install digital_rf?

wsprdaemon@rx888:~/wsprdaemon$ sudo pip3 install digital_rf
error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
python3-xyz, where xyz is the package you are trying to
install.

If you wish to install a non-Debian-packaged Python package,
create a virtual environment using python3 -m venv path/to/venv.
Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
sure you have python3-full installed.

If you wish to install a non-Debian packaged Python application,
it may be easiest to use pipx install xyz, which will manage a
virtual environment for you. Make sure you have pipx installed.

See /usr/share/doc/python3.12/README.venv for more information.

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.

wsprdaemon@rx888:~/wsprdaemon$ sudo pip3 install digital_rf
error: externally-managed-environment

I think you need to add --break-system-packages as an override like it suggests, since I think the intention with wsprdaemon is indeed to install into the system Python environment instead of some sort of virtual environment. That's a choice that falls outside of Digital RF. Sorry for the confusion since I dropped that flag in my previous comment!

--break-system-packages sounds pretty scary, I'm not sure I'm brave enough to do that. I'll wait for Rob :-)