Apr-16-2022, 02:45 PM
Looking for any and all guidance on the following issues. If this is not the correct forum, please advise
I have developed Raspberry PI Weather Station on Raspian 11 running Python 3.9.2 and Thonny 3.3.14. I've move Python development to an old notepad running Raspberry PI for Desktop (Debian 10 Buster). This runs Python 3.7.3 and Thonny 3.3.10. I installed Python 3.9.2 on Debian hoping to get Thonny 3.3.10 to use it without success.
QUESTION 1: How do I get to Thonny 3.3.14 and Python 3.9.2 on the Debian so I have consistent environments between the two systems?
QUESTION 2: I think I may not be using PIP correctly. What is the best practice for loading Python packages? PIP. APT-GET, with/without SUDO? How do I clean up my PIP mess?
Below is background on each.
Thanks for any assistance
----------------------------------------------------------------------------------------------------------------------------------------------
QUESTION 1: BACKGROUND
I have Thonny on Debian configured to use the RPI Python Interpreter.
I installed Python 3.9.2 on Debian and have tried to link Thonny 3.7.3 to it. However, I'm getting a tk error I believe because of the version of Python I installed.
I now have the following deployed on the Debian based on their shell commands (> indicates sym link; = actual)
• Python2 > /usr/bin/python2.7 = 2.7.16 (I know better than to touch this one)
• Python3 > /usr/bin/python3.7 = 3.7.3
• Python3.9 = /usr/local/bin/python3.9 = 3.9.2
Thonny is in /usr/bin.
I've tried to clean up by removing 3.9.2 but no command I've tried works. It can't find the package.
----------------------------------------------------------------------------------------------------------------------------
QUESTION 2 BACKGROUND
A related problem I found was when I tried to import 'suntime' Python package on the Debian to test a piece of code out. The 3.7.3 Python Interpreter in Thonny 3.7.3 could not find it. Python 3.9.2 found it on a manual compile.
Looking at 'site-packages' I have
pi@deb:~/.local/lib $ ls -lah ./python3.7/site-packages
total 592K
drwxr-xr-x 12 pi pi 4.0K Mar 26 17:47 .
drwxr-xr-x 3 pi pi 4.0K Mar 25 17:02 ..
drwxr-xr-x 3 pi pi 4.0K Mar 26 17:47 bcrypt
drwxr-xr-x 2 pi pi 4.0K Mar 26 17:47 bcrypt-3.2.0.dist-info
drwxr-xr-x 3 pi pi 4.0K Mar 26 17:47 cffi
drwxr-xr-x 2 pi pi 4.0K Mar 26 17:47 cffi-1.15.0.dist-info
-rwxr-xr-x 1 pi pi 542K Mar 26 16:50 _cffi_backend.cpython-37m-i386-linux-gnu.so
drwxr-xr-x 5 pi pi 4.0K Mar 26 17:47 nacl
drwxr-xr-x 3 pi pi 4.0K Mar 26 17:47 paramiko
drwxr-xr-x 2 pi pi 4.0K Mar 26 17:47 paramiko-2.10.3.dist-info
drwxr-xr-x 4 pi pi 4.0K Mar 26 17:47 pycparser
drwxr-xr-x 2 pi pi 4.0K Mar 26 17:47 pycparser-2.21.dist-info
drwxr-xr-x 2 pi pi 4.0K Mar 26 17:47 PyNaCl-1.5.0.dist-info
pi@deb:~/.local/lib $ ls -lah ./python3.9/site-packages
total 84K
drwx------ 12 pi pi 4.0K Apr 13 10:07 .
drwxr-xr-x 3 pi pi 4.0K Mar 25 16:28 ..
drwxr-xr-x 6 pi pi 4.0K Apr 13 10:07 dateutil
drwxr-xr-x 5 pi pi 4.0K Mar 25 16:28 pip
drwxr-xr-x 2 pi pi 4.0K Mar 25 16:28 pip-22.0.4.dist-info
drwxr-xr-x 2 pi pi 4.0K Apr 13 10:07 __pycache__
drwxr-xr-x 2 pi pi 4.0K Apr 13 10:07 python_dateutil-2.8.2.dist-info
drwxr-xr-x 2 pi pi 4.0K Apr 13 10:07 six-1.16.0.dist-info
-rw-r--r-- 1 pi pi 34K Apr 13 10:07 six.py
drwxr-xr-x 3 pi pi 4.0K Apr 13 10:07 suntime
drwxr-xr-x 2 pi pi 4.0K Apr 13 10:07 suntime-1.2.5.dist-info
drwxr-xr-x 4 pi pi 4.0K Mar 25 17:22 tk
drwxr-xr-x 2 pi pi 4.0K Mar 25 17:22 tk-0.1.0.dist-info
'suntime' was the PIP package I installed and could not access until I manually compiled through Python 3.9.2
Looking at PIP, I seem to have a larger mess. Here are results of running different PIPS with and without SUDO
pi@deb:~ $ pip -V
pip 22.0.4 from /home/pi/.local/lib/python3.9/site-packages/pip (python 3.9)
pi@deb:~ $ pip2 -V
pip 18.1 from /usr/lib/python2.7/dist-packages/pip (python 2.7)
pi@deb:~ $ pip3 -V
pip 22.0.4 from /home/pi/.local/lib/python3.9/site-packages/pip (python 3.9)
pi@deb:~ $ sudo pip -V
pip 18.1 from /usr/lib/python2.7/dist-packages/pip (python 2.7)
pi@deb:~ $ sudo pip2 -V
pip 18.1 from /usr/lib/python2.7/dist-packages/pip (python 2.7)
pi@deb:~ $ sudo pip3 -V
pip 18.1 from /usr/lib/python3/dist-packages/pip (python 3.7
I have developed Raspberry PI Weather Station on Raspian 11 running Python 3.9.2 and Thonny 3.3.14. I've move Python development to an old notepad running Raspberry PI for Desktop (Debian 10 Buster). This runs Python 3.7.3 and Thonny 3.3.10. I installed Python 3.9.2 on Debian hoping to get Thonny 3.3.10 to use it without success.
QUESTION 1: How do I get to Thonny 3.3.14 and Python 3.9.2 on the Debian so I have consistent environments between the two systems?
QUESTION 2: I think I may not be using PIP correctly. What is the best practice for loading Python packages? PIP. APT-GET, with/without SUDO? How do I clean up my PIP mess?
Below is background on each.
Thanks for any assistance
----------------------------------------------------------------------------------------------------------------------------------------------
QUESTION 1: BACKGROUND
I have Thonny on Debian configured to use the RPI Python Interpreter.
I installed Python 3.9.2 on Debian and have tried to link Thonny 3.7.3 to it. However, I'm getting a tk error I believe because of the version of Python I installed.
I now have the following deployed on the Debian based on their shell commands (> indicates sym link; = actual)
• Python2 > /usr/bin/python2.7 = 2.7.16 (I know better than to touch this one)
• Python3 > /usr/bin/python3.7 = 3.7.3
• Python3.9 = /usr/local/bin/python3.9 = 3.9.2
Thonny is in /usr/bin.
I've tried to clean up by removing 3.9.2 but no command I've tried works. It can't find the package.
----------------------------------------------------------------------------------------------------------------------------
QUESTION 2 BACKGROUND
A related problem I found was when I tried to import 'suntime' Python package on the Debian to test a piece of code out. The 3.7.3 Python Interpreter in Thonny 3.7.3 could not find it. Python 3.9.2 found it on a manual compile.
Looking at 'site-packages' I have
pi@deb:~/.local/lib $ ls -lah ./python3.7/site-packages
total 592K
drwxr-xr-x 12 pi pi 4.0K Mar 26 17:47 .
drwxr-xr-x 3 pi pi 4.0K Mar 25 17:02 ..
drwxr-xr-x 3 pi pi 4.0K Mar 26 17:47 bcrypt
drwxr-xr-x 2 pi pi 4.0K Mar 26 17:47 bcrypt-3.2.0.dist-info
drwxr-xr-x 3 pi pi 4.0K Mar 26 17:47 cffi
drwxr-xr-x 2 pi pi 4.0K Mar 26 17:47 cffi-1.15.0.dist-info
-rwxr-xr-x 1 pi pi 542K Mar 26 16:50 _cffi_backend.cpython-37m-i386-linux-gnu.so
drwxr-xr-x 5 pi pi 4.0K Mar 26 17:47 nacl
drwxr-xr-x 3 pi pi 4.0K Mar 26 17:47 paramiko
drwxr-xr-x 2 pi pi 4.0K Mar 26 17:47 paramiko-2.10.3.dist-info
drwxr-xr-x 4 pi pi 4.0K Mar 26 17:47 pycparser
drwxr-xr-x 2 pi pi 4.0K Mar 26 17:47 pycparser-2.21.dist-info
drwxr-xr-x 2 pi pi 4.0K Mar 26 17:47 PyNaCl-1.5.0.dist-info
pi@deb:~/.local/lib $ ls -lah ./python3.9/site-packages
total 84K
drwx------ 12 pi pi 4.0K Apr 13 10:07 .
drwxr-xr-x 3 pi pi 4.0K Mar 25 16:28 ..
drwxr-xr-x 6 pi pi 4.0K Apr 13 10:07 dateutil
drwxr-xr-x 5 pi pi 4.0K Mar 25 16:28 pip
drwxr-xr-x 2 pi pi 4.0K Mar 25 16:28 pip-22.0.4.dist-info
drwxr-xr-x 2 pi pi 4.0K Apr 13 10:07 __pycache__
drwxr-xr-x 2 pi pi 4.0K Apr 13 10:07 python_dateutil-2.8.2.dist-info
drwxr-xr-x 2 pi pi 4.0K Apr 13 10:07 six-1.16.0.dist-info
-rw-r--r-- 1 pi pi 34K Apr 13 10:07 six.py
drwxr-xr-x 3 pi pi 4.0K Apr 13 10:07 suntime
drwxr-xr-x 2 pi pi 4.0K Apr 13 10:07 suntime-1.2.5.dist-info
drwxr-xr-x 4 pi pi 4.0K Mar 25 17:22 tk
drwxr-xr-x 2 pi pi 4.0K Mar 25 17:22 tk-0.1.0.dist-info
'suntime' was the PIP package I installed and could not access until I manually compiled through Python 3.9.2
Looking at PIP, I seem to have a larger mess. Here are results of running different PIPS with and without SUDO
pi@deb:~ $ pip -V
pip 22.0.4 from /home/pi/.local/lib/python3.9/site-packages/pip (python 3.9)
pi@deb:~ $ pip2 -V
pip 18.1 from /usr/lib/python2.7/dist-packages/pip (python 2.7)
pi@deb:~ $ pip3 -V
pip 22.0.4 from /home/pi/.local/lib/python3.9/site-packages/pip (python 3.9)
pi@deb:~ $ sudo pip -V
pip 18.1 from /usr/lib/python2.7/dist-packages/pip (python 2.7)
pi@deb:~ $ sudo pip2 -V
pip 18.1 from /usr/lib/python2.7/dist-packages/pip (python 2.7)
pi@deb:~ $ sudo pip3 -V
pip 18.1 from /usr/lib/python3/dist-packages/pip (python 3.7