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 from stdin

See original GitHub issue

I see that an existing ticket has been rejected: #3880 . I’m requesting that the team reconsider.

The main use case I have for this feature is to build an environment using a set of requirements specified in a URL or coming from a specific git commit:

% curl https://foo.com/requirements.txt | pip install -r -
% git show deadbeef:requirements.txt | pip install -r -

There are workarounds, e.g. to leverage some shell feature for running a subprocess (e.g. pip install -r <(curl https://foo.com/requirements.txt) or similar) or download the file in advance to some temporary location, but these are more esoteric, shell-dependent, or require extra cleanup steps. I believe the cleanest solution for the user is simply to behave like a standard command-line tool and use stdin/stdout in the normal ways.

In the spirit of conforming even better to standard POSIX style, I’d further recommend that the - be unnecessary, e.g. if no file argument is given for -r that input be taken from stdin, just like other input-consuming tools like cat, cut, less, python etc. do:

% curl https://foo.com/requirements.txt | pip install -r
% git show deadbeef:requirements.txt | pip install -r

Thanks for considering.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:11
  • Comments:16 (8 by maintainers)

github_iconTop GitHub Comments

6reactions
sbidoulcommented, Apr 15, 2020

An alternative that works today (example with bash):

pip install $(curl https://foo.com/requirements.txt)
3reactions
andreashecommented, Nov 9, 2021

Have another solution using xargs (filters all packages with letter “a”):

cat requirements.txt | grep 'a' | xargs pip install

Read more comments on GitHub >

github_iconTop Results From Across the Web

Pip install argument from unix pipe - python - Stack Overflow
The pipe connects the standard output of ls to the standard input of pip , but pip doesn't read its standard input for...
Read more >
stdin · PyPI
Installation. $ [sudo] pip install stdin. Examples. $ printf "stdin text" | python -c "import stdin;print(stdin.size())" 10 $ echo "stdin text" | python...
Read more >
pip install - pip documentation v22.3.1
Install to the Python user install directory for your platform. Typically ~/.local/, or %APPDATA%Python on Windows. (See the Python documentation for site.
Read more >
Installing Packages - Python Packaging User Guide - Python.org
Installing Packages¶ · Ensure you can run Python from the command line · Ensure you can run pip from the command line ·...
Read more >
Python pip install at CMD - File "stdin", line 1 syntax error
pipInstall Learn how install new module in python using " pip install "If you enouter error: File " stdin ", line " or...
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