`pip install` to automatically create virtualenv and install from requirements.txt
See original GitHub issueDon’t know if this was asked somewhere already, but wouldn’t it be nice if doing a simple
pip install
would automatically install from ./requirements.txt and in case the command was refused due to missing sudo
privileges (i.e. attempting to install into the system Python site-packages) automatically creates a venv in the current directory (now that we have python -m venv
in Python 3) and installs the packages in there. For beginners, this would literally allow installing just the Python 3 interpreter, getting the source code of an application and then installing the dependencies in one command, without having to know any virtualenv stuff in their first encounter with Python.
Having been involved in several beginner Python workshop events as a coach, I think something like this would be a pretty neat feature.
Similar behaviour that is available as npm install
for Node apps seems pretty handy to me, when I just fetch some app source and have it ready for launching after issuing a single command.
What do you think?
Issue Analytics
- State:
- Created 9 years ago
- Reactions:7
- Comments:14 (5 by maintainers)
Top GitHub Comments
It sounds a bit too magical to me and trying to guess what the user intended. Maybe the user didn’t want a virtualenv – or if they did, for what version of Python and what would it be called?
pip install --user
andpip install --require-virtualenv
might be interesting for this use case.And it was just discussed that we want to allow
sudo pip install
– see https://github.com/pypa/pip/pull/2403This is something that the pipfile format is intended to bring: https://github.com/pypa/pipfile.