Feb-02-2025, 04:55 AM
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?
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?