How to install pip for python3.13t

Hello,
I’ve installed v3.13.3t with PEP703 support in an Ubuntu 24.04 system (which already included a v3.12 version). The interpreter seems to be working OK but I simply cannot install pip. If I try using the package manager ($ sudo apt-get install python3-pip), the OS will install pip for v3.12, which is not what I want. When I try a semi-manual installation

$ python -m ensurepip --upgrade
/usr/bin/python3.13t: No module named ensurepip

It doesn’t seem to have ensurepip. I’m not sure if pip would need to be installed from source or which would be the workaround this issue.
Thanks.

Do you absolutely need to use the distro package for 3.13t? You can use pyenv to build Python from source if you don’t mind having compilers and some system libraries installed.

Hi @ngoldbaum,
Thank you for the reply. The problem is that once python is installed, I need to build a long list of apps on top of it and, in the past, some dependencies have caused some issues (more particularly those needed by PyQt and QGIS). I guess that the only way to assess if everything can work together is to try a clean installation, which I’ll do first thing tomorrow.

I’d suggest raising a bug report with ubuntu about this.

Just checked on Fediora 42 and pip is not packaged there as well.

I wonder if this is because it is unclear if packages are free threading compatible?

I just did this an experiment on Fedora.
I set the PYTHONPATH to include the paths from python3.13 and setup a venv, then ran pip in the venv.

$ PYTHONPATH=/usr/lib/python3.13/site-packages python3.13t -m venv create tmpdir/qqq-t
...
$ /home/barry/tmpdir/qqq-t/bin/pip --version
pip 24.3.1 from /home/barry/tmpdir/qqq-t/lib64/python3.13t/site-packages/pip (python 3.13)

I don’t think any binary extensions will work. Because they will not have been compiled for free threading.

I’m not sure how to proceed. I’d expect modules such as ‘threading’ to work (otherwise how would I control the free threading) but, for example, ‘numpy’ wouldn’t work (or I wouldn’t even be able to build it) because there is no version compatible with free threading (I understand that numpy blocks the GIL by itself).

Do you absolutely need distro packages for the Python libraries? You can use pip to install binary wheels for many packages, for example.

I agree though based on what you and Barry have observed that the linux distros seem to be packaging free-threaded Python in a way that assumes you don’t need packages, which is pretty suboptimal. Given what you’ve found, I don’t think it’s tenable to rely on them to experiment with free-threading.

No that is not what I hope I said.

There is a lack of free-threading validated/built packages.
There is little that a distro can do about that.

Lots of packages with native extensions are shipping free-threaded wheels.

I’m a NumPy maintainer, we ship free-threaded wheels, I’m not sure what’s holding up distros from following suit. As far as I know, we haven’t heard from any distros about shipping free-threaded NumPy builds.

I would need to find the distro packaging discussions about this to see whether it’s about confidence in upstream, not wanting to re-do packaging work, or some other reason.

1 Like

@Conan_Kudo can you provide insight from a Fedora perspective?