Cannot build project in Eclipse due to Python installation

sheikhumar93
Posts: 13
Joined: Fri Aug 10, 2018 7:47 am

Cannot build project in Eclipse due to Python installation

Postby sheikhumar93 » Fri Aug 10, 2018 8:02 am

I have been trying to get ESP-IDF up and running on my macOS 10.13.6 system. I have successfully installed all the pre-requisites and am able to deploy the examples that come along with the IDF using the Terminal, but now I need an IDE from where I can go and write my own code, but I have been unable to do so using Eclipse.

My system has anaconda3 installed which I think is the source of the problem

Code: Select all

where python
returns:

Code: Select all

/anaconda3/bin/python
/usr/local/bin/python
/usr/bin/python


The default python executable in Terminal is the first one (anaconda3)
Even when I make my project from the Terminal I have to change Python2 Interpreter under SDK tool Configuration to python2 from python, otherwise it throws all sorts of error, but after changing to python2 it compiles and executes just fine

Now in Eclipse, I have followed all the instructions from here http://esp-idf.readthedocs.io/en/v3.1-beta1/get-started/eclipse-setup.html. But when I use "python" under Python 2 Interpreter it throws this error "No module named serial.tools.list_ports", while when I use python2 it throws "python2: command not found". I have tried to modified my PYTHON_PATH in Eclipse to all the possibilities from "where python" and "where python2" but it does not work.

I have run both "pip install pyserial" and "pip2 install pyserial". But it just doesn't work. Any help would be appreciated as without building the Eclipse editor just looks horrible with all those red squiggly lines underneath the code.

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

Re: Cannot build project in Eclipse due to Python installation

Postby ESP_Angus » Mon Aug 13, 2018 4:26 am

Hi sheikhumar,

You may need to edit both the PATH and the PYTHON_PATH environment variables of your Eclipse project to specify the correct path to Python.

PATH will be a list of directories, delimited by colons (:). Keep all the existing entries, but place the directory containing your (correct) python interpreter at the beginning of the list.

(If you're not sure which directory to specify, open a terminal session with a - working - build which is using "python2" set in menuconfig, and type "which python2". This directory is the correct one to specify.)

sheikhumar93
Posts: 13
Joined: Fri Aug 10, 2018 7:47 am

Re: Cannot build project in Eclipse due to Python installation

Postby sheikhumar93 » Mon Aug 13, 2018 4:58 am

Hi ESP_Angus thanks for the reply, I have added python2 directory after running

Code: Select all

which python2
to both PATH and PYTHONPATH env variables but it still says python2:command not found.

Screen Shot 2018-08-13 at 9.53.50 AM.png
Screen Shot 2018-08-13 at 9.53.50 AM.png (19.88 KiB) Viewed 271 times

Screen Shot 2018-08-13 at 9.54.05 AM.png
Screen Shot 2018-08-13 at 9.54.05 AM.png (35.81 KiB) Viewed 271 times

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

Re: Cannot build project in Eclipse due to Python installation

Postby ESP_Angus » Mon Aug 13, 2018 7:30 am

Hi sheikhumar93,

Set the entries to the directory path, not the executable path. ie /usr/local/bin/ only.

Angus

sheikhumar93
Posts: 13
Joined: Fri Aug 10, 2018 7:47 am

Re: Cannot build project in Eclipse due to Python installation

Postby sheikhumar93 » Mon Aug 13, 2018 7:44 am

Yup, that was actually really stupid of me :D
Thanks

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

Re: Cannot build project in Eclipse due to Python installation

Postby ESP_Angus » Tue Aug 14, 2018 3:21 am

Glad to hear it's working now. :)

Who is online

Users browsing this forum: No registered users and 5 guests