Ubuntu/Python/3.14: Difference between revisions

From Omnia
< Ubuntu‎ | Python
Jump to navigation Jump to search
No edit summary
 
(17 intermediate revisions by the same user not shown)
Line 1: Line 1:
== Install with DeadSnakes PPA ==
Dependency:
Dependency:
  sudo apt install software-properties-common
  apt update ; sudo apt -y install software-properties-common


Add Deadsnakes and install python 3.14
Add Deadsnakes and install python 3.14
  sudo add-apt-repository ppa:deadsnakes/ppa
  sudo add-apt-repository ppa:deadsnakes/ppa
  # respond to prompts
  # OR
  yes | sudo add-apt-repository ppa:deadsnakes/ppa
  sudo apt update
  sudo apt update
  sudo apt install python3.14
 
  # sudo apt install python3.14
## BETTER, should also install virtual-env
sudo apt -y install python3.14-dev python3.14-venv
## EVEN BETTER,
sudo apt -y install python3.14-dev python3.14-venv python3.14-full


  python3.14 --version
  python3.14 --version


For development, virtuan env
(dup) For development, virtuan env (dup above)
  sudo apt install python3.14-dev python3.14-venv
  # sudo apt install python3.14-dev python3.14-venv


For a more complete installation including the Tkinter IDE and other utilities, you can use:
For a more complete installation including the ensurepip, Tkinter IDE and other utilities, you can use:
  sudo apt install python3.14-full
  sudo apt install python3.14-full


Pip:
# ensurepip <ref>https://docs.python.org/3/library/ensurepip.html</ref>
python3.14 -m ensurepip --version
 
Pip 3.14:
 
# First, try and see if pip responds
sudo python3.14 -m pip --version
 
If it is happy, try upgrading it:
sudo python3.14 -m pip install --upgrade pip
 
If it fails to upgrade, or there is an issue, or if Pip was previously installed, but is sad:
sudo apt -y remove python3-pip
 
## OR try force upgrading it
sudo python3.14 -m pip install --upgrade --ignore-installed pip
 
If Pip was not previously installed:
 
## not needed
# mkdir ~/.src ; cd ~/.src
# mkdir pip3.14 ; cd pip3.14
 
# system wide
curl -sS https://bootstrap.pypa.io/get-pip.py | sudo python3.14
 
# Ubuntu 26
sudo apt install python3-pip
sudo python3.14 -m pip install --upgrade --ignore-installed --break-system-packages pip
 
# or user only:
  curl -sS https://bootstrap.pypa.io/get-pip.py | python3.14
  curl -sS https://bootstrap.pypa.io/get-pip.py | python3.14


Verify:
sudo python3.14 -m pip --version
python3.14 -m pip --version
sudo pip3.14 --version
pip3.14 --version
sudo which pip3.14
which pip3.14
Upgrade:
sudo python3.14 -m pip install pip --upgrade
# or
  python3.14 -m pip install pip --upgrade
  python3.14 -m pip install pip --upgrade


sudo python3.14 -m pip --version
  python3.14 -m pip --version
  python3.14 -m pip --version


List
  python3.14 -m pip list
  python3.14 -m pip list


Line 33: Line 89:


  cd ~ ; rm -rf .test-venv ; mkdir .test-venv ; cd .test-venv ; python3.14 -m venv venv
  cd ~ ; rm -rf .test-venv ; mkdir .test-venv ; cd .test-venv ; python3.14 -m venv venv
Version checks:
pip --version
pip3.14 --version
python3.14 -m pip --version
# as root with apt pip package:
pip 24.0 from /usr/lib/python3/dist-packages/pip (python 3.12)
pip 24.0 from /usr/lib/python3/dist-packages/pip (python 3.14)
# as user with apt pip package
pip 24.0 from /usr/lib/python3/dist-packages/pip (python 3.12)
pip 24.0 from /usr/lib/python3/dist-packages/pip (python 3.14)
# as root with pypa install:
pip 26.2.1 from /usr/local/lib/python3.14/dist-packages/pip (python 3.14)
# as user pypa install:
pip 26.2.1 from /home/kenneth/.local/lib/python3.14/site-packages/pip (python 3.14)
== pip3.14 script ==
Dead-Snakes doesn't install the pip3.14 script for reasons (as you will see...)  You can manually install, by copying the python 3.12 version, and changing the shebang header from python3 to python3.14.  Only useful as a convenience for regular users, not for root.
cd /usr/bin
cp pip3.12 pip3.14
sed -i "s/python3/python3.14/" pip3.14
Note, calling pip directly as root will error out, but at least as users you can call it to install local packages
pip3.14 install pip --upgrade
  ERROR: Cannot uninstall pip 24.0, RECORD file not found. Hint: The package was installed by debian.
/usr/bin/pip3.14
<pre>
#!/usr/bin/python3.14
# -*- coding: utf-8 -*-
import re
import sys
from pip._internal.cli.main import main
if __name__ == "__main__":
    sys.argv[0] = re.sub(r"(-script\.pyw|\.exe)?$", "", sys.argv[0])
    sys.exit(main())
</pre>
Alternatively, you could also just create an alias:
alias pip3.14="python3.14 -m pip"
== alternatives ==
== Python 3.14 ==
sudo yum install python3.14 python3.14-pip
sudo update-alternatives --list
sudo update-alternatives --display python3
sudo update-alternatives --display python
sudo update-alternatives --display pip3
sudo update-alternatives --display pip
# sudo update-alternatives --config python
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.12 312
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.14 314
## maybe don't do this one... it seems to break things on ubuntu, like 'apt update'
# sudo update-alternatives --set python3 /usr/bin/python3.14
  # if you did you can revert it...
  sudo update-alternatives --set python3 /usr/bin/python3.12
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.12 312
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.14 314
sudo update-alternatives --set python /usr/bin/python3.14
sudo update-alternatives --install /usr/bin/pip3 pip3 /usr/bin/pip3.14 314
sudo update-alternatives --set pip3 /usr/bin/pip3.14
sudo update-alternatives --install /usr/bin/pip pip /usr/bin/pip3.14 314
sudo update-alternatives --set pip /usr/bin/pip3.14
== keywords ==

