I got a Rasberry Pi 3B+ up to date with python libraries 2.7 and 3.7 also up to date. I try to run that code :
from serial import Serial
import RPI.GPIO as GPIO
import os, time
from gsmHat import GSMHat, SMS, GPS
But I got this issue :
ImportError: cannot import name 'Serial' from 'serial' (/home/pi/.local/lib/python3.7/site-packages/serial/init.py)
So I tried to uninstall and install pyserial on python 2.7 and 3.7
pip uninstall pyserial
pip install pyserial
pip3 uninstall pyserial
pip3 install pyserial
It didn't work so I tried with super user command :
sudo pip uninstall pyserial
sudo pip install pyserial
sudo pip3 uninstall pyserial
sudo pip3 install pyserial
I also try to rename my *.py code file to avoid a name overlap. Then I tied to remove "from serial import Serial" from the code :
import RPI.GPIO as GPIO
import os, time
from gsmHat import GSMHat, SMS, GPS
and I had the same issue that I had on serial module on RPI.GPIO one :
ModuleNotFoundError: No module named 'RPI'
So as mosul issue came up with two modules I tried to reinstall python :
sudo apt-get install python-pip
But python was already up to date as I saw it when I tiped :
pip freeze | grep Rpi pip3 freeze | grep Rpi
Who return something in both python 2.7 and 3.7 :
GPi.GPIO==0.7.0
so I looked in Thonny > Tools > Manage Packages > Serial to check that Thonny sees libraries in my /home/usr/python3 directory and Thonny sees botn serial and RPi.GPIO libraries.
So it seems that all libraries are install and compilation app sees them but do not use them.
Any idea please?
Thanks a lot.