The problem originates when I start by cloning a git project that uses pipenv, so it has a Pipfile + Pipfile.lock. I want to use a virtual environment with the project so I run pipenv shell
. I now have a virtual environment created and I am inside the virtual environment. The project obviously has a lot of dependencies (listed in the Pipfile). I don't want to have to go through the list in the Pipfile one by one and install them using pipenv install <package_name>
. Is there a pipenv/pip command that installs all the packages from a Pipfile I already have? Or maybe I need to set up the environment differently than running pipenv shell
?

- 1,107
- 1
- 11
- 20
6 Answers
The proper answer to this question is that pipenv install
or pipenv install --dev
(if there are dev dependencies) should be ran. That will install all the dependencies in the Pipfile. Putting the dependencies into a requirements.txt and then using pip will work but is not really necessary. The whole point of using pipenv for most people is to avoid the need to manage a requirements.txt or to use pip.
EDIT: if the virtualenv is already activated, you can also use pipenv sync
or pipenv sync --dev
for the same effect.

- 9,872
- 7
- 57
- 95

- 1,971
- 1
- 15
- 19
-
Hi I know this is old, but I have a pipenv virtual environment working well on one computer. I want to recreate that virual environment on another computer. So how do I go about doing this? Your answer is lacking a lot of detail. Previously I would just have a requirements.txt and just copy it over to the new virtual environment I want to setup on another computer. So which file do I copy over now? Do I copy over the Pipfile and Pipfile.lock ? – ChumbiChubaGo Jul 31 '20 at 18:11
-
@ChumbiChubaGo You should be able to copy the Pipfile and Pipfile.lock, and `pipenv install` within the directory on the other computer. In the future, though, you should probably start a new question instead of bumping an old one. – etnguyen03 Dec 13 '20 at 20:24
-
`pipenv sync` worked best for me – wisenickel May 23 '22 at 14:32
Ideally, you are encouraged to have a requirements.txt
file which contains all the packages required for installation via pip. You can create this file by doing:
pip freeze > requirements.txt
You can convert a Pipfile and Pipfile.lock into a requirements.txt. Take a look into this
pipenv lock -r > requirements.txt
After that, you can install all your modules in your python virtual environment by doing the following:
pip install -r requirements.txt
Hopefully, I anwered your question.

- 3,273
- 2
- 17
- 16

- 602
- 4
- 10
-
1@CalebSyring Also make sure to update the `requirements.txt` file by `pip freeze` file when you update/add new packages. – Soumithri Chilakamarri Sep 04 '18 at 18:10
-
1Okay, maybe this will reveal something wrong I'm doing, but pip freeze won't return anything. (I thought is was initially, but it was just some of the packages I had installed one by one before I asked this question) Have any ideas now that you know pip freeze doesn't return anything? – Caleb Syring Sep 04 '18 at 18:10
-
Can you check if a `requirements.txt` file is created in your working directory? – Soumithri Chilakamarri Sep 04 '18 at 18:16
-
There is no requirements.txt in the working directory now. I am ABLE to create one by running your code, if that's what you are asking. – Caleb Syring Sep 04 '18 at 18:18
-
-
Note that to install into the system's packages, you now do: `pipenv install --system`. This is current as of July 2023. – Craig S. Anderson Jul 05 '23 at 22:14
I had a similar issue. For me, I exited the virtualenv and ran
pipenv --three sync
and it worked.
From what I can understand the idea is to create a new virtual environment using python 3 in my case. If you're using python 2 the above command would be edited to read
pipenv --two
The sync command copies all dependencies from the Pipfile.lock over to the new virtualenv.

- 136
- 3
- 8
use pipenv sync in file Pipfiel
this code refrsh lib in file type .lock
pipenv sync
use this run virtualenv Pipfile
pipenv shell

- 59
- 6
if you are trying to install the dependencies from pipfile using pipenv then its simple, first start or create new virtual environment by running this in your project directory
pipenv shell
then to install dependencies from pipfiles run this in the directory where your pipfile is located
pipenv install

- 31
- 6