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
running Glasgow exectutable produces "TypeError: expected string or bytes-like object" in packaging\utils.py #422
Comments
Try again on commit e4fd2dc? |
Same issue as above. |
What's your |
In the venv packaging==23.2 |
I also ran into this on Python 3.9, this time on Ubuntu 20.04 LTS. But only found this GitHub issue when someone pointed it out. After a bunch of debugging, I found I could work around the FTR, I did try fixing it in From notes in
and there's a gist of my original traceback -- https://gist.github.com/ewenmcneill/c30b58a83e4768e537eaa35f2b74829e -- which at a glance looks the same as the one at the top of this issue, but within Presumably this is a Python 3.9 FTR, I too had the
and then later when I did the a reinstall to see if that fixed the issue, with:
(note that the older pipx, eg, in Ubuntu 20.04 LTS, does need that Ewen
|
I can confirm that the above fix works to fix this specific issue, |
FTR, this seems to be the
so it seems to be part of the Python 3.9 upstream distribution. Ewen |
Aha, there's a regex-over-a-regex-match to make the
at https://github.com/python/cpython/blob/43a6e4fa4934fcc0cbd83f7f3dc1b23a5f79f24b/Lib/importlib/metadata.py#L100-L103 where the regex patterns are defined at https://github.com/python/cpython/blob/43a6e4fa4934fcc0cbd83f7f3dc1b23a5f79f24b/Lib/importlib/metadata.py#L59-L63 So it's "expected" in Python 3.9 that it will return a Ewen |
Equivalent code in Python 3.10 is completely rearranged, but can be found at: and that doesn't obviously look that different, so I'm puzzled how this is a Python 3.9 specific bug. Maybe only Python 3.9 is leaking the Ewen |
Coerce each entry to be a a string, so we can use to check requirements. See GlasgowEmbedded#422
This module relies on an optional And just to be clear, the code is supposed to work both with and without |
I went back and omitted the aiohttp injection and that still worked, at least for the issue in the title. |
Nominating the issue for today's meeting; hopefully we'll be able to get a resolution there. (I still don't understand why it is happening, and this loading mechanism is a key part of Glasgow.) |
FTR, I wondered if it was only on editable ( AFAICT ETA: Python 3.12 re.findall() suggests Ewen Python 3.9 pipx non-editable install, still fails with TypeError
pdb on Python 3.9 importlib extras
|
Oh no.
which does not match the Python 3.9.latest I found in GitHub last night (in #422 (comment)), which is:
And the reason it doesn't match is python/cpython#91160, which backported some Relevant Python upstream bug for the backports is https://bugs.python.org/issue47004. Looks like the relevant backport was merged around 2022-03-13. Looks like that backport is in Python 3.9.12 (released 2022-03-23), see: https://github.com/python/cpython/blob/v3.9.12/Lib/importlib/metadata.py#L100-L103 So AFAICT this issue affects Python 3.9 <= 3.9.11 :-( And TBH, it's possibly best fixed by hand patching ETA: Looks like it'll also affect Python 3.10 releases prior to March 2022.as well; fixed in 3.10 branch by backport python/cpython@d929aa7. Broken in Python 3.10.2: https://github.com/python/cpython/blob/v3.10.2/Lib/importlib/metadata/__init__.py#L176-L179 and fixed in Python 3.10.3: https://github.com/python/cpython/blob/v3.10.3/Lib/importlib/metadata/__init__.py#L185-L188 (Python 3.10.3 was released 2022-03-16). Ewen |
Good/bad:
docker run --rm -it python:${version} bash pip install 'git+https://github.com/GlasgowEmbedded/glasgow#subdirectory=software'
glasgow --version |
Reach heaven by violence. #436 |
Thank you for "fixing" this (monkeypatching FTW!); works for me on Ubuntu 20.04 LTS with Python 3.9.5 from Universe.
For anyone finding this in future, my Ubuntu 20.04 LTS install was done by:
and in
which was removed from Python3.9. (Or alternatively pick some other way to install a much more recent pipx, and have a nicer time as the main glasgow instructions are more likely to work for you.)
(You may be able to leave All going well you should then be able to run Ewen |
I think you should be able to |
Yes, the Python in Ubuntu 20.04 LTS (both 3.8, and universe 3.9.5) seems to be old enough not to complain about doing system-wide installs into the "managed Python". This combination seems to work for me in an Ubuntu 20.04 LTS test docker run (although in the
Note in particular that the But as a general recommendation to Ubuntu 20.04 LTS users, using the pipx from PyPI is going to be a much nicer experience, as there seems to be a heap of changes in the least 3-4 years. (In particularly the old packaged python-pipx doesn't know about Ewen |
The example below is a build command but even just running
Glasgow
without any arguments, produces the same error. I updated to commit 62e27d9. This is still on python 3.9.I did try forcing it to be string in plugin.py:
if requirement.marker and requirement.marker.evaluate({"extra": str(dependency)}):
but after doing so I get an issue with the aiohttp dependency (so I don't know if this was the right thing to do):
Here is the full trace:
The text was updated successfully, but these errors were encountered: