Installation error setting up python virt environment

noweare
Posts: 96
Joined: Tue Jul 02, 2019 11:35 am

Installation error setting up python virt environment

Postby noweare » Tue Sep 16, 2025 6:27 pm

Setting up esp-idf using vsc extenstion in visual studio code.
I need to have two versions of esp-idf installed.
First version 5.xx set up without errors.

Trying to install version 4.4.8 and the installer chokes on setting up virtual environment.
The error i get is shown below. I tried pointing it to a virtual python executable bin directory but it wanted a system wide directory
ie. /user/bin/python3, but it told me "Selected python is from a virtual environment. Choose system python"

Kind of stuck here. Wonder why the first install went ok when all conditions were the same.


ERROR MESSAGE
"
non zero exit code 1
pip 24.0 from /usr/lib/python3/dist-packages/pip (python 3.12)
error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
python3-xyz, where xyz is the package you are trying to
install.

If you wish to install a non-Debian-packaged Python package,
create a virtual environment using python3 -m venv path/to/venv.
Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
sure you have python3-full installed.

If you wish to install a non-Debian packaged Python application,
it may be easiest to use pipx install xyz, which will manage a
virtual environment for you. Make sure you have pipx installed.

See /usr/share/doc/python3.12/README.venv for more information.

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.
Installing virtualenv
Traceback (most recent call last):
File "/home/jrm/esp/v4.4.8/esp-idf/tools/idf_tools.py", line 1587, in action_install_python_env
import virtualenv # noqa: F401
^^^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named 'virtualenv'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/jrm/esp/v4.4.8/esp-idf/tools/idf_tools.py", line 1996, in <module>
main(sys.argv[1:])
File "/home/jrm/esp/v4.4.8/esp-idf/tools/idf_tools.py", line 1992, in main
action_func(args)
File "/home/jrm/esp/v4.4.8/esp-idf/tools/idf_tools.py", line 1590, in action_install_python_env
subprocess.check_call([sys.executable, '-m', 'pip', 'install', '--user', 'virtualenv'],
File "/usr/lib/python3.12/subprocess.py", line 413, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/usr/bin/python3', '-m', 'pip', 'install', '--user', 'virtualenv']' returned non-zero exit status 1.
"

ahsrabrifat
Posts: 201
Joined: Sat Jan 18, 2025 2:31 pm

Re: Installation error setting up python virt environment

Postby ahsrabrifat » Thu Sep 18, 2025 8:27 am

Use --break-system-packages temporarily

Code: Select all

python3 -m pip install --user virtualenv --break-system-packages
Then re-run the ESP-IDF 4.4.8 installer. This tells pip to ignore the Debian restriction.

noweare
Posts: 96
Joined: Tue Jul 02, 2019 11:35 am

Re: Installation error setting up python virt environment

Postby noweare » Thu Sep 18, 2025 2:29 pm

I did not have virtualenv installled in my system (new install linux mint) I did not have to use the option "break-system-packages".
After installing it worked. whats strange is i was installing a second version onto my system. The first install went fine.

Thank you very much for responding.

Who is online

Users browsing this forum: Bytespider and 5 guests