Skip to content

python3 -mpip list --format=freeze giving unclear errors. #13341

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
1 task done
chowdri opened this issue Apr 19, 2025 · 5 comments · May be fixed by #13345
Open
1 task done

python3 -mpip list --format=freeze giving unclear errors. #13341

chowdri opened this issue Apr 19, 2025 · 5 comments · May be fixed by #13345
Labels
C: list/show 'pip list' or 'pip show' kind: crash For situations where pip crashes type: bug A confirmed bug or unintended behavior

Comments

@chowdri
Copy link

chowdri commented Apr 19, 2025

Description

pytorch/pytorch#147669 (comment)

in the issue above, I'm informed that the issue with the pytorch module is caused by pip. However, the issue with pip is not clarified. Please let me know if this is an issue with pip or not.

Expected behavior

python3 -mpip list --format=freeze should not throw any errors.

pip version

25.0.1

Python version

3.10.12

OS

elementary OS 7.1 (ubuntu 22.04)

How to Reproduce

$ python3 -mpip list --format=freeze

Output

absl-py==2.1.0
aiofiles==0.8.0
amdsmi==25.1.0+8dc45db
anyio==3.5.0
argcomplete==1.8.1
asgiref==3.5.0
astunparse==1.6.3
Babel==2.8.0
blinker==1.4
Brlapi==0.8.3
certifi==2020.6.20
chardet==4.0.0
click==8.0.3
colorama==0.4.4
coloredlogs==15.0.1
colorlog==6.9.0
colour==0.1.5
command-not-found==0.3
contourpy==1.3.1
coolercontrol-liqctld==2.1.0
crcmod==1.7
cryptography==3.4.8
cycler==0.12.1
daemonize==2.5.0
dbus-python==1.2.18
defer==1.0.6
distro==1.7.0
distro-info==1.1+ubuntu0.2
docopt==0.6.2
fastapi==0.63.0
filelock==3.17.0
flatbuffers==25.2.10
fonttools==4.56.0
fsspec==2025.2.0
gast==0.6.0
google-pasta==0.2.0
grpcio==1.70.0
h11==0.13.0
h5py==3.13.0
hidapi==0.9.0.post3
httplib2==0.20.2
humanfriendly==10.0
idna==3.3
importlib-metadata==4.6.4
itsdangerous==2.1.0
jeepney==0.7.1
Jinja2==3.1.5
keras==3.8.0
keyring==23.5.0
kiwisolver==1.4.8
language-selector==0.1
launchpadlib==1.10.16
lazr.restfulclient==0.14.4
lazr.uri==1.0.6
libclang==18.1.1
liquidctl==1.14.0
louis==3.20.0
Markdown==3.7
markdown-it-py==3.0.0
MarkupSafe==3.0.2
matplotlib==3.10.1
mdurl==0.1.2
ml-dtypes==0.4.1
more-itertools==8.10.0
mpmath==1.3.0
namex==0.0.8
netifaces==0.11.0
networkx==3.4.2
numpy==1.26.4
oauthlib==3.2.0
onboard==1.4.1
onnxruntime-rocm==1.19.0
opt_einsum==3.4.0
optree==0.14.0
packaging==24.2
pandas==2.2.3
pillow==11.1.0
pip==25.0.1
protobuf==4.25.6
pycairo==1.20.1
pydantic==1.8.2
Pygments==2.19.1
PyGObject==3.42.1
PyJWT==2.3.0
pyparsing==2.4.7
PyQt5==5.15.6
PyQt5-sip==12.9.1
PyQtWebEngine==5.15.5
ERROR: Exception:
Traceback (most recent call last):
  File "/home/praful/.local/lib/python3.10/site-packages/pip/_internal/cli/base_command.py", line 106, in _run_wrapper
    status = _inner_run()
  File "/home/praful/.local/lib/python3.10/site-packages/pip/_internal/cli/base_command.py", line 97, in _inner_run
    return self.run(options, args)
  File "/home/praful/.local/lib/python3.10/site-packages/pip/_internal/commands/list.py", line 202, in run
    self.output_package_listing(packages, options)
  File "/home/praful/.local/lib/python3.10/site-packages/pip/_internal/commands/list.py", line 292, in output_package_listing
    write_output("%s==%s", dist.raw_name, dist.version)
  File "/home/praful/.local/lib/python3.10/site-packages/pip/_internal/metadata/pkg_resources.py", line 192, in version
    return parse_version(self._dist.version)
  File "/home/praful/.local/lib/python3.10/site-packages/pip/_vendor/packaging/version.py", line 56, in parse
    return Version(version)
  File "/home/praful/.local/lib/python3.10/site-packages/pip/_vendor/packaging/version.py", line 202, in __init__
    raise InvalidVersion(f"Invalid version: {version!r}")
pip._vendor.packaging.version.InvalidVersion: Invalid version: '2.4.0-elementary9-ubuntu7.1'

Code of Conduct

@chowdri chowdri added S: needs triage Issues/PRs that need to be triaged type: bug A confirmed bug or unintended behavior labels Apr 19, 2025
@ichard26
Copy link
Member

You have a package with malformed metadata installed. Rerun pip with --debug and look for the package name that's causing the error and run pip uninstall on that.

Although we should probably handle this more gracefully.

@chowdri
Copy link
Author

chowdri commented Apr 20, 2025

looking at the error dump above, it says python-apt is the problem.
Would I be needing it for some other requirement? anyway to track dependencies to python-apt?
Nevermind, it seems tensorflow requires python-apt. I have removed python-apt to solve the earlier problem, but how do I re-install it?

$ sudo pip3 install python-apt

ERROR: Ignored the following yanked versions: 0.0.0, 0.7.8
ERROR: Could not find a version that satisfies the requirement python-apt (from versions: none)
ERROR: No matching distribution found for python-apt

@ichard26
Copy link
Member

Given the invalid version of python-apt (2.4.0-elementary9-ubuntu7.1), it seems to be a package from your distribution. You should probably use your distribution's system package manager to install the correct Python package. Perhaps apt install python3-apt if ElementaryOS is Ubuntu-based.

@chowdri
Copy link
Author

chowdri commented Apr 21, 2025

python3-apt from apt-get is 2.4.0-elementary9-ubuntu7.1.

$ sudo apt-get install python3-apt

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Suggested packages:
  python3-apt-dbg python-apt-doc
The following NEW packages will be installed:
  python3-apt
0 upgraded, 1 newly installed, 0 to remove and 12 not upgraded.
Need to get 0 B/200 kB of archives.
After this operation, 722 kB of additional disk space will be used.
Selecting previously unselected package python3-apt.
(Reading database ... 378385 files and directories currently installed.)
Preparing to unpack .../python3-apt_2.4.0+elementary9~ubuntu7.1_amd64.deb ...
Unpacking python3-apt (2.4.0+elementary9~ubuntu7.1) ...
Setting up python3-apt (2.4.0+elementary9~ubuntu7.1) ...

@RonnyPfannschmidt
Copy link
Contributor

Its a common issue with Debian derivates that invalid metadata is used

@ichard26 ichard26 added C: list/show 'pip list' or 'pip show' kind: crash For situations where pip crashes and removed S: needs triage Issues/PRs that need to be triaged labels Apr 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: list/show 'pip list' or 'pip show' kind: crash For situations where pip crashes type: bug A confirmed bug or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants