Python issues - ImportError: No module named site

nathanh
Posts: 3
Joined: Wed Feb 14, 2018 9:17 pm

Python issues - ImportError: No module named site

Postby nathanh » Wed Feb 14, 2018 9:35 pm

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?

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

Re: Python issues - ImportError: No module named site

Postby ESP_Angus » Wed Feb 14, 2018 11:59 pm

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

nathanh
Posts: 3
Joined: Wed Feb 14, 2018 9:17 pm

Re: Python issues - ImportError: No module named site

Postby nathanh » Thu Feb 15, 2018 2:17 pm

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

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

Re: Python issues - ImportError: No module named site

Postby ESP_Angus » Fri Feb 16, 2018 1:33 am

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?

nathanh
Posts: 3
Joined: Wed Feb 14, 2018 9:17 pm

Re: Python issues - ImportError: No module named site

Postby nathanh » Fri Feb 16, 2018 4:25 pm

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.

Who is online

Users browsing this forum: ginodecock and 2 guests