Latest revision as of 09:25, 20 September 2026

Install with DeadSnakes PPA

Dependency:

apt update ; sudo apt -y install software-properties-common

Add Deadsnakes and install python 3.14

sudo add-apt-repository ppa:deadsnakes/ppa
  # respond to prompts
  # OR
  yes | sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt update
# sudo apt install python3.14
## BETTER, should also install virtual-env
sudo apt -y install python3.14-dev python3.14-venv
## EVEN BETTER, 
sudo apt -y install python3.14-dev python3.14-venv python3.14-full
python3.14 --version

(dup) For development, virtuan env (dup above)

# sudo apt install python3.14-dev python3.14-venv

For a more complete installation including the ensurepip, Tkinter IDE and other utilities, you can use:

sudo apt install python3.14-full
# ensurepip [1]
python3.14 -m ensurepip --version

Pip 3.14:

# First, try and see if pip responds
sudo python3.14 -m pip --version

If it is happy, try upgrading it:

sudo python3.14 -m pip install --upgrade pip

If it fails to upgrade, or there is an issue, or if Pip was previously installed, but is sad:

sudo apt -y remove python3-pip
## OR try force upgrading it
sudo python3.14 -m pip install --upgrade --ignore-installed pip

If Pip was not previously installed:

## not needed
# mkdir ~/.src ; cd ~/.src
# mkdir pip3.14 ; cd pip3.14
# system wide
curl -sS https://bootstrap.pypa.io/get-pip.py | sudo python3.14
# Ubuntu 26
sudo apt install python3-pip
sudo python3.14 -m pip install --upgrade --ignore-installed --break-system-packages pip
# or user only:
curl -sS https://bootstrap.pypa.io/get-pip.py | python3.14

Verify:

sudo python3.14 -m pip --version
python3.14 -m pip --version
sudo pip3.14 --version
pip3.14 --version
sudo which pip3.14
which pip3.14

Upgrade:

sudo python3.14 -m pip install pip --upgrade
# or
python3.14 -m pip install pip --upgrade
sudo python3.14 -m pip --version
python3.14 -m pip --version

List

python3.14 -m pip list

venv: (requires pip)

python3.14 -m venv -h
# check if pip is working
python3.14 -m ensurepip
  #   /usr/bin/python3.14: No module named ensurepip
  # if this fails with the above, install pip and python3.14-venv ^
cd ~ ; rm -rf .test-venv ; mkdir .test-venv ; cd .test-venv ; python3.14 -m venv venv

Version checks:

pip --version
pip3.14 --version
python3.14 -m pip --version
# as root with apt pip package:
pip 24.0 from /usr/lib/python3/dist-packages/pip (python 3.12)
pip 24.0 from /usr/lib/python3/dist-packages/pip (python 3.14)
# as user with apt pip package
pip 24.0 from /usr/lib/python3/dist-packages/pip (python 3.12)
pip 24.0 from /usr/lib/python3/dist-packages/pip (python 3.14)
# as root with pypa install:
pip 26.2.1 from /usr/local/lib/python3.14/dist-packages/pip (python 3.14)
# as user pypa install:
pip 26.2.1 from /home/kenneth/.local/lib/python3.14/site-packages/pip (python 3.14)

pip3.14 script

Dead-Snakes doesn't install the pip3.14 script for reasons (as you will see...) You can manually install, by copying the python 3.12 version, and changing the shebang header from python3 to python3.14. Only useful as a convenience for regular users, not for root.

cd /usr/bin
cp pip3.12 pip3.14
sed -i "s/python3/python3.14/" pip3.14

Note, calling pip directly as root will error out, but at least as users you can call it to install local packages

pip3.14 install pip --upgrade
 ERROR: Cannot uninstall pip 24.0, RECORD file not found. Hint: The package was installed by debian.

/usr/bin/pip3.14

#!/usr/bin/python3.14
# -*- coding: utf-8 -*-
import re
import sys
from pip._internal.cli.main import main
if __name__ == "__main__":
    sys.argv[0] = re.sub(r"(-script\.pyw|\.exe)?$", "", sys.argv[0])
    sys.exit(main())


Alternatively, you could also just create an alias:

alias pip3.14="python3.14 -m pip"

alternatives

Python 3.14

sudo yum install python3.14 python3.14-pip
sudo update-alternatives --list
sudo update-alternatives --display python3
sudo update-alternatives --display python
sudo update-alternatives --display pip3
sudo update-alternatives --display pip
# sudo update-alternatives --config python
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.12 312
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.14 314
## maybe don't do this one... it seems to break things on ubuntu, like 'apt update'
# sudo update-alternatives --set python3 /usr/bin/python3.14
  # if you did you can revert it...
  sudo update-alternatives --set python3 /usr/bin/python3.12
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.12 312
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.14 314
sudo update-alternatives --set python /usr/bin/python3.14

sudo update-alternatives --install /usr/bin/pip3 pip3 /usr/bin/pip3.14 314
sudo update-alternatives --set pip3 /usr/bin/pip3.14
sudo update-alternatives --install /usr/bin/pip pip /usr/bin/pip3.14 314
sudo update-alternatives --set pip /usr/bin/pip3.14

keywords