Python Version 3.7 on Connect with Stretch

Topics about the Software of Revolution Pi
Post Reply
Canada
Posts: 3
Joined: 07 Oct 2020, 22:24
Answers: 0

Python Version 3.7 on Connect with Stretch

Post by Canada »

I'm trying to port a system over from a Raspberry Pi 4B development platform to a Rev Pi Connect module running Stretch. I understand Stretch comes pre-bundled with Python 3.5.3, however one of my very important modules requires python 3.6 or higher.

Is there an approved procedure to upgrade python 3.5.3 to 3.7 or higher on the Connect Module with Stretch. Will this OS even be compatible with 3.7, and if not, when can we expect a stable version of Buster?
User avatar
dirk
KUNBUS
Posts: 1924
Joined: 15 Dec 2016, 13:19
Answers: 4

Re: Python Version 3.7 on Connect with Stretch

Post by dirk »

Hi Canada, I have successfully updated to Python 3.7.3-1

Code: Select all

pi@RevPi403002:~ $ sudo apt install python3
Reading package lists... Done
Building dependency tree
Reading state information... Done
python3 is already the newest version (3.7.3-1).
0 upgraded, 0 newly installed, 0 to remove and 910 not upgraded.
Can you tell me what failure you expected or you have received?
Canada
Posts: 3
Joined: 07 Oct 2020, 22:24
Answers: 0

Re: Python Version 3.7 on Connect with Stretch

Post by Canada »

What an honor to receive a reply from the world renown Dirk. Famous from such wonderful cinematic masterpieces as "RevPi Tutorial 08 – Digital IO Modules"

So what happens when I try to upgrade Python 3 as you did:

Code: Select all

pi@RevPi43323:~ $ sudo apt install python3
Reading package lists... Done
Building dependency tree       
Reading state information... Done
python3 is already the newest version (3.5.3-1).
I believe this is because Stretch is bundled with the "verified compatible" version Python 3.5

Instead of updating Python 3 from 3.5 to 3.7, I installed Python 3.7 as an alternate installation which solves the problem. I now have Python 3 (3.5) and Pythion 3.7 installed which is fine for me.

These are the steps I've used and documented to install Python 3.7 as an alternate to Python 3. If there is in fact a simpler way to upgrade I would love to know.


1. Start by installing the packages necessary to build Python source:

Code: Select all

sudo apt update
sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev curl libbz2-dev
2. Download the latest release’s source code from the Python download page using the following curl command :

Code: Select all

curl -O https://www.python.org/ftp/python/3.7.3/Python-3.7.3.tar.xz
3. When download is complete, extract the tarball :

Code: Select all

tar -xf Python-3.7.3.tar.xz
4. Navigate to the Python source directory and run the configure script that will perform a number of checks to make sure all of the dependencies on your system are present Note: The --enable-optimizations option will optimize the Python binary by running multiple tests which will make the build process slower.:

Code: Select all

cd Python-3.7.3
./configure --enable-optimizations
5. Run make to start the build process:

Code: Select all

make -j 4
6. Once the build is done install the Python binaries by running the following command as a user with sudo access :

Code: Select all

sudo make altinstall
Canada
Posts: 3
Joined: 07 Oct 2020, 22:24
Answers: 0

Re: Python Version 3.7 on Connect with Stretch

Post by Canada »

So I've run into the first snag with my workaround of installing python 3.7 as an alternative to python 3 (3.54)

I can no longer use the revpipyloader to auto start and monitor my script. Your parameter for the python interpreter pythonversion cannot be set to 3.7 or the service will not run. It forces me to use the Python 3 (3.5) interpreter.... and course I'm back to the start where I cannot import my modules due to a requirement of Python 3.6 or higher.

For the time being, I have abandoned revpipyloader and instead I've set Pixel to auto login the user, and then I start my scripts via a desktop file in the .config/autostart folder. this works, but going forward I certainly would prefer a way to run the programs without auto-logging into Pixel.
User avatar
dirk
KUNBUS
Posts: 1924
Joined: 15 Dec 2016, 13:19
Answers: 4

Re: Python Version 3.7 on Connect with Stretch

Post by dirk »

Hi Canada, please excuse my fault - I accidentially I had "Buster" in the package sources as I have tested this request.
I have tested it again and have the same results as you. So I uderstand that you are stuck in between two python dependencies. The RevPiPyLoad incompatiblity is something you can solve by asking the developers or create alternatives.
Maybe you don't really need it. I am not into this tool but maybe you can use a systemd daemon.
Post Reply