open-rmf / rmf_api_msgs

Collection of messages which bridges the C++ components of RMF to the web interface
Apache License 2.0
1 stars 7 forks source link

Python data model generation instructions don't work anymore in Ubuntu 24.04 #52

Open luca-della-vedova opened 4 months ago

luca-della-vedova commented 4 months ago

Building on Noble beta / Rolling, Python / pip became a lot more conservative and the following error is returned when trying to install datamodel-code-generator:

$ pip3 install datamodel-code-generator
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.

Passing --break-system-packages works but there is probably a reason this was upgraded to an error, I haven't tried using pipx yet.

Yadunund commented 4 months ago

Similar problem was encountered in the buildfarm and the solution is to set the envar PIP_BREAK_SYSTEM_PACKAGES.

We should adopt the same in our CI jobs.

arjo129 commented 4 months ago

Is anyone in the ROS community looking at the current state of the python ecosystem? I've heard rumours that Python is also planning on moving to a rust/cargo like packaging format via the pyproject.toml. In any case I don't think mixing pip packages with ros2 system packages is good practice in the longer term.