Support for `pipx install -r requirements.txt`

See original GitHub issue

Refinement from #357

Without digressing into defining “metapackages” having support for installing single environments from requirements.txt files would be very useful. For example, if we want to install a package that can allow for plugins at runtime (e.g. cookiecutter) we might want to additionally specify some plugin packages to install alongside it and we would write a requirements.txt file like so:

cookiecutter
jinja2_time

As discussed in #357 there is an issue with conflicting with previously installed packages. To solve this problem I propose some non-destructive default behavior and a way to override this in the CLI.

By default if you tried to install that file with pipx install -r requirements.txt pipx would try to install entry points for the first package in the list that defines them. If that package (in this example cookiecutter) already has entry points installed then it would fail by default:

> pipx install cookiecutter
> pipx install -r requirements.txt
'cookiecutter' is already installed, aborting installation.
Use the '--force' or '-f' command to force installation and replace current one.

If you want to override it you can pass the force option:

pipx install -f -r requirements.txt

Or you can specify an alias:

pipx install -r requirements.txt -a cookiecutter_ext

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
cs01commented, Feb 7, 2020

Thanks for your feedback. We can get pretty close to this behavior with existing APIs. What do you think of

pipx install cookiecutter
pipx runpip cookicutter install -r requirements.txt
1reaction
funkyfuturecommented, Mar 2, 2020

or what about pipx inject <package> -r <requirements-file>?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Support for `pipx install -r requirements.txt` · Issue #359 - GitHub
While pipx inject <package> -r <requirements-file> suggests installing all the dependencies to a package. This would be the equivalent to pipx runpip <package> ......
Read more >
Docs - pipx
Runs `pip install -U <pkgname>` for each package. uninstall Uninstall a package uninstall-all Uninstall all packages reinstall Reinstall a package ...
Read more >
Improving Python Dependency Management With pipx and ...
Either do pip install bar or pip install -r requirements.txt. While focused on development, I would often forget one or both of these...
Read more >
pip-tools doesn't install dependencies to activated virtualenv
txt) using pip-tools. I have installed pip-tools using pipx as I want it to be globally available but isolated. However, doing so causes...
Read more >
"pip install requirements.txt" command returns many errors ...
You are missing -r command flag, so go again with: pip install -r requirements.txt. As it was before, pip just try to get...
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