Skip to content

install.bat fails on Ubuntu 18 with Python 3.6.9: The path python2 (from --python=python2) does not exist (IDFGH-6386) #8045

@georgik

Description

@georgik

Environment

  • Development Kit: none
  • IDF version (run git describe --tags to find it): v4.3.1
  • Build System: idf.py
  • Operating System: Linux - Ubuntu 18
  • Using an IDE?: No

Problem Description

Environment: Ubuntu 18, installed package python3-python (3.6.9), NO python 2 package installed, NO python-minimal

install.bat fails with error:

Creating a new Python environment in /home/georgik/.espressif/python_env/idf4.3_py3.6_env
The path python2 (from --python=python2) does not exist
Traceback (most recent call last):
  File "/home/georgik/projects/rust-build/rust-esp32-std-demo/.embuild/espressif/esp-idf-v4.3.1/tools/idf_tools.py", line 1675, in <module>
    main(sys.argv[1:])
  File "/home/georgik/projects/rust-build/rust-esp32-std-demo/.embuild/espressif/esp-idf-v4.3.1/tools/idf_tools.py", line 1671, in main
    action_func(args)
  File "/home/georgik/projects/rust-build/rust-esp32-std-demo/.embuild/espressif/esp-idf-v4.3.1/tools/idf_tools.py", line 1380, in action_install_python_env
    stdout=sys.stdout, stderr=sys.stderr)
  File "/usr/lib/python3.6/subprocess.py", line 311, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/usr/bin/python', '-m', 'virtualenv', '/home/georgik/.espressif/python_env/idf4.3_py3.6_env']' returned non-zero exit status 3.

Manual execution of: /usr/bin/python3 -m virtualenv /home/georgik/.espressif/python_env/idf4.3_py3.6_env' returns:

The path python2 (from --python=python2) does not exist

Root-cause: install.sh is not explicit about binary for virtualenv. Creation of virtualenv picks different Python than running instance.
Correct solution is to pass parameter -p with explicit path to the Python.
The similar solution is already in Windows Installer: https://github.com/espressif/idf-installer/blob/main/src/InnoSetup/Environment.iss#L423
Correct line should look like this:

/usr/bin/python3 -m virtualenv /home/georgik/.espressif/python_env/idf4.3_py3.6_env' -p /usr/bin/python3 --seeder pip

Note: do not forget seeder pip to avoid further problems.

Expected Behavior

Installation works.

Actual Behavior

Installation fails with message above.

Workaround: sudo update-alternatives --install /usr/bin/python2 python2 /usr/bin/python3.6 1

Steps to reproduce

  1. make sure to have Ubuntu 18, with python3 and no python (2)
  2. clone ESP-IDF
  3. execute ./install.bat

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions