Python Forum
Building specific Python version on Raspberry PI 5 (Raspbian)
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Building specific Python version on Raspberry PI 5 (Raspbian)
#1
Hi!

I'm trying to build Python 3.8 from source on a Raspberry PI 5 (Raspbian).
A project I'm using requires Python 3.8.

Downloaded the source and built according to the instructions (Python 3.8.20). The build appears to have been successful, though there were a few errors but the README says this is normal because of different platforms.

When I installed the built Python3, it was installed in /usr/local/bin etc. whereas the default Python 3.11.2 that was shipped with t he Raspberry PI 5 was installed in /usr/bin etc. I replaced the symbolic link for python and python3 to /usr/local/python3.8
I also noted that the build screwed up my ufw installation! I had to copy the ufw files from dist-packages...

In any case, I had (and still have) a lot of issues when trying to install python3 packages...
1. Module not found error because some modules import apt_pkg..
Several people suggested a reinstall: sudo apt install --reinstall python3-apt
didn't work...
2. Tried to install add-apt-repository: sudo apt install --reinstall add-apt-repository
didn't work...
3. Tried to install python3-apt: sudo apt install python3-apt
didn't work...
4. Tried to get deadsnakes: sudo add-apt-repository ppa:deadsnakes/ppa -y
didn't work...
5. Tried to reinstall software properties: sudo apt install --reinstall software-properties-common
didn't work...
6. Tried to do repeat the Python 3.8 install: sudo make install
7. Tried again to install python3-apt: sudo apt install --reinstall python3-apt
This time it works!
8. Tried to add deadsnakes again: sudo add-apt-repository ppa:deadsnakes/ppa -y
I get some hits, so I assume this worked...?
9. Tried to install Python3.8-venv: sudo apt-get -y install python3.8-venv
get these errors:
E: Unable to locate package python3.8-venv
E: Couldn't find any package by glob 'python3.8-venv'
E: Couldn't find any package by regex 'python3.8-venv'

10. Tried to install Python3.8-dev: sudo apt-get -y install python3.8-dev
get these notices:
Note, selecting 'libpython3.8-dev' for regex 'python3.8-dev'
0 upgraded, 0 newly installed, 0 to remove and 22 not upgraded.


At this point, the problem appears to be missing package/libraries - python3.8-venv and python3.8-distutils:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Note, selecting 'libpython3.8-dev' for regex 'python3.8-dev'
Package python3.8 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'python3.8' has no installation candidate
E: Unable to locate package python3.8-venv
E: Couldn't find any package by glob 'python3.8-venv'
E: Couldn't find any package by regex 'python3.8-venv'
E: Unable to locate package python3.8-distutils
E: Couldn't find any package by glob 'python3.8-distutils'
E: Couldn't find any package by regex 'python3.8-distutils'


Any idea what's going on? Why won't these packages install?
Reply
#2
Hey,
Manual Install of venv and distutils Since Python 3.8 isn't the default version on Raspbian, some packages like python3.8-venv and python3.8-distutils might be missing from the official repository.
Reply
#3
(Feb-03-2025, 11:38 AM)iterate Wrote: Hey,
Manual Install of venv and distutils Since Python 3.8 isn't the default version on Raspbian, some packages like python3.8-venv and python3.8-distutils might be missing from the official repository.

You can try installing them manually from source by downloading the appropriate versions of these packages for Python 3.8:

bash
Copy
Edit
wget https://launchpad.net/ubuntu/+archive/Subway Surfers Onlineprimary/+files/python3.8-distutils_3.8.12-1_all.deb
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to find out from outside Python (in Windows) the current version of Python? pstein 5 2,365 Jun-28-2024, 07:02 AM
Last Post: Samuel34
  raspberry pi in a python script Raysz 5 1,509 Jun-08-2024, 07:04 PM
Last Post: jefsummers
  run part of a script with a different version of Python jdog 3 2,445 May-27-2024, 01:57 AM
Last Post: Alice12
  Building a DoublyLinkedList in Python - - append method Drone4four 2 1,292 Jan-08-2024, 01:27 PM
Last Post: Drone4four
  building app in XCODE with python phantom115 2 1,826 Aug-02-2023, 11:56 AM
Last Post: phantom115
  How to resolve version conflicts in Python? taeefnajib 0 2,173 Apr-27-2023, 08:37 PM
Last Post: taeefnajib
  Video recording with Raspberry Pi - What´s wrong with my python code? Montezuma1502 3 2,422 Feb-24-2023, 06:14 PM
Last Post: deanhystad
  Python venv and PIP version issue JanOlvegg 2 3,735 Feb-22-2023, 02:22 AM
Last Post: JanOlvegg
  Python Version upgrade nitinkukreja 1 1,745 Feb-04-2023, 10:27 PM
Last Post: Larz60+
  Can't update new python version on Pycharm GOKUUUU 6 7,987 Jul-23-2022, 09:24 PM
Last Post: GOKUUUU

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020