Pipenv: Pipenv fails to create virtualenv

Created on 30 Apr 2020  Â·  2Comments  Â·  Source: pypa/pipenv

I have windows 7, and have installed pipenv by pip install pipenv. When I try to create a virtualenv by running pipenv shell, the following error shows up:

Creating a virtualenv for this project…
Pipfile: E:\full-stack projects\newschoolazure\Pipfile
Using c:\users\user\appdata\local\programs\python\python37-32\python.exe (3.7.4) to create virtualenv…
[==  ] Creating virtual environment...Already using interpreter c:\users\user\appdata\local\programs\python\python37-32\python.exe
Using base prefix 'c:\\users\\user\\appdata\\local\\programs\\python\\python37-32'
New python executable in C:\Users\User\.virtualenvs\newschoolazure-9I-v4-rZ\Scripts\python.exe
ERROR: The executable C:\Users\User\.virtualenvs\newschoolazure-9I-v4-rZ\Scripts\python.exe is not functioning
ERROR: It thinks sys.prefix is 'e:\\full-stack projects\\newschoolazure' (should be 'c:\\users\\user\\.virtualenvs\\newschoolazure-9i-v4-rz')
ERROR: virtualenv is not compatible with this system or executable
Note: some Windows users have reported this error when they installed Python for "Only this user" or have multiple versions of Python installed. Copying the appropriate PythonXX.dll to the virtualenv Scripts/ directory may fix this problem.

Failed creating virtual environment
[pipenv.exceptions.VirtualenvCreationException]:   File "c:\users\user\appdata\local\programs\python\python37-32\lib\site-packages\pipenv\cli\command.py", line 390, in shell
[pipenv.exceptions.VirtualenvCreationException]:       pypi_mirror=state.pypi_mirror,
[pipenv.exceptions.VirtualenvCreationException]:   File "c:\users\user\appdata\local\programs\python\python37-32\lib\site-packages\pipenv\core.py", line 2156, in do_shell
[pipenv.exceptions.VirtualenvCreationException]:       three=three, python=python, validate=False, pypi_mirror=pypi_mirror,
[pipenv.exceptions.VirtualenvCreationException]:   File "c:\users\user\appdata\local\programs\python\python37-32\lib\site-packages\pipenv\core.py", line 574, in ensure_project
[pipenv.exceptions.VirtualenvCreationException]:       pypi_mirror=pypi_mirror,
[pipenv.exceptions.VirtualenvCreationException]:   File "c:\users\user\appdata\local\programs\python\python37-32\lib\site-packages\pipenv\core.py", line 506, in ensure_virtualenv
[pipenv.exceptions.VirtualenvCreationException]:       python=python, site_packages=site_packages, pypi_mirror=pypi_mirror
[pipenv.exceptions.VirtualenvCreationException]:   File "c:\users\user\appdata\local\programs\python\python37-32\lib\site-packages\pipenv\core.py", line 935, in do_create_virtualenv
[pipenv.exceptions.VirtualenvCreationException]:       extra=[crayons.blue("{0}".format(c.err)),]
[pipenv.exceptions.VirtualenvCreationException]: Fatal Python error: initfsencoding: unable to load the file system codec
LookupError: no codec search functions registered: can't find encoding

Current thread 0x000008a8 (most recent call first):

What should I do?
ps.Im a noob

triage

Most helpful comment

I think at this stage with a new version of pipenv coming out I think your best bet is to install the latest alpha version by runningpip install --upgrade --pre pipenv. This will install an unreleased version, but it has many bug fixes and improvements so you may fair better.

All 2 comments

I think at this stage with a new version of pipenv coming out I think your best bet is to install the latest alpha version by runningpip install --upgrade --pre pipenv. This will install an unreleased version, but it has many bug fixes and improvements so you may fair better.

Using base prefix 'c:\\users\\user\\appdata\\local\\programs\\python\\python37-32' - at a glance it seems like your python installation might be broken, which I've seen happen a few times when installing the -32 version of python on 64-bit windows.

I am not sure how to fix this problem since it isn't really pipenv related (at least I don't think it is) -- usually I have resolved it by installing the 64 bit version of python which you can find at this link

In the meantime I am going to close this issue -- good luck!

Was this page helpful?
0 / 5 - 0 ratings