Problem:
While trying to run Python tests using tox
, you see an error message like
GLOB sdist-make: /home/uli/dev/UliEngineering/setup.py py37 create: /home/uli/dev/UliEngineering/.tox/py37 ERROR: InterpreterNotFound: python3.7 py38 create: /home/uli/dev/UliEngineering/.tox/py38 ERROR: invocation failed (exit code 1), logfile: /home/uli/dev/UliEngineering/.tox/py38/log/py38-0.log ========================================================================================= log start ========================================================================================= AttributeError: module 'virtualenv.create.via_global_ref.builtin.cpython.mac_os' has no attribute 'CPython2macOsArmFramework' ========================================================================================== log end ========================================================================================== ERROR: InvocationError for command /usr/bin/python3 -m virtualenv --no-download --python /usr/bin/python3 py38 (exited with code 1) __________________________________________________________________________________________ summary __________________________________________________________________________________________ ERROR: py37: InterpreterNotFound: python3.7 ERROR: py38: InvocationError for command /usr/bin/python3 -m virtualenv --no-download --python /usr/bin/python3 py38 (exited with code 1)
Solution:
This error occurs because two different and incompatible version of virtualenv
are installed.
First, uninstall all versions using these commands:
First run as user (not as root) to uninstall any locally installed package in ~/.local
:
pip3 uninstall virtualenv
Then, uninstall global packages
sudo pip3 uninstall virtualenv
Now uninstall the apt
package on Debian/Ubuntu (uninstall using your package manager for other distros):
sudo apt purge python3-virtualenv
Now it’s time to install one version of virtualenv
:
sudo pip3 install virtualenv
After that, you can try running tox
again.