Digistump Forums

The Oak by Digistump => Oak Support => Topic started by: jcverive on April 06, 2016, 11:02:44 am

Title: "No module named serial" error when trying to flash firmware w serial connection
Post by: jcverive on April 06, 2016, 11:02:44 am
I've been trying to follow the instructions for flashing the Oak firmware in Windows (http://digistump.com/wiki/oak/tutorials/serialupdate), but the esptool gives me the error

No module named serial

Peeking into esptool.py, I see that an attempt is being made to import serial, but it obviously isn't being found. How do I install the necessary file in Windows? Or is there a different version of esptool that I should be using? Or is there a third option? The WiFi on my Oak isn't working, so I have to re-flash the firmware using a serial connection
Title: Re: "No module named serial" error when trying to flash firmware w serial connection
Post by: defragster on April 06, 2016, 11:13:14 am
I posted this on another thread - I had that problem and I thought I wrote my solution down in the WiKi but didn't find it - I searched the web and found this - let me know if it works from the command line:

Quote
C:\Users\defragster>python
Python 2.7.11 (v2.7.11:6d1b6a68f775, Dec  5 2015, 20:40:30) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> pip install pyserial
>>>

<edited> See following post if you don't have "pip" installed.
Title: Re: "No module named serial" error when trying to flash firmware w serial connection
Post by: jcverive on April 08, 2016, 07:59:01 am
Nope - no luck:

Quote
Microsoft Windows [Version 10.0.10586]
(c) 2015 Microsoft Corporation. All rights reserved.

C:\Windows\system32>python
Python 2.7.11 (v2.7.11:6d1b6a68f775, Dec  5 2015, 20:32:19) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import serial
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named serial
>>>

Any other ideas?
Title: Re: "No module named serial" error when trying to flash firmware w serial connection
Post by: defragster on April 08, 2016, 11:41:49 am
Here it is in an email I sent ERIK - I thought I dropped it in Wiki or github:

Quote
So I have the python 2.7.11 installed for ESP on Arduino – and as we noted before SERIAL is a pain to get.  Well I needed it again and got this link – that made it TRIVIAL:
 
Turns out with this later 2.7.11 python PIP is preinstalled (so I didn’t need to install that) – though it told me to UPDATE PIP { python -m pip install --upgrade pip } after I used it:
 
http://stackoverflow.com/questions/8491111/pyserial-for-python-2-7-2 (http://stackoverflow.com/questions/8491111/pyserial-for-python-2-7-2)
You could try it with pip. (Here a question/answer about installing it)
Then type in your shell:

pip install pyserial
Solution:
The installation of pip on Windows 7 64 is a little tricky: I added my Python and Python/Scripts path to the PATH env.
Then I opened PythonWin as Administrator, ran ez_setup.py from http://pypi.python.org/pypi/setuptools#downloads with PythonWin. And then I downloaded pip unpacked it and as Administrator I ran python setup.py install on the windows shell and after that pip install pyserial.
Title: Re: "No module named serial" error when trying to flash firmware w serial connection
Post by: PeterF on April 08, 2016, 07:01:00 pm
@jcverie

Two that can trip you up in particular 1) you need to make sure that your python install path is in the system path, otherwise you can't access python - but this doesn't seem to be an issue in your case, as you were able to access it without changing to the python install directory.  2) You need to install PySerial - as is documented on the wiki page (http://digistump.com/wiki/oak/tutorials/serialfirmware). Since you're running Windows 10, you can use the windows installer (https://pypi.python.org/pypi/pyserial) linked on that page. Make sure you right click on the installer and choose 'Run as Administrator', as you will get error messages from the installer otherwise. That should be all you need to do get it working. That was all I needed on a Windows 10 system without any prior python / ESP related install.

Pete
Title: Re: "No module named serial" error when trying to flash firmware w serial connection
Post by: defragster on April 08, 2016, 07:19:47 pm
pfeerick - my 2.7 python was properly installed - the "pip install pyserial" worked easy from the command line python shell.  I'd recommend that over manual download efforts - those failed for me.