Eclipse IDE - No module named serial

phando
Posts: 24
Joined: Wed Dec 14, 2016 5:30 am

Eclipse IDE - No module named serial

Postby phando » Sat Dec 17, 2016 6:27 pm

Hey All,
I am super stoked to have my hands on a few ESP32s. From the command line I am able to build and flash the myapp code. In Eclipse I am unable to configure it properly to see my pyserial installation. Once everything is done compiling I get a "No module named serial" error. Can you please let me know how to point Eclipse in the right direction to see my python setup?

Thanks
Joe

User avatar
kolban
Posts: 1683
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

Re: Eclipse IDE - No module named serial

Postby kolban » Sun Dec 18, 2016 4:59 pm

Howdy Joe,
Did you by any chance see the documentation here:

http://esp-idf.readthedocs.io/en/latest ... setup.html

Step 0 is to install some pre-reqs an that looks like includes "python-serial"
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

phando
Posts: 24
Joined: Wed Dec 14, 2016 5:30 am

Re: Eclipse IDE - No module named serial

Postby phando » Sun Dec 18, 2016 7:57 pm

Kolban,
Thanks for your response. I am able to build everything from the command line. When I run "pip3 list" it both shows pyserial is installed. My issue is the one step to get eclipse to be able to import (or see) the pyserial installation.

Joe

User avatar
kolban
Posts: 1683
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

Re: Eclipse IDE - No module named serial

Postby kolban » Sun Dec 18, 2016 8:44 pm

Howdy Joe, did you see this video tutorial:

https://www.youtube.com/watch?v=bYh2w0HzS7s

Does your configuration dramatically change from that described there? If yes, can you describe your recipes?

Neil
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: Eclipse IDE - No module named serial

Postby WiFive » Sun Dec 18, 2016 11:02 pm


ESP_Angus
Posts: 2344
Joined: Sun May 08, 2016 4:11 am

Re: Eclipse IDE - No module named serial

Postby ESP_Angus » Mon Dec 19, 2016 3:36 am

Hi phando,

As hinted by WiFive, esptool.py currently only supports Python 2 (porting to Python 3 is in progress but still a reasonable time away.) A menuconfig option can be used to set a different Python interpreter, if the default "python" is Python 3 (can check via "python -v").

What OS are you using?

Angus

phando
Posts: 24
Joined: Wed Dec 14, 2016 5:30 am

Re: Eclipse IDE - No module named serial

Postby phando » Mon Dec 19, 2016 5:06 am

Thanks for all the responses.

@Angus, I am using OSX, I probably should have mentioned that in my first post.
@WiFive, yes, I have watched that video about ten times. My recipe looks exactly the same as the in the video.
@Kolban, great video and I just bought your book.

I didn't know esptool only works with python 2.7. I had two versions of python on my machine, so I made sure to remove 3.x. To be thorough, I reinstalled 2.7 with brew. From there I used brew to install pyserial. Now when I "pip list" it shows:

Code: Select all

pip (9.0.1)
pyserial (3.2.1)
setuptools (28.8.0)
virtualenv (15.0.3)
Still my problem exists. I can build and flash fine from the command line, but when I run the flash target from eclipse, it looks like it compiles fine and bails out right when it tries to flash the chip.

Code: Select all

File "/Users/jandolina/esp/esp-idf/components/esptool_py/esptool/esptool.py", line 25, in <module> import serial
ImportError: No module named serial
I have seen some threads talking about pyDev in the eclipse environment. It seems all I need is to get eclipse to point to the brew python so it can see the serial package.

ESP_Angus
Posts: 2344
Joined: Sun May 08, 2016 4:11 am

Re: Eclipse IDE - No module named serial

Postby ESP_Angus » Mon Dec 19, 2016 5:17 am

phando wrote: I have seen some threads talking about pyDev in the eclipse environment. It seems all I need is to get eclipse to point to the brew python so it can see the serial package.
Sounds like it. One way is:
  • In Terminal, run "which python2.7" and copy the output.
  • "make menuconfig"
  • Under "SDK Tool Configuration" -> "Python 2 Interpreter", delete the default name and paste the command output.
This method has the advantage that you can install Python 3 without worrying about breaking the Python 2 support for esp-idf. Unfortunately, you'll have to do it for each project.

The other way is to manipulate the PATH inside Eclipse so your Python directory comes before it's internal pyDev version. I'm afraid I don't know how to do this.

phando
Posts: 24
Joined: Wed Dec 14, 2016 5:30 am

Re: Eclipse IDE - No module named serial

Postby phando » Mon Dec 19, 2016 5:49 am

Great day in the morning!
Changing python's path in the interpreter did the trick.

Thank you all.

spuzesp32
Posts: 9
Joined: Sun Jul 23, 2017 2:24 pm

Re: Eclipse IDE - No module named serial

Postby spuzesp32 » Sun Jul 23, 2017 2:26 pm

phando, what exactly did you do to fix this problem? I have exactly the same issue. I can compile from the command line, but when make runs from within Eclipse it seems to use a python version that does not have the serial module installed.

Who is online

Users browsing this forum: No registered users and 67 guests