Under WSL2 running Ubuntu 20.04 I've tried to install virtualenv with pip running pip install virtualenv
but the command just hangs printing nothing.
I terminated it and ran it again with python3 -v -m pip install virtualenv
as advised here and it hangs on import 'keyring.backends.OS_X'
line:
[...]
# /usr/lib/python3/dist-packages/keyring/backends/__pycache__/_OS_X_API.cpython-38.pyc matches /usr/lib/python3/dist-packages/keyring/backends/_OS_X_API.py
# code object from '/usr/lib/python3/dist-packages/keyring/backends/__pycache__/_OS_X_API.cpython-38.pyc'
# destroy keyring.backends._OS_X_API
import 'keyring.backends.OS_X' # <_frozen_importlib_external.SourceFileLoader object at 0x7fa66c4b4610>
I've tried running python -m pip install some_package_you_want
as answered here but the same problem occurs.
Also, I've tried exporting PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring
environment variable as advised here but unfortunately it did not solve the problem either.
EDIT: The python3 -v -m pip install virtualenv
command eventually succeeded after hanging for about 5 minutes.
EDIT2: I think the problem is with the WSL2 being too slow as commented here. Eventually I've installed the virtualenv (venv) with sudo apt-get install python3-venv
and activated the virtual environment with python3 -v -m venv venv
command and the similar hang problem occurred now on the line import 'argparse' # <_frozen_importlib_external.SourceFileLoader object at 0x7ff1bc5f1c40>
hanging here for about 2 minutes. This supports the WSL2 slowness problem.