Installation error setting up python virt environment
Posted: 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.
"
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.
"