ipspace / netlab

Making virtual networking labs suck less
https://netlab.tools
Other
403 stars 56 forks source link

[BUG] Fix installation scripts using pip3 for Ubuntu 24.04 #1213

Closed ipspace closed 4 weeks ago

ipspace commented 1 month ago

Ubuntu 24.04 uses a new Python functionality that is strongly opinionated about the use of virtual environments. That's all fine and dandy for people developing stuff in Python and a confusing topic for networking engineers who just want to run labs.

A potential workaround is the --break-system-packages pip3 option, but that one is a pretty recent addition and is not available on older Ubuntu distros. However, as it's pretty easy to identify EXTERNALLY MANAGED Python distro (see https://packaging.python.org/en/latest/specifications/externally-managed-environments/), we could add code to netlab install to identify such environment and set a flag for the installation scripts (for example EXTRA_PIP_FLAGS environment variable).

Any thoughts or suggestions? /cc @jbemmel @ssasso @ddutt

ssasso commented 1 month ago

I came across this "nice" feature some days ago, and it took me less than 30 seconds to create an alias to always use --break-system-packages ;)

So I would add the flag to the install script as well.

The simplest way to identify whether to add or not the flag, from bash, could be pip3 install -h | grep break-system-packages.

ipspace commented 1 month ago

OK, here's the plan:

Does it sound about OK?