#Talk on Ubuntu
1 messages · Page 1 of 1 (latest)
Most (probably all but I don't know) linux distributions rely on python to run. Python introduced an opt-in safety measure to prevent packages being installed globally with pip. This is why you are getting the error message about your python installation being externally managed, because the version of python packaged for ubuntu opted in to this.
Some python packages are available through the ubuntu repositories using the apt command, I think pygame for example. So you'd be able to install some that way. That is the "externally managed" part, it is managed by apt. Using apt ensures that the system python install can't be broken, which in turn could break functionality of the operating system itself.
People have to choose to package python packages in the ubuntu repositories for use with apt, not every pacakge will be packaged this way as the defacto is pip and pypi.
In order to install packages using pip on an "externally managed" python environment you need to install them inside of a virtual environment so that it doesn't break the system wide version of python.
Hope that makes sense.
https://peps.python.org/pep-0668/
Virtual environments are generally best practice on a per project basis regardless of this forced requirement. It's the way that most people do it
Python Enhancement Proposals (PEPs)
So in simple words, I have to make these virtual environments in order to keep the system functional