Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert virtualenv instance/`requirements.txt` to pipenv

I've got a lot of projects using the virtualenv and requirements.txt or ./requirements/ pattern, but now using pipenv is obviously many times superior.

It seems to be easy to generate requirements.txt from pipenv, but going the other way seems more confusing.

There doesn't seem to be an obvious way to "convert" existing projects to pipenv.

I'm writing a script to execute pipenv on everything in a large requirements.txt but this can't be right -- is there a way to apply an existing requirements.txt to a pipenv?

like image 991
Williams Avatar asked Apr 28 '18 23:04

Williams


People also ask

Should I use virtualenv or pipenv?

How to Create Virtual Environments. If you are working with your personal projects and not installing pipenv, I recommend installing pyenv-virtualenv. If you are working in a team or with more than one system, I recommend you to install pipenv which I am covering next.

Is pipenv recommended?

While pip can install Python packages, Pipenv is recommended as it's a higher-level tool that simplifies dependency management for common use cases.


1 Answers

OK, I figured out to answer my own question and think there's potential for an "official"/detailed way of doing this:

$ pipenv shell
(env) $ pip install -r requirements

Also this exists now: https://pipenv.kennethreitz.org/en/latest/basics/#importing-from-requirements-txt

$ pipenv install -r path/to/requirements.txt

Really I'd just misunderstood the levels of abstraction of pipenv.

like image 102
Williams Avatar answered Oct 19 '22 22:10

Williams