1

So yesterday after a bit of effort, I was able to get Pyserial 3.3 up and running on my Raspberry Pi 3 Model B. I even wrote some test code to make sure it worked properly, everything was fine.

So I boot up my Pi today, go to run the test code again and get the following error:

Import Error: No module named 'serial'

This was obviously from me running import serial on my test script. But it worked fine yesterday so I am confused.

SO I decided to boot up the terminal and run pip to make sure PySerial is still installed:

Requirement already satisfied: pyserial in /usr/local/lib/python2.7/dist-packages/pyserial-3.3-py2.7.egg

So what is my problem? The only thing I can come up with is at the end of the night I was trying to upgrade my IDLE to 3.6 since I was using 3.4. Maybe the install didn't go right? How would I go about undoing that install if that was the problem?

4
  • I wish people would use sudo apt-get install python-x to install module x on the Pi rather than pip. Python modules need to be installed for each Python version you intend to use. When you say 3.4 and 3.6 are you talking about Python versions?
    – joan
    Commented Jun 23, 2017 at 16:59
  • @joan yes I am talking about Python version 3.6. ANd honestly, I installed it using sudo apt as opposed to pip. I'm thinking I might not have installed it properly however :\ Commented Jun 23, 2017 at 17:06
  • You will have a lot fewer problems if you pick a version or library and stick with it. No software product would ever be completed if they changed program versions or libraries the way you are. Not only are you causing yourself problems, but others will be less willing to help you as it appears they wasted their time. Since you upgraded python you need to reinstall pyserial as @joan pointed out. Commented Jun 23, 2017 at 17:33
  • @SteveRobillard The reason I'm changing versions on things is because I've picked up an in progress project. There wasn't a lot of code in said project, so I am re-purposing it and restructuring it, but at the same time I am also trying to see what worked from said code. The parts of the project I am writing myself and re-purposing I am writing in Python 3.6. The old code I will be getting rid of was written in 2.7. That's why I've been a little all over the place with versions. Commented Jun 23, 2017 at 17:56

1 Answer 1

1

So my problem was the version upgrade I did. When I ran the Python code after opening up 3.6 it ran perfectly fine. Thanks to anyone who was offering help, it's appreciated.

1
  • 1
    If you really need to use multiple python version, you may consider using virtual environnements, especially made for the dependencies don't collide. Commented Jun 23, 2017 at 18:01

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.