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.