Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

pip requirements file

40 views
Skip to first unread message

Ethan Furman

unread,
Aug 4, 2017, 10:40:44 PM8/4/17
to
pip freeze

will output a list of current packages and their requirements. I have one package that falsely [1] lists another
package as a requirement, which was blocking installation as the false requirement wasn't available.

Is there a way to modify that output (which would be piped to, for example, requirements.txt) to have

pip install -r requirements.txt

so pip ignores that one (and only that one) dependency?

--
~Ethan~


[1] For the curious, the package is ZSA, and it list PyXML even though one of its modules says it was created
specifically so PyXML is no longer needed -- and none of the modules import PyXML anywhere.

Chris Angelico

unread,
Aug 4, 2017, 10:46:31 PM8/4/17
to
On Sat, Aug 5, 2017 at 12:42 PM, Ethan Furman <et...@stoneleaf.us> wrote:
> pip freeze
>
> will output a list of current packages and their requirements. I have one
> package that falsely [1] lists another package as a requirement, which was
> blocking installation as the false requirement wasn't available.
>
> Is there a way to modify that output (which would be piped to, for example,
> requirements.txt) to have
>
> pip install -r requirements.txt
>
> so pip ignores that one (and only that one) dependency?

I'd just edit the file afterwards and delete the line. But if the
package claims to need PyXML, it'll still be installed.

ChrisA

Ethan Furman

unread,
Aug 4, 2017, 10:54:41 PM8/4/17
to
On 08/04/2017 07:46 PM, Chris Angelico wrote:
> On Sat, Aug 5, 2017 at 12:42 PM, Ethan Furman wrote:

>> pip freeze
>>
>> will output a list of current packages and their requirements. I have one
>> package that falsely [1] lists another package as a requirement, which was
>> blocking installation as the false requirement wasn't available.
>>
>> Is there a way to modify that output (which would be piped to, for example,
>> requirements.txt) to have
>>
>> pip install -r requirements.txt
>>
>> so pip ignores that one (and only that one) dependency?
>
> I'd just edit the file afterwards and delete the line. But if the
> package claims to need PyXML, it'll still be installed.

Exactly my point. Is there any way, requirements.txt or otherwise, to tell pip to ignore what a certain package is
claiming it needs?

I am aware of --no-dependencies, but that (I think) is an all-or-nothing approach, whilst [1] I desire an all-except-one
approach.

--
~Ethan~


[1] I blame words like 'whilst' on my new Paperback game by Tim Fowler. The Smarter-AI uses words from Middle-English
(!) and spellings not seen for at least 300 years! But hey, my vocabulary is (uselessly) expanding!

Ndagi Stanley

unread,
Aug 5, 2017, 2:37:17 PM8/5/17
to
Yes. There is. I have been in need of this for a while until I found out. 2
steps:
- pip install pip-chill
- pip-chill

The list will only have what you directly installed and will not list
itself, which is pretty neat. The only thing you'll notice is that it's not
alphabetically arranged.
Cheers.
> --
> https://mail.python.org/mailman/listinfo/python-list
>

Ethan Furman

unread,
Aug 7, 2017, 2:13:14 PM8/7/17
to
On 08/04/2017 07:56 PM, Ethan Furman wrote:
> On 08/04/2017 07:46 PM, Chris Angelico wrote:
>> On Sat, Aug 5, 2017 at 12:42 PM, Ethan Furman wrote:
>
>>> pip freeze
>>>
>>> will output a list of current packages and their requirements. I have one
>>> package that falsely [1] lists another package as a requirement, which was
>>> blocking installation as the false requirement wasn't available.
>>>
>>> Is there a way to modify that output (which would be piped to, for example,
>>> requirements.txt) to have
>>>
>>> pip install -r requirements.txt
>>>
>>> so pip ignores that one (and only that one) dependency?
>>
>> I'd just edit the file afterwards and delete the line. But if the
>> package claims to need PyXML, it'll still be installed.
>
> Exactly my point. Is there any way, requirements.txt or otherwise, to tell pip to ignore what a certain package is
> claiming it needs?
>
> I am aware of --no-dependencies, but that (I think) is an all-or-nothing approach, whilst [1] I desire an all-except-one
> approach.

Light finally turned on. If requirements.txt has all my installed requirements, that would include any dependencies
actually needed; so I specify --no-dependencies, then dependencies not listed in the requirements.txt file will not be
installed.

--
~Ethan~

Ethan Furman

unread,
Aug 18, 2017, 6:48:38 PM8/18/17
to
On 08/07/2017 11:15 AM, Ethan Furman wrote:

> Light finally turned on. If requirements.txt has all my installed requirements, that would include any dependencies
> actually needed; so I specify --no-dependencies, then dependencies not listed in the requirements.txt file will not be
> installed.

As a follow-up: I tried it, and it worked! :) Oh, and the flag name is --no-deps .

--
~Ethan~

0 new messages