0

I am using python to interogate a USB Serial device (a nino tnc) I have 3 separate systems. Linux ubuntu with no issues Linux Rpi with no issues Windows 10 with issues.

As it responds correctly in the 1st 2 systems I don't think it is a hardware issue.

Windows 10 64 bit. Simple Test python code

    import serial
    port = serial.Serial('COM3',57000)  # open serial port
    print(port.name)         # check which port was really used
    port.write(b'hello')     # write a string
    port.close()             # close port
Error message
import serial
ModuleNotFoundError: No module named 'serial'

Check my system
C:\\Users\\djcle\>python --version
Python 3.9.6

C:\\Users\\djcle\>pip --version
pip 25.0.1 from c:\\users\\djcle\\appdata\\local\\programs\\python\\python39\\lib\\site-packages\\pip (python 3.9)

C:\\Users\\djcle\>pip list modules
Package    Version

-----------------

future     1.0.0
iso8601    2.1.0
pip        25.0.1
pyserial   3.5
PyYAML     6.0.2
serial     0.0.97
setuptools 56.0.0

pyserial is there ok. I thought serial was part of pyserial?

this works fine

    import sys
    print("sys version")
    print(sys.version)
    print()
    print("sys.path")
    print(sys.path)`

Output below

====================================================== RESTART: G:/Radio/Packet_APRS/tnc-tools/tnc-tools/SERIALTEST2.py ======================================================
sys version
3.11.3 (tags/v3.11.3:f3909b8, Apr  4 2023, 23:49:59) \[MSC v.1934 64 bit (AMD64)\]

sys.path
\['G:/Radio/Packet_APRS/tnc-tools/tnc-tools', 'G:\\Radio\\Packet_APRS\\tnc-tools\\tnc-tools', 'C:\\Users\\djcle\\AppData\\Local\\Programs\\Python\\Python311\\python311.zip', 'C:\\Users\\djcle\\AppData\\Local\\Programs\\Python\\Python311\\DLLs', 'C:\\Users\\djcle\\AppData\\Local\\Programs\\Python\\Python311\\Lib', 'C:\\Users\\djcle\\AppData\\Local\\Programs\\Python\\Python311', 'C:\\Users\\djcle\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages'\]

Checking where pyserial is installed

C:\Users\djcle>pip install pyserial Requirement already satisfied: pyserial in c:\users\djcle\appdata\local\programs\python\python39\lib\site-packages (3.5)

Now on my two Linux machines above works fine.

I have been trying to sort this out for 2 days.

Help please!

What I have tried is documented in main message.

Perhaps somebody has encountered and solved this issue?

2
  • 1
    This question is similar to: ImportError: No module named serial. If you believe it’s different, please edit the question, make it clear how it’s different and/or how the answers on that question are not helpful for your problem. Commented Mar 28 at 10:55
  • Please clarify how you ran your Python code on Windows. Commented Mar 28 at 10:57

2 Answers 2

2

You installed pyserial in your Python39 environment. It's not there in your Python311 environment. So either you need to run your program in the Python39 environment or install pyserial in the Python311 environment.

Sign up to request clarification or add additional context in comments.

Comments

0

I had the same issue and for me it was the problem that i had also installed an python extention just called serial. Python is then trying to use serial and not pyserial. So I deleted that and that i worked for me.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.