Forums

Can't create a new virtual environment

I'm trying to deploy a django app on pythonanywhere, however when I try to create a virtualenv using mkvirtualenv --python=/usr/bin/python3.8 my-site-virtualenv however I get this error The path /usr/bin/python3.8 (from --python=/usr/bin/python3.8) does not exist. Kindly help fix this as python 3.8 is the minimum supported version for Django 4.0

You need to have your system image changed to newer -- you can change it yourself from the "Account" page. There's more information on this help page: https://help.pythonanywhere.com/pages/ChangingSystemImage.

Thanks, have been able to resolve the issue and created the virtualenv. :)

Glad to hear that you made it work!

Hi fjl. "Warning: No virtualenv detected at this path. Do you need to create it?"

I used pipenv to set up my virtual environment, but got this error message while trying to get the system to detect my virtual environment path.

How do I resolve this please?

Don't bother, i just figured. Pipenv hyphen-appends extra characters to the environment's path.

Glad to hear that you found it!

.

mkvirtualenv myvirtualenv --python=/usr/bin/python3.10
RuntimeError: failed to build image pip because:
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/virtualenv/seed/embed/via_app_data/via_app_data.py", line 57, in _install
    installer.install(creator.interpreter.version_info)
  File "/usr/local/lib/python3.10/site-packages/virtualenv/seed/embed/via_app_data/pip_install/base.py", line 35, in install
    self._uninstall_previous_version()
  File "/usr/local/lib/python3.10/site-packages/virtualenv/seed/embed/via_app_data/pip_install/base.py", line 151, in _uninstall_previous_version
    dist_name = self._dist_info.stem.split("-")[0]
  File "/usr/local/lib/python3.10/site-packages/virtualenv/seed/embed/via_app_data/pip_install/base.py", line 115, in _dist_info
    raise RuntimeError(msg)  # pragma: no cover
RuntimeError: no .dist-info at /home/imghost/.local/share/virtualenv/wheel/3.10/image/1/CopyPipInstall/pip-22.1.2-py3-none-any, has pip

can anyone help me with this?

[edit by admin for formatting]

Could try to reinstall virtualenv? It might have gotten into a weird state - https://virtualenv.pypa.io/en/latest/installation.html

This can also be due to an improperly initialized /wheel directory, allegedly by virtualenv or pipenv, as I've documented in https://jdsalaro.com/howto/fix-pipenv-runtimeerror-no-dist-info-has-pip

It suffices to remove the wheel directory /home/imghost/.local/share/virtualenv/wheel/3.10/ and letting virtualenv or pipenv re-create it during the preparation of a new virtual environment.

Hello, After I change my system image to the latest one : haggis, I tried to create a new virtual environement using : mkvirtualenv --python=python3.8 new_env_name . However this does not work. I get this error:

"path /usr/bin/python3.8 (from --python=/usr/bin/python3.8) does not exist"

I checked uname -a : Linux green-liveconsole7 5.15.0-1044-aws #49~20.04.1-Ubuntu SMP Mon Aug 21 17:09:32 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

I also checked /usr/bin/ -- and it does not have python3.8. So am I missing something on the system image upgrade? Note : My existing webapp has stopped working and it looks I need to rebuild the virtual env. I was using python3.6, but not I want to utilize this opportunity to use 3.8.

Thanks to clarify what is happening?

Try starting a new console and then try that mkvirtualenv.