Support for `pipx install -r requirements.txt`
See original GitHub issueRefinement 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:
- Created 4 years ago
- Comments:8 (1 by maintainers)
Top Related StackOverflow Question
Thanks for your feedback. We can get pretty close to this behavior with existing APIs. What do you think of
or what about
pipx inject <package> -r <requirements-file>?