Python Forum
what to do if moudle not in pip3 only in pip2?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
what to do if moudle not in pip3 only in pip2?
#11
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.
Reply
#12
but I deleate it before ?
like you told me in the previous post

or did I miss something?
Reply
#13
(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/
Reply
#14
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 ,
Reply
#15
(Oct-25-2021, 08:46 AM)korenron Wrote: then I need to install something ?
You try again and see if error message change.
Reply
#16
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'
Reply
#17
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.
Reply
#18
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
Reply
#19
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
Reply
#20
 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
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  ModuleNotFoundError: No module named '_struct' when starting pip3 yuhuihu 0 2,876 May-05-2022, 04:41 AM
Last Post: yuhuihu
  cmake and pip3 install warnings with python 3.10.2 cyrduf 0 1,900 Feb-26-2022, 01:08 PM
Last Post: cyrduf
  pip3 v21.1.2 SSL Error on RHEL 7 malibu 0 3,107 Jun-01-2021, 03:17 PM
Last Post: malibu
  pip3 install opencv-python fails on 'skbuild' Pedroski55 2 5,733 Sep-15-2020, 11:33 AM
Last Post: snippsat
  Install module with pip3 on a non root user matthewpintor2107 1 2,413 Apr-28-2020, 03:16 PM
Last Post: pyzyx3qwerty
  Wrong pip3 python location or new Version 007fred50 1 3,789 Apr-02-2020, 02:36 PM
Last Post: philgoetz
  Call pip3 from python folder build by me call pip3 from the /usr/bin Suryavarman 3 3,691 Oct-07-2019, 10:23 PM
Last Post: Suryavarman
  Installed Python3.7 from package, trying to run pip3.7 does not work JBristow1729 4 7,544 Aug-11-2019, 08:24 AM
Last Post: michaellossagk
  pip3 install functools failed kintarowonders 1 15,784 Mar-07-2019, 07:56 PM
Last Post: nilamo
  What's the difference between pip and pip3? magic 5 47,978 Sep-20-2018, 08:15 PM
Last Post: magic

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020