1

I'm trying to import PySerial import serial, but i get a ModuleNotFoundError: No module named 'serial'. I installed PySerial via conda install pyserial and I also tried with pip install pyserial in both cases I get the same error, but if execute conda list or pip list pyserial appears in the list. I'm using VS Code on Windows and unistalled and reinstalled Anconda, VS Code and PySerial serveral times. I checked also, that there is not the serial package.

Can anybody tell me why I can not import serial?

Edit:

I also tried conda install -c conda-forge pyserial once...

Mr.Thoasty
  • 11
  • 1
  • 3

1 Answers1

0

Probably you are not running the python version you think you are.

Find full path of the Python interpreter?

try:

 import sys
 print(sys.executable)

And see if it matches what you expect.

If you don't know what to expect, it's more likely you aren't running the right pip. In that case you could make sure to run the right pip like this:

python -m pip install pyserial

Which pip is with which python?

poleguy
  • 523
  • 7
  • 11
  • Not quite sure what to expect, but I get `C:\...\AppData\Local\Programs\Python\Python38-32\python.exe` and if I hit the Run Button of VS Code I get `& C:/.../AppData/Local/Programs/Python/Python38-32/python.exe` i the terminal before the path of my py file, so I think this is good. Or am I wrong? – Mr.Thoasty May 23 '20 at 14:04
  • In this case I get a `Requirement already satisfied: pyserial in c:\...\anaconda3\lib\site-packages (3.4)` so this should be fine right? – Mr.Thoasty May 23 '20 at 14:15
  • That's not right. You're running normal python38-32 (which is weird. why are you running 32bit?) instead of anaconda python, but it's pointing to the anaconda libraries in some way. I'd blow it all up. Why not remove all your python installs, make sure python is not on your path, then install miniconda, create an environment and then install just the packages you need. Or can you explicitly run anaconda python by specifying the whole path? – poleguy May 25 '20 at 14:41