How to suppress PEP440Warning from setup.py?

I run python setup.py or python3 setup.py which gives me PEP440Warning for unrelated packages that I am not going to fix:

 /usr/lib/python3/dist-packages/pkg_resources/__init__.py:2512: PEP440Warning: 'python-apt (0.9.3.11build1)' is being parsed as a legacy, non PEP 440, version. You may find odd behavior and sort order. In particular it will be sorted as less than 0.0. It is recommend to migrate to PEP 440 compatible versions. PEP440Warning, /usr/lib/python3/dist-packages/pkg_resources/__init__.py:2512: PEP440Warning: 'apturl (0.5.2ubuntu6)' is being parsed as a legacy, non PEP 440, version. You may find odd behavior and sort order. In particular it will be sorted as less than 0.0. It is recommend to migrate to PEP 440 compatible versions. PEP440Warning, /usr/lib/python3/dist-packages/pkg_resources/__init__.py:2512: PEP440Warning: 'ufw (0.34-rc-0ubuntu5)' is being parsed as a legacy, non PEP 440, version. You may find odd behavior and sort order. In particular it will be sorted as less than 0.0. It is recommend to migrate to PEP 440 compatible versions. PEP440Warning, 

I would like to disable this warning, and without much effort I tried several options -W :

  • compliance module: -W ignore:::pkg_resources: → warnings there, no message about invalid specification -W
  • match class name: -W ignore::PEP440Warning::Invalid -W option ignored: unknown warning category: 'PEP440Warning'
  • corresponds to a fully qualified class name: -W ignore::pkg_resources.PEP440Warning::Invalid -W option ignored: invalid module name: 'pkg_resources' (??)
  • matches message test: -W ignore:PEP 440::: → warning there, no message about invalid specification -W
  • matches all warnings: -W ignore warnings there

The last attempt leads me to believe that for some reason command line switching is not performed at all. Why?

+7
python warnings setuptools
source share

No one has answered this question yet.

See related questions:

5116
How to check if a file exists without exceptions?
4268
How to combine two dictionaries in one expression?
3790
How can I safely create a subdirectory?
3474
How to list all the catalog files?
3428
How to sort a dictionary by value?
3235
How to check if a list is empty?
2621
How to create a chain of function decorators?
778
What is setup.py?
731
Uninstall python setup.py
eleven
failed in "sudo pip"

All Articles