Python Forum
what to do if moudle not in pip3 only in pip2? - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: what to do if moudle not in pip3 only in pip2? (/thread-35361.html)

Pages: 1 2 3


RE: what to do if moudle not in pip3 only in pip2? - snippsat - Oct-24-2021

You have a old module it switch to in error message /usr/lib/python3/dist-packages/serial/
It start at /home/pi/.local/lib/python3.7 then should not switch to /usr/lib/python3/
So delete this serial folder to,or use virtual environment to avoid this.


RE: what to do if moudle not in pip3 only in pip2? - korenron - Oct-25-2021

but I deleate it before ?
like you told me in the previous post

or did I miss something?


RE: what to do if moudle not in pip3 only in pip2? - snippsat - Oct-25-2021

(Oct-25-2021, 06:07 AM)korenron Wrote: but I deleate it before ?
like you told me in the previous post
If you look at error message so is path not the same,you have two Python 3 version.
So /usr/lib/python3/ is the old version that comes with OS.
Then i guess you have installed a newer version at /home/pi/.local/lib/python3.7
When run it switch to try using serial that have been installed for old Python 3.
rm -r /usr/lib/python3/dist-packages/serial/



RE: what to do if moudle not in pip3 only in pip2? - korenron - Oct-25-2021

I'm sorry
I'm not that string in Linux
so again just to be sure:

remove the old foldet
Quote:rm -r /usr/lib/python3/dist-packages/serial/
then I need to install something ?

because this is what I'm getting:

pi@raspberrypi:~ $ sudo rm -r /usr/lib/python3/dist-packages/serial/
pi@raspberrypi:~ $ python3 GetAllData_test.py
Traceback (most recent call last):
  File "GetAllData_test.py", line 6, in <module>
    import serial
ModuleNotFoundError: No module named 'serial'
Thanks ,


RE: what to do if moudle not in pip3 only in pip2? - snippsat - Oct-25-2021

(Oct-25-2021, 08:46 AM)korenron Wrote: then I need to install something ?
You try again and see if error message change.


RE: what to do if moudle not in pip3 only in pip2? - korenron - Oct-25-2021

pi@raspberrypi:~ $ sudo rm -r /usr/lib/python3/dist-packages/serial/
pi@raspberrypi:~ $ python3 GetAllData_test.py
Traceback (most recent call last):
  File "GetAllData_test.py", line 6, in <module>
    import serial
ModuleNotFoundError: No module named 'serial'



RE: what to do if moudle not in pip3 only in pip2? - snippsat - Oct-25-2021

If you do from command line:
which python3 
pip3 -V
What dos it output?
There is some mess in your python version setup.
As show virtual environment could solve this,i did take me 1-min to do this.


RE: what to do if moudle not in pip3 only in pip2? - korenron - Oct-25-2021

which python3
/usr/bin/python3
pi@raspberrypi:~ $ pip3 -V
pip 18.1 from /usr/lib/python3/dist-packages/pip (python 3.7)
I didn't do\remove anything
this is a freash installtion of PI
* the only think I have done it what you told me and also download using pip3 the needed packages


RE: what to do if moudle not in pip3 only in pip2? - snippsat - Oct-25-2021

When you do python3 you are using the old version.
When install you are installing to new Python 3.7 version.
Test with:
python3.7 -V 
Then when run need always to use.
python3.7 GetAllData_test.py



RE: what to do if moudle not in pip3 only in pip2? - korenron - Oct-25-2021

 python3.7 -V
Python 3.7.3
and still dones't work
python3.7 GetAllData_test.py
Traceback (most recent call last):
  File "GetAllData_test.py", line 6, in <module>
    import serial
ModuleNotFoundError: No module named 'serial'
*** up until now on all the codes I wrote , I only used python3 in the command line - and it works