0

I have a problem with mkvirtualenv. When I try mkvirtualenv py39 --python=/usr/bin/python3.9 I get File "/usr/lib/python3/dist-packages/virtualenv.py", line 25, in import distutils.sysconfig ModuleNotFoundError: No module named 'distutils.sysconfig' . Thanks

1
  • 1
    Python 3.6 (not 3.9) came with your install of Ubuntu 18.04. Using the wrong version of Python3 for system operations on an 18.04 system will break lots of things. You have encountered one symptom. Go back to 3.6. – user535733 Dec 7 '20 at 14:35
0

The one concern I have is that you appear to be running a version of python newer than what is shipped which could be causing the issues, but for a stock install the following steps should get it working for you.

Make sure you have installed the virtual tools

sudo apt install virtualenv virtualenvwrapper

Source the wrapper script

source '/usr/share/virtualenvwrapper/virtualenvwrapper.sh'

mkvirtualenv should work now.

3
  • Thank you very much for your rapid response James. Unfortunately, the install reports that 'virtualenvwrapper is already the newest version (4.3.1-2).' and sourcing it has no effect on the error message that mkvirtualenv reports. I have tried making a virtual environment for python3.9 with conda and this works, but some of the packages I need to install don't seem to have been updated yet and they won't install with conda – Tony Holdroyd Dec 7 '20 at 20:12
  • It seems that you are using Python Anaconda using Python 3.9. According to this post not all of the packages are updated yet which might be causing the issue. The other thing I can think of is that you are using mkvirtualenv which is installed as part of the virtualenvwrapper tools, but they are independent of the Anaconda tools. Instead you should use conda create -n envname python=x.x anaconda so that you are using the matching tooling. – James King Dec 8 '20 at 0:27
  • Thanks James, I've had to go back to Pythgon3.8 for the time being with PyCHarm – Tony Holdroyd Dec 8 '20 at 15:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.