Page 1 of 1

Python issues - ImportError: No module named site

Posted: Wed Feb 14, 2018 9:35 pm
by nathanh
Using Windows. I followed the default toolchain setup.
During make flash for "hello_world" project I get a python error:

kannhild@kanm5428 MINGW32 ~/esp/hello_world
$ make flash
ImportError: No module named site

I tried to fix this by setting the PYTHONPATH, but ran into further issues with not finding _collections. I don't know where this file is.

kannhild@kanm5428 MINGW32 ~/esp/hello_world
$ export PYTHONPATH="/mingw32/lib/python2.7/:/mingw32/lib/python2.7/site-packages"

kannhild@kanm5428 MINGW32 ~/esp/hello_world
$ make flash
Traceback (most recent call last):
File "C:/msys32/home/kannhild/esp/esp-idf/components/esptool_py/esptool/esptool.py", line 21, in <module>
import argparse
File "C:/msys32/mingw32/lib/python2.7/argparse.py", line 85, in <module>
import collections as _collections


I am considering abandoning the Windows Environment and trying ubuntu but I expected this to work as default.
Any help?

Re: Python issues - ImportError: No module named site

Posted: Wed Feb 14, 2018 11:59 pm
by ESP_Angus
It looks like the MSYS2 Python installation is somehow very broken.

Can you please run the following commands in the MINGW32 terminal and post the results:

Code: Select all

which python

python -V

echo $PATH

Re: Python issues - ImportError: No module named site

Posted: Thu Feb 15, 2018 2:17 pm
by nathanh
kannhild@kanm5428 MINGW32 ~/esp/hello_world
$ which python
/mingw32/bin/python

kannhild@kanm5428 MINGW32 ~/esp/hello_world
$ python -V
Python 2.7.14

kannhild@kanm5428 MINGW32 ~/esp/hello_world
$ echo $PATH
/mingw32/bin:/usr/local/bin:/usr/bin:/bin:/c/Windows/System32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0/:/opt/xtensa-esp32-elf/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl;/mingw32/lib/python2.7/

kannhild@kanm5428 MINGW32 ~/esp/hello_world

Re: Python issues - ImportError: No module named site

Posted: Fri Feb 16, 2018 1:33 am
by ESP_Angus
Thanks nathan. This all looks correct to me, I can't really explain how it's failing to import built-in Python modules.

Did you download and unzip the all-in-one environment and toolchain from here?
http://esp-idf.readthedocs.io/en/latest ... hain-setup

Is it possible the installation somehow may have been corrupted, or ran out of space at some point?

Re: Python issues - ImportError: No module named site

Posted: Fri Feb 16, 2018 4:25 pm
by nathanh
Yes I downloaded and uncompressed from that link. I tried it multiple times and no luck.
I am sure I did not corrupt as I ran only the "Getting Started" procedure.

Anyway, I have switched to ubuntu for development and the environment is working as expected.