On Sun, Dec 1, 2019 at 3:46 PM John Ladasky <john_lada...@sbcglobal.net> wrote: > > Long-time Ubuntu user here. > > For years, I've read warnings about not installing one's personal stack of > Python modules on top of the system Python. It is possible to corrupt the > OS, or so I've gathered. > > Can anyone provide concrete examples of problems arising from installing > modules on top of the system Python? Am I courting disaster? >
I'm going to start by separating out two concepts that are often, but not always, the same. The "system Python" is the one that the OS depends on. On my Debian Stretch, that's /usr/bin/python3 (symlink to /usr/bin/python3.5). On older systems, that might be a Python 2.7 (or worse). This is the installation of Python that is managed by your OS package manager, and - more importantly - is the one that any OS-provided scripts will depend on. The "default Python" is the one you get when you type "python3" at the shell. Often this is the same as the system Python, but there's no requirement for this to be the case. On many of my systems, I compile and install a new build of Python periodically (usually from the master branch, so it's a pre-alpha), and I'm happy for that to take over the name "python3". Currently, on my main system (the aforementioned Debian Stretch), that's /usr/local/bin/python3 (a symlink to /usr/local/bin/python3.9). Since the system Python is managed by your OS package manager, you need to be careful about using pip to install packages into it. For instance, if I were to "/usr/bin/python3 -m pip install psycopg2", it would potentially conflict with "sudo apt install python3-psycopg2". You MAY be safe using pip to install something that isn't available in your package manager, but it's possible to run into dependency versioning conflicts. Be careful. But installing into your default Python, if it's not the system Python, is absolutely safe. Or rather, if it breaks anything, then it's not your fault - it's the fault of something depending on the system Python but not using an absolute shebang :) ChrisA -- https://mail.python.org/mailman/listinfo/python-list