Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Module not found question
#1
Hello,
New to python,I'm used to Matlab and Arduino. I have 3.10.6 python,and just downloaded current version of spyder.
All I'm trying to do is read serial data printed from Arduino analog pin, using serial in spyder and plot.Simple......so I thought.

Spyder code:

import serial

ser = serial.Serial("COM3", 115200)
import matplotlib.pyplot as plt
import numpy as np
plt.ion()
fig=plt.figure()


i=0
x=list()
y=list()
i=0

ser.close()
ser.open()
while True:

    data = ser.readline()
    print(data.decode())
    x.append(i)
    y.append(data.decode())

    plt.scatter(i, float(data.decode()))
    i += 1
    plt.show()
    plt.pause(0.0001)  # Note this correction
Spyder Error:

Python 3.8.10 (tags/v3.8.10:3d8993a, May  3 2021, 11:48:03) [MSC v.1928 64 bit (AMD64)]
Type "copyright", "credits" or "license" for more information.

IPython 7.34.0 -- An enhanced Interactive Python.

runfile('C:/Users/Mich/.spyder-py3/temp.py', wdir='C:/Users/Mich/.spyder-py3')
Traceback (most recent call last):

  File "C:\Users\Mich\AppData\Local\Programs\Spyder\pkgs\spyder_kernels\py3compat.py", line 356, in compat_exec
    exec(code, globals, locals)

  File "c:\users\mich\.spyder-py3\temp.py", line 3, in <module>
    import serial

ModuleNotFoundError: No module named 'serial'
Not having the best time with python currently,could someone point me in right direction.I've tried going through and trying: https://packaging.python.org/en/latest/t...ages/#id18

but cmd says pip isn't recognized...even though I have,using tutorial above.


nvm, found solution had to use anaconda 3,install and then change spyder reference....super clear and easy,thanks for help.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  datetime module question jacksfrustration 10 1,608 Jan-12-2024, 04:54 AM
Last Post: deanhystad
  pyside6 module not found ForeverNoob 4 1,275 Aug-18-2023, 04:36 PM
Last Post: snippsat
  Module Not Found Error bitoded 4 1,346 Jan-01-2023, 09:08 AM
Last Post: bitoded
  pdfminer package: module isn't found Pavel_47 25 8,415 Sep-18-2022, 08:40 PM
Last Post: Larz60+
  [SOLVED] Tkinter module not found Milan 7 21,493 Aug-05-2022, 09:45 PM
Last Post: woooee
  No module found when I run a main.py tomtom 2 1,414 Jul-20-2022, 09:24 AM
Last Post: tomtom
  No Module found in other directory than source code [SOLVED] AlphaInc 1 2,004 Nov-10-2021, 04:34 PM
Last Post: AlphaInc
  Question on subprocess module. knoxvilles_joker 3 2,621 Apr-11-2021, 12:51 AM
Last Post: knoxvilles_joker
  keyboard module question DPaul 0 2,110 Mar-23-2021, 04:22 PM
Last Post: DPaul
  KafkaUtils module not found on spark 3 pyspark aupres 2 7,259 Feb-17-2021, 09:40 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020