Python
Improved performance of Python
Depending on the workload, up to 27% improved performance is now observed in Python-based software. The improved performance is accomplished by building the Python interpreter with -fno-semantic-interposition
. Because there is no semantic interposition now, the internal symbol look-ups from libpython
to libpython
library are direct and faster.
As a consequence, if Fedora users need to use LD_PRELOAD
to override symbols in libpython
, the recommended way is to build a custom Python build without -fno-semantic-interposition
. However, it is still possible to use LD_PRELOAD
to override symbols in other libraries (for example in glibc).
Python 2 has been removed
The Python upstream stopped supporting Python 2 on 1 January 2020. For this reason, Fedora 32 removes Python 2 packages.
The following packages are no longer available:
-
The
python2
package and all its subpackages. -
All packages that need Python 2 to run.
-
All packages that need Python 2 to build.
Fedora 32 still provides a legacy python27
package. This package is intended for developers who need to support Python 2 and for users who need to use software that depends on Python 2.
The python27
package has several limitations compared to the original python2
package:
-
The package has no subpackages. All content is stored in the single package.
-
The package provides no debug build, which was previously available as
python2-debug
. -
The package does not provide the
/usr/bin/python
binary. -
Any special backwards compatible Provides are removed (this package is not intended to be depended upon).
Deprecated support for Nose
Support for Nose is now deprecated. However for now, the python3-nose
package continues to be available in the Fedora repositories. No specific release it yet targeted to remove the python3-nose
package.
Users and packagers of dependent packages are encouraged to switch to python3-pytest
or python3-nose2
.
Notes on migrating user-installed pip packages
When you upgrade from Fedora 30 or 31 to Fedora 32, the main Python interpreter version changes from 3.7 to 3.8. If you have any Python packages installed using pip
, you must complete the following procedure to migrate them to the new version:
-
Install the previously main Python version:
sudo dnf install python3.7
-
Get
pip
for the previously main Python version:python3.7 -m ensurepip --user
-
Observe the installed packages:
python3.7 -m pip list
-
Save the list with specific versions:
python3.7 -m pip freeze > installed.txt
-
Install the same packages for the now default version:
python3 -m pip install --user -r installed.txt
-
Uninstall user-installed packages for 3.7; this ensures proper removal of files in
~/.local/bin
:python3.7 -m pip uninstall $(python3.7 -m pip list --user | cut -d" " -f1)
-
Optionally, clean up the now empty directory structure:
rm -rf ~/.local/lib/python3.7/
-
Optionally, remove the unneeded Python version:
sudo dnf remove python3.7
Additionally, if you have any pip
packages installed using sudo
, run the following commands before running the final step above which removes `python3.7`, or install it again temporarily:
-
Get
pip
for the previously main Python version forroot
:sudo python3.7 -m ensurepip
-
Observe the system-installed packages:
sudo python3.7 -m pip list
-
Uninstall installed packages for 3.7; this ensures proper removal of files in
/usr/local/bin
:sudo python3.7 -m pip uninstall $(python3.7 -m pip list | cut -d" " -f1)
-
Optionally, clean up now empty directory structure:
sudo rm -rf /usr/local/lib*/python3.7/
If you followed the first procedure, the packages are already installed for your user account, which is the preferred option. Avoid using |
Want to help? Learn how to contribute to Fedora Docs ›