Pipenv won't create environment

Hello. I’ve been working my way through the Python3 course. I’m currently attemping to work with pip and pipenv. I was able to successfully install it.
I run Windows 10, and (would like) to use VS Code for my IDE.

When I attempt to run pipenv --three, i get this error:

Using C:/Python/python.exe (None) to create virtualenv…
[ =] Creating virtual environment…FileNotFoundError: [WinError 3] The system cannot find the path specified: ‘C:/Python/python.exe’

Failed creating virtual environment

[pipenv.exceptions.VirtualenvCreationException]:
Failed to create virtual environment.

From what I can tell, it’s looking for it in the wrong place. A place that doesn’t exist? I’m happy to provide any other information needed. Thanks in advance.

For windows user
STEP 1

pip install virtualenv

STEP 2

virtualenv env

go to that dir like this

cd env

STEP 3
and finally activate your virtual env

source Scripts/activate

Hi @amingley,

First, is C:/Python/python.exe valid? The reason I’m asking is that the error is complaining:


Using C:/Python/python.exe (None) to create virtualenv…

It says (None)
Seems to imply that doesn’t exist? :thinking:
Then, it continues to complain with details, pointing to the same issue:


FileNotFoundError: [WinError 3] The system cannot find the path specified: ‘C:/Python/python.exe’

Hence, suggest to check your Python installed location and make sure your system PATH is updated!

When I attempt to create the pipenv with the saem name label as you did, it went successful and notice it picks up python.exe from where I’ve installed:

C:\Users\DELL\PycharmProjects\project1>pipenv --three
Creating a virtualenv for this project...
Pipfile: C:\Users\DELL\PycharmProjects\project1\Pipfile
Using C:/Users/DELL/AppData/Local/Programs/Python/Python39/python.exe (3.9.1) to create virtualenv...
[  ==] Creating virtual environment...created virtual environment CPython3.9.1.final.0-64 in 1644ms
  creator CPython3Windows(dest=C:\Users\DELL\.virtualenvs\project1-bUN3Jr02, clear=False, no_vcs_ignore=False, global=False)
  seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=C:\Users\DELL\AppData\Local\pypa\virtualenv)
    added seed packages: pip==21.0.1, setuptools==54.1.2, wheel==0.36.2
  activators BashActivator,BatchActivator,FishActivator,PowerShellActivator,PythonActivator,XonshActivator

Successfully created virtual environment!
Virtualenv location: C:\Users\DELL\.virtualenvs\project1-bUN3Jr02
Creating a Pipfile for this project...
1 Like

I did everything up to STEP 3, but when I use that last command, it tells me that ‘source’ is not an option. I’m not super familiar with the command prompt.

Thank you for your time!

The C:/Python/python.exe does not exist. Which is the problem. I’m not sure how to go about fixing this issue. When I installed Python, I put it above the user folder (directly into C:). But pipenv was installed under user.

I’m not really sure how to go about solving this issue, short of uninstalling everything and starting over.

Chances are there’s something a little funny with your PATH setup but there are quite a few possibilities here which might make it very difficult to diagnose. If you have the time it might be worth looking into shell environment variables, specifically PATH and how it lets you run binaries by name only (instead of by their full filepath). Long term that’ll help no end so you’re not running by trial and error.

Can you find the correct path for your Python install? I’m assuming it is not located at C:/Python/python.exe ? Was it perhaps installed in one location and then you moved the files? If it’s a similar but not identical path then you might want to look into altering your PATH environment variable in windows.

You can specify a version of Python for pipenv by using the filepath to the Python binary. The syntax looks like- pipenv --python path/to/python. In your case it would be more like pipenv --python C:\path\to\python.exe but you would need to find the correct path for this. Worth a try.

Might be a pain to do this every time (even if works) so hunting down the cause of your original error is also useful.

I managed to sort it out. I had renamed the Python folder at some point. I wasn’t sure how to repath either pip or Anaconda (which was pathed to the current Python folder).

My round about solution was the uninstall Anaconda. Rename the Python folder to the same as pip, and reinstall Anaconda with the respective path.

It all worked out in the end! Thanks for all your help. :slight_smile: