0

I need to process serial data using python for a project I am working on. However, the download of python 3 I have installed does not have the serial module already, so I have been working on trying to install the module.

To install the module, I downloaded PySerial 3.4, and tried to use the command prompt to install it. Specifically, I accessed the pyserial folder and found its address, directed the command prompt to that folder, and then prompted the system to install. What I typed into the command line looked as follows:

C:\WINDOWS\system32>cd C:\Users\rinty\Desktop\pyserial-3.4

C:\Users\rinty\Desktop\pyserial-3.4>python setup.py install

However, when I do this nothing occurs. No download. When I instead type

C:\Users\rinty\Desktop\pyserial-3.4>setup.py install

The install will run, but presumably not through python. When I attempt to use the command

import serial

In the python IDE I still get a "No module named 'serial'" error in response.

Is there something I am missing? How do I get python to run the setup code for pyserial? Any help is appreciated.

UPDATE

Instead of using the Windows command prompt, I tried using the Anaconda powershell. I then navigated to the pyserial folder and used the pip installation advice as follows:

cd C:\Users\rinty\Desktop\pyserial-3.4
pip install -e.

I got this response from the system:

Installing collected packages: pyserial
  Running setup.py develop for pyserial
Successfully installed pyserial

BUT, when I try to import serial in the Spyder IDE, it still tells me that no serial module can be found. Any advice?

Smurphinator
  • 1
  • 1
  • 2

1 Answers1

0

Use --user Tag

Try using the --user (in the directory as follows) with the command as follows:

 python setup.py install --user 

The --user option directs setup.py to install the package (for example, foo) in the user site-packages directory for the running Python

Use pip

I prefer to use pip in such cases (I use linux). Go to the respective folder and type the following:

sudo pip install -e

This command will search for the setup.py on its own. Refer to this answer for a better understanding of how this command works sudo pip install -e

Use PyCharm instead of Spider

Since I had been using Linux for so long, I was very inexperienced with windows python. --user worked for me in most cases. But, many such problems can be solved with PyCharm, especially those that arise due to different versions of python on the same machine. You can choose from the UI itself which python-interpreter you want to use and you can uninstall modules for that particular version. You can even create virtual environments.

Following are the steps:

1) Install PyCharm https://www.jetbrains.com/pycharm/download/#section=windows

2) Go to File Menu. Click on settings

3) Chose the Interpreter

enter image description here

4) Install module:

enter image description here

Let me know if this doesn't work :)

Eshita Shukla
  • 791
  • 1
  • 8
  • 30
  • 1
    It did wait a while to process when I used your ```--user``` method. However, python still says I don't have a serial module. I'm wondering if it has something to do with me using the Spyder IDE? – Smurphinator Mar 04 '20 at 01:17
  • That could be a reason... Let me give you a shortcut - use PyCharm. I'll change my answer – Eshita Shukla Mar 04 '20 at 16:04