Pipenv installed packages on environment (Pipenv file)

Question:

About the Pipfile that pipenv generates: when I run pipenv shell in a specific folder, the virtual environment works just fine, and everything I install in there works fine as well, but the Pipfile doesn’t seem to be updating with the packages I’m installing. When I check the dependency tree with pipenv graph, it shows all the dependencies I’ve been using. Is there something I’m missing with how pipenv works?

Note:

Whenever I want to create a new env i follow these steps:

mkdir app
cd app
pipenv shell
pip install <somepackage>
touch main.py # (add my code)
python main.py
Asked By: crisleo94

||

Answers:

You have to install packages using the command pipenv install [package] in order for pipenv to create/update the Pipfile and Pipfile.lock files.

As you already installed the dependencies with pip, you can run pipenv run pip freeze > requirements.txt && pipenv install -r requirements.txt and it will create or update the aforementioned files for you. It is best, though, that you declare each package you want because this method also writes each package dependencies on these files.

Read more here

Answered By: Maicon Mauricio
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.