Search code examples
virtualenvpython-3.6ubuntu-22.04

Trouble Installing Python3.6 Virtual Environment on Ubuntu 22.04


Virtual environment stopped being created after upgrading to Ubuntu 22.04. Running the command virtualenv venv -p python3.6 produces an error that did not occur in the previous version - Ubuntu 20.04.:

fail
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/virtualenv/seed/embed/via_app_data/via_app_data.py", line 84, in _get
    result = get_wheel(
  File "/usr/lib/python3/dist-packages/virtualenv/seed/wheels/acquire.py", line 26, in get_wheel
    wheel = from_bundle(distribution, version, for_py_version, search_dirs, app_data, do_periodic_update, env)
  File "/usr/lib/python3/dist-packages/virtualenv/seed/wheels/bundle.py", line 13, in from_bundle
    wheel = load_embed_wheel(app_data, distribution, for_py_version, of_version)
  File "/usr/lib/python3/dist-packages/virtualenv/seed/wheels/bundle.py", line 33, in load_embed_wheel
    wheel = get_embed_wheel(distribution, for_py_version)
  File "/usr/lib/python3/dist-packages/virtualenv/seed/wheels/embed/__init__.py", line 77, in get_embed_wheel
    raise Exception((
Exception: Wheel for pip for Python 3.6 is unavailable. apt install python3-pip-whl
pip-21.3.1-py3-none-any.whl already present in /home/su/.local/share/virtualenv/wheel/3.6/embed/3/pip.json
created virtual environment CPython3.6.15.final.0-64 in 3225ms
  creator CPython3Posix(dest=/home/su/Downloads/courses-app/venv, clear=False, no_vcs_ignore=False, global=False)
  seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/home/su/.local/share/virtualenv)
    added seed packages: pip==21.3.1, setuptools==59.6.0, wheel==0.37.1
  activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator

Can anyone help solve this problem?


Solution

  • The issue was resolved after installing the following packages:

     sudo apt install software-properties-common
     sudo add-apt-repository ppa:deadsnakes/ppa
     sudo apt install python3.6
     sudo apt install libpython3.6-dev
     sudo apt install python3.6-distutils