Search code examples
pythonvirtualenvpipenv

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?


Solution

  • 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.