-
Notifications
You must be signed in to change notification settings - Fork 302
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
twine broke entirely: any command causes TypeError: expected string or bytes-like object #774
Comments
Downgrading to twine 3.3.0 worked (random older version) |
Can you show the output of Here's mine (which is working on macOS):
|
No, as I said, no commands work, not even |
Ah, right. How about the output of |
$ python -m pip freeze
|
This is reminding me of #760, where there was some odd behavior around multiple installations of type -a twine
type -a python
python -c "import sys; print(sys.executable)"
python -c "import importlib_metadata; print(importlib_metadata.version('importlib-metadata'))" Have you tried installing Twine in a fresh virtual environment? That worked for me on macOS, using the same versions that you have installed: % python3 -m venv venv-twine-774
% source venv-twine-774/bin/activate
% python3 -m pip install importlib_metadata==4.5.0 twine==3.4.1
% rehash
% type -a twine
twine is /private/tmp/venv-twine-774/bin/twine
twine is /Users/bhrutledge/.local/bin/twine
% twine --version
twine version 3.4.1 (importlib_metadata: 4.5.0, pkginfo: 1.7.1, requests: 2.25.1, requests-toolbelt: 0.9.1, tqdm:
4.61.2) |
I will report back after Monday |
debugging $ type -a twine
twine is /home/eugene/.local/bin//twine
$ type -a python
python is /usr/bin/python
$ python -c "import sys; print(sys.executable)"
/usr/bin/python
$ python -c "import importlib_metadata; print(importlib_metadata.version('importlib-metadata'))"
4.6.0 venv $ type -a twine
twine is /home/eugene/venv-twine-774/bin/twine
twine is /home/eugene/.local/bin//twine
$ twine --version
twine version 3.4.1 (importlib_metadata: 4.5.0, pkginfo: 1.7.1, requests: 2.26.0, requests-toolbelt: 0.9.1, tqdm: 4.61.2) so it works inside venv, but refuses to work outside even after installing older version and reinstalling EDIT: $ type -a twine
twine is /home/eugene/.local/bin/twine |
I'm stumped. I don't see anything out of the ordinary in the debugging info. I suspect there's an obscure conflict in your global Python environment, but I don't know how to track it down. @jaraco might have a suggestion, as a maintainer of Twine and importlib_metadata. You might try:
And see if Twine still fails. If it does, you could try a binary chop of the requirements file to isolate the conflict. Or, you could add However: I think this all points to why it's generally discouraged to install packages into your global Python environment. According to the PyPA's guide to installing stand alone command line tools:
Following the recommendation in that guide, you could |
The error message indicates that I suspect you have a package with invalid metadata (missing or corrupted). I'd do this:
I'd then inspect the metadata in each path that's printed. |
The issue isn't a twine issue. It just happens to affect twine because twine switched to using this newer importlib_metadata that happens to trip up on this environment. It's possible importlib_metadata should be more lenient in this case, but let's defer that consideration until we determine the cause. |
This produces error: /home/eugene/.local/lib/python3.9/site-packages/-ravitia_talk-0.0.1.dist-info
Traceback (most recent call last):
File "<stdin>", line 3, in <module>
TypeError: 'Message' object is not callable Removing 2nd line, I get 2 broken packages:
First is mine with broken name for some reason, 2nd one is pip with broken name as well. |
For future searchers, I had a similar related issue with import importlib_metadata as md
for dist in md.distributions():
try:
_ = dist._normalized_name
except:
print(dist._path) Still unsure why scipy was buggy, but I just downgraded to 1.9.2 and it works fine. Hope that helps someone. |
Downgrading twine to 3.3.0 worked for me. |
Your Environment
OS: Arch Linux
$ python --version Python 3.9.5 $ pip show twine Name: twine Version: 3.4.1 Summary: Collection of utilities for publishing packages on PyPI Home-page: https://twine.readthedocs.io/ Author: Donald Stufft and individual contributors Author-email: donald@stufft.io License: UNKNOWN Location: /home/eugene/.local/lib/python3.9/site-packages Requires: tqdm, rfc3986, keyring, colorama, importlib-metadata, readme-renderer, requests, pkginfo, requests-toolbelt Required-by:
twine was installed using pip and worked before. I don't remember if I updated it before it broke.
The Issue
Nothing works. Any command raises exception:
The text was updated successfully, but these errors were encountered: