Inconsistent Python versions between ESP-IDF tools and native OS
Posted: Thu Feb 25, 2021 8:36 am
The ./install.sh command in section "Step 3. Set up the tools" of the Get Started page for the ESP32-S2 downloads a number of large binary tools, saves the downloads and installs them in an .espressif folder. It then creates a Python 2.7 environment and installs a bunch of Python modules in the same directory. This creates a number of Python-related problems:
Mike
- Python 2.7 is at end-of-life. Some Python 3.x version should be used.
- It looks like a Python virtual environment is created. The first couple lines of output from this phase are:
Code: Select all
Installing Python environment and packages Creating a new Python environment in /Users/mike/.espressif/tools/python_env/idf4.4_py2.7_env created virtual environment CPython2.7.16.final.0-64 in 14559ms
- This virtual environment is problematic. There are no instructions to activate this Python virtual environment later when the tools are used. Should this be automatic?
- if this environment is activated manually, trouble ensues:
Code: Select all
% source /Users/mike/.espressif/tools/python_env/idf4.4_py2.7_env/bin/activate (idf4.4_py2.7_env) mike@Mikes-MacBook-Pro-10-1 ~ % get_idf Adding ESP-IDF tools to PATH... Not using an unsupported version of tool openocd-esp32 found in PATH: unknown. Using Python interpreter in python: aliased to /usr/local/bin/python3 Checking if Python packages are up to date... The following Python requirements are not satisfied: click>=7.0 pyserial>=3.0 future>=0.15.2 cryptography>=2.1.4 pyparsing>=2.0.3,<2.4.0 pyelftools>=0.22 gdbgui==0.13.2.0 pygdbmi<=0.9.0.2 kconfiglib==13.7.1 reedsolo>=1.5.3,<=1.5.4 bitstring>=3.1.6 ecdsa>=0.16.0 construct==2.10.54 To install the missing packages, please run "/Users/mike/esp/esp-idf/install.sh" Diagnostic information: IDF_PYTHON_ENV_PATH: /Users/mike/.espressif/tools/python_env/idf4.4_py2.7_env Python interpreter used: /usr/local/bin/python3 Warning: python interpreter not running from IDF_PYTHON_ENV_PATH PATH: /Users/mike/.espressif/tools/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin:/Users/mike/.espressif/tools/tools/xtensa-esp32s2-elf/esp-2020r3-8.4.0/xtensa-esp32s2-elf/bin:/Users/mike/.espressif/tools/tools/xtensa-esp32s3-elf/esp-2020r3-8.4.0/xtensa-esp32s3-elf/bin:/Users/mike/.espressif/tools/tools/riscv32-esp-elf/1.24.0.123_64eb9ff-8.4.0/riscv32-esp-elf/bin:/Users/mike/.espressif/tools/tools/esp32ulp-elf/2.28.51-esp-20191205/esp32ulp-elf-binutils/bin:/Users/mike/.espressif/tools/tools/esp32s2ulp-elf/2.28.51-esp-20191205/esp32s2ulp-elf-binutils/bin:/Users/mike/.espressif/tools/tools/openocd-esp32/v0.10.0-esp32-20200709/openocd-esp32/bin:/Users/mike/.espressif/tools/python_env/idf4.4_py2.7_env/bin:/usr/local/sbin:/Users/mike/Projects/moddable/build/bin/mac/release:/Library/Frameworks/Python.framework/Versions/3.9/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/Library/Apple/usr/bin:/Applications/Wireshark.app/Contents/MacOS:/Users/mike/esp/esp-idf/tools:/Applications/Visual Studio Code.app/Contents/Resources/app/bin (idf4.4_py2.7_env) mike@Mikes-MacBook-Pro-10-1 ~ %
- Similar trouble is encountered if the environment is not invoked directly, but the get_idf command is defined (as shown in a later paragraph) and used.
- In any case, conflicts between Python versions installed in the host environment and ESP-IDF related tooling seem probable.
- I've attempted to search this forum for "python version" and a number of related search terms without success.
- is there a discussion of "proper use" of Python versions in ESP-IDF tooling and development in the docs anywhere?
Mike