Page 1 of 2

Eclipse IDE - No module named serial

Posted: Sat Dec 17, 2016 6:27 pm
by phando
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

Re: Eclipse IDE - No module named serial

Posted: Sun Dec 18, 2016 4:59 pm
by kolban
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"

Re: Eclipse IDE - No module named serial

Posted: Sun Dec 18, 2016 7:57 pm
by phando
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

Re: Eclipse IDE - No module named serial

Posted: Sun Dec 18, 2016 8:44 pm
by kolban
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

Re: Eclipse IDE - No module named serial

Posted: Sun Dec 18, 2016 11:02 pm
by WiFive

Re: Eclipse IDE - No module named serial

Posted: Mon Dec 19, 2016 3:36 am
by ESP_Angus
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

Re: Eclipse IDE - No module named serial

Posted: Mon Dec 19, 2016 5:06 am
by phando
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.

Re: Eclipse IDE - No module named serial

Posted: Mon Dec 19, 2016 5:17 am
by ESP_Angus
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.

Re: Eclipse IDE - No module named serial

Posted: Mon Dec 19, 2016 5:49 am
by phando
Great day in the morning!
Changing python's path in the interpreter did the trick.

Thank you all.

Re: Eclipse IDE - No module named serial

Posted: Sun Jul 23, 2017 2:26 pm
by spuzesp32
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.