Python Forum
importing serial - 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: importing serial (/thread-40289.html)



importing serial - Fklein23 - Jul-05-2023

I have a Python project I have been developing on Windows. (I wish I could use Linux for this project, because I would already be done)
My project has all its internals finished, now I have to populate the stubs for communicating with external hardware.
I have been reading tutorials about how to install pyserial on my Windows based python3. None of the tutorials instructions have worked.
I even resorted to asking ChatGPT for assistance. He/she struck out and finally told me to go to the forums for help. (So here I am)

I have a simple interface I must finish up. The only piece that is missing is that I cannot resolve the references to the serial module.
I know that pyserial is already present in my system, because I got this error message from one of my attempts:

$> pip install pyserial
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: pyserial in c:\users\docru\appdata\roaming\python\python310\site-packages (3.5)

And version 3.5 is the latest version.

But I have no idea how to get my python interpreter to access it. My PATH environment variable is set up to access python3, but "import serial" gives me this error: "ModuleNotFoundError: No module named 'serial' "

Does anyone out there have any suggestions?

Thanks,
Frank


RE: importing serial - Larz60+ - Jul-05-2023

you may have multiple versons of python installed.
It's important to note thate each version would have it's own version of pip.
to see if the default version of each match, us(from command line)
python -V and pip -V
which python which I think is where python on windows

make sure all match


RE: importing serial - deanhystad - Jul-05-2023

The tutorials you need to watch are tutorials for creating Python virtual environments. You should create a virtual environment (venv) and install modules in this environment. This lets you have multiple Python projects without having to worry about one project having python or package versions that are incompatible with other projects.