skip to Main Content

I’m running Ubuntu 20.04 and I want to start a project using Python 3.10. I used an install guide for Python 3.10 (this one), installed it using the deadsnakes PPA, and that was fine:

$ python3.10
Python 3.10.5 (main, Jun 11 2022, 16:53:24) [GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 

I even switched my default python to 3.10 for good measure, using this, and that also works.

$ python
Python 3.10.5 (main, Jun 11 2022, 16:53:24) [GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 

Yet I cannot build a virtual environment:

$ virtualenv myenv -p python3.10         
RuntimeError: failed to find interpreter for Builtin discover of python_spec='python3.10'

And if I try to rely on the default, it gives me python3.8. I had been using python3.8 before alright, but I don’t know where that setting is coming from. Pyenv is installed, I don’t know if that’s interfering nor not.

$ virtualenv myenv                                                                                                
created virtual environment CPython3.8.10.final.0-64 in 110ms
  creator CPython3Posix(dest=/home/jokea/FlorA/fl-scraper/myenv, clear=False, global=False)
  seeder FromAppData(download=False, pip=latest, setuptools=latest, wheel=latest, pkg_resources=latest, via=copy, app_data_dir=/home/jokea/.local/share/virtualenv/seed-app-data/v1.0.1.debian.1)
  activators BashActivator,CShellActivator,FishActivator,PowerShellActivator,PythonActivator,XonshActivator

I just want to make a virtualenv with Python3.10. What could I be missing?

2

Answers


  1. You may try to enter a full path to your python3.10 when creating virtualenv, ex:

    virtualenv --python=/usr/bin/python3.10 venv
    
    Login or Signup to reply.
  2. I was running into the same issue with a fresh python3.7 install. I managed to fix it by installing distutils.

    sudo apt-get install python3.7-distutils 
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search