question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`pip install` to automatically create virtualenv and install from requirements.txt

See original GitHub issue

Don’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:closed
  • Created 9 years ago
  • Reactions:7
  • Comments:14 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
msabramocommented, Mar 7, 2015

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 and pip 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/2403

1reaction
pradyunsgcommented, Jul 5, 2018

This is something that the pipfile format is intended to bring: https://github.com/pypa/pipfile.

Read more comments on GitHub >

github_iconTop Results From Across the Web

python - Creating a virtualenv with preinstalled packages as in ...
Typically the steps you always takes are: git clone <repo>; cd <repo>; pip install virtualenv (if you don't already have virtualenv installed); virtualenv...
Read more >
Setting Up Your Python Environment With Venv ... - Frank's Blog
We can run pip install -r requirements.txt to have pip automatically install all dependencies listed in the requirements.txt file. Using Virtual ...
Read more >
Installing packages using pip and virtual environments
This guide discusses how to install packages using pip and a virtual environment manager: either venv for Python 3 or virtualenv for Python...
Read more >
Manage Virtual Environments Using Requirements Files
In each virtual environment we installed one or two Python packages. ... Create the requirements.txt automatically using pip.
Read more >
PIP Install Virtualenv - ActiveState
You need to have Python 3 (not Python 2, which is officially unsupported by python.org) already installed before you can create a virtual...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found