In the past, we saw users and administrators of Oracle Solaris use pip in such a way that can result in breakages of Python system utilities or other Python packages delivered with Oracle Solaris. In the worst case, pkg itself can be broken, making the recovery considerably more difficult. This is a long-standing problem between OS package managers (pkg in our case) and Python-specific package management tools like pip, and is not specific to Oracle Solaris.
Starting with Oracle Solaris 11.4 SRU 69, the Python system environment on Oracle Solaris will be marked as externally managed. What this means is that tools like pip will no longer allow you to modify or install additional Python packages into directories where other system applications can see and import them. The change intends to prevent pip and similar tools from modifying the environment managed by pkg, and follows other operating systems and Linux distributions.
Note that this change also affects installation into users’ home directory using the --user flag, as packages installed in such a way are still visible to systems scripts and thus can result in unexpected behavior.
In order to keep the installation of Python applications as simple as possible, Oracle Solaris will newly ship the pipx tool [1]. Python applications installed with pipx are fully isolated in their own virtual environment and hence cannot affect the system.
Should you want to use some python libraries provided via pkg, you can run pipx with the --system-site-packages flag, but keep in mind that we cannot guarantee that future updates of one such system package won’t introduce some incompatible changes that will break your pipx installed application.
You can find more about pipx usage in its documentation [1]:
https://pipx.pypa.io/stable/
Note that pipx is intended for applications only; that is, Python packages that have executable entry points. If you want to install Python libraries for use with your application, you can still use the standard venv module [2] or virtualenv tool [3] as provided with Oracle Solaris.
[2] venv — Creation of virtual environments
