-
-
Notifications
You must be signed in to change notification settings - Fork 30.5k
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
TypeError in importlib.metadata when distribution metadata has no name #100455
Comments
Please show us how you caused this exception so that we can reproduce it. |
It is in my gentoo, there will be problems when using emerge to install py components, it may take a little time to trigger with py script |
What's happening here is that some Distribution as discovered in the user's environment has a value of I don't believe we want to be more lenient to broken metadata here, but instead provide the user better error messages about the invalid metadata. I can replicate the error by creating an invalid metadata path:
@jack9603301 , it would really help to have more information about the problem. In particular, what version of Python are you running? What steps did you run to get the error (which package or packages did you install)? I tried installing python with emerge on gentoo, but I'm not familiar enough with gentoo to know how to bootstrap an environment. I tried using the gentoo/portage docker image as it has the most stars on dockerhub, but it doesn't even have bash and it doesn't have emerge.
I tried running with gentoo/stage-3, but it seems emerge isn't viable yet:
Are you familiar with Docker? If so, can you create the steps in a docker environment that replicate the reported issue? If not, do you have any advice on how to get emerge working in a virgin gentoo environment? |
@jaraco Let me see. Do you need me to use Docker to reproduce? |
I don't necessarily need Docker, although I do find that to be one of the easiest ways to recreate a Linux-based environment with its particular idiosyncrasies. I'd be just as happy with a set of instructions that replicates the issue in an Ubuntu (or maybe Gentoo) environment (I'm more familiar with Debian/Ubuntu). |
For anyone else out there who lost a few hours trying to track down what's going on with this error, here's a code snippet to identify which broken package is the culprit:
This helped me find an egg directory that was broken, so that I could reinstall the pip package. |
In python/importlib_metadata#371, a related issue is being addressed. Once that issue is addressed, the call to retrieve the name will throw a KeyError, providing better clarity on the cause of the issue (a missing name versus a type error later). That, along with the |
Bug report
A clear and concise description of what the bug is.
Include a minimal, reproducible example (https://stackoverflow.com/help/minimal-reproducible-example), if possible.
I don't know how to describe this bug, see
The problem is with the following code:
cpython/Lib/importlib/metadata/__init__.py
Lines 866 to 872 in 95c55a6
The fixes are as follows:
Guess the reason is that in some cases, name may be a None, if no judgment is made, an exception will always be thrown under certain conditions, which causes an exception in my gentoo regardless of any python3.10 library installed
Your environment
gentoo/Linux
The text was updated successfully, but these errors were encountered: