Pipenv not activating in correct directory for virtual environment

743 Views Asked by At

Newbie to pipenv,

TL;DR: Trying to integrate pipenv with a project using venv from PyCharm and getting unexpected dictionary behaviour

Background: Was Using PyCharm to make virtual environments for a Python project. I was recommended to move onto pipenv so the project could be run on different machines easier. Followed procedure to install pipenv to my knowledge correctly:

pip3 install pipenv

Pipenv also seems to be working correctly when using sys.executable

/Users/swapneel/.local/share/virtualenvs/Desktop-zQLGYB_4/bin/python

Problem: When I run pipenv shell in my project directory everything is written to my desktop i.e Pipfile and Pipfile.lock. I also tried to use my requirements.txt with:

pipenv install -r requirements.text

Only to get the message:

Requirements file provided! Importing into Pipfile…
Requirements file doesn't appear to exist. Please ensure the file exists in your project directory or you provided the correct path. 

Also, this is what displays when I try activate pipenv in my desired directory:

(Desktop) bash-3.2$ 

Here is my directory path. For clarity I included undesired Pipfiles in desktop:

Desktop
|-Pipfile
|-Pipefile.lock  
|--projects/
|  |--desired project/
|  |------------------__init__.py
|  |------------------main.py
|  |------------------requirements.txt
|  |------------------modules

Any help would be greatly appreciated

EDIT: Worth mentioning I was getting this error initially

Pipenv: Command Not Found' After 'pip install pipenv

which after some research

This seemed to fix

sudo -H pip install -U pipenv
0

There are 0 best solutions below