twine
twine copied to clipboard
'Wheel' object has no attribute 'dynamic'
Your Environment
Thank you for taking the time to report an issue.
To more efficiently resolve this issue, we'd like to know some basic information about your system and setup.
- Your operating system: macOS 12.4
- Version of python you are running:
python --version
Python 3.8.12
- How did you install twine? Did you use your operating system's package manager or pip or something else?
pip install --upgrade twine
- Version of twine you have installed (include complete output of):
twine --version
twine version 4.0.1 (importlib-metadata: 4.8.1, keyring: 23.4.0, pkginfo: 1.8.2, requests: 2.26.0, requests-toolbelt: 0.9.1, urllib3: 1.26.7)
- Which package repository are you targeting? https://pypi.org/project/pyuvm/
If you're having issues uploading a specific package, you must include a copy of the following:
- The package's
PKG-INFO
PKG-INFO.zip - A redacted version of your
.pypirc
file (REMOVE ALL USERNAMES & PASSWORDS BEFORE UPLOADING) I don't have a.pypirc
file, or I don't know where to find it.
The Issue
Please describe the issue that you are experiencing.
Simple failure to upload due to Python error:
# python3 -m twine dist/*
Enter your username: raysalemi
Enter your password:
Traceback (most recent call last):
File "/Users/raysalemi/opt/anaconda3/lib/python3.8/runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/Users/raysalemi/opt/anaconda3/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/Users/raysalemi/opt/anaconda3/lib/python3.8/site-packages/twine/__main__.py", line 51, in <module>
sys.exit(main())
File "/Users/raysalemi/opt/anaconda3/lib/python3.8/site-packages/twine/__main__.py", line 33, in main
error = cli.dispatch(sys.argv[1:])
File "/Users/raysalemi/opt/anaconda3/lib/python3.8/site-packages/twine/cli.py", line 123, in dispatch
return main(args.args)
File "/Users/raysalemi/opt/anaconda3/lib/python3.8/site-packages/twine/commands/upload.py", line 198, in main
return upload(upload_settings, parsed_args.dists)
File "/Users/raysalemi/opt/anaconda3/lib/python3.8/site-packages/twine/commands/upload.py", line 142, in upload
resp = repository.upload(package)
File "/Users/raysalemi/opt/anaconda3/lib/python3.8/site-packages/twine/repository.py", line 186, in upload
resp = self._upload(package)
File "/Users/raysalemi/opt/anaconda3/lib/python3.8/site-packages/twine/repository.py", line 130, in _upload
data = package.metadata_dictionary()
File "/Users/raysalemi/opt/anaconda3/lib/python3.8/site-packages/twine/package.py", line 185, in metadata_dictionary
"dynamic": meta.dynamic,
AttributeError: 'Wheel' object has no attribute 'dynamic'
Steps to Reproduce
If the issue is predictable and consistently reproducible, please list the steps here.
rm -rf dist
python3 -m pip install --upgrade build
python3 -m build
python3 -m pip install --upgrade twine
python3 -m twine upload dist/*
I was able to upload by moving to a venv from a previous upload.
python3 -m twine --version
twine version 3.8.0 (pkginfo: 1.8.2, readme-renderer: 29.0, requests: 2.26.0, requests-toolbelt: 0.9.1, urllib3: 1.26.6, tqdm: 4.62.0,
importlib-metadata: 4.6.3, keyring: 23.0.1, rfc3986: 1.5.0, colorama: 0.4.4)
Does the bug not exist in 3.8.0?
Ray
I cloned https://github.com/pyuvm/pyuvm, and was able to run check
and upload
without error using Twine 4.0.1 in a fresh virtual environment:
% python3 -m venv venv
% source venv/bin/activate
% python3 --version
Python 3.8.12
% python3 -m pip install build
~/Dev/pyuvm (master|u=) (pyuvm/venv)
% python3 -m build
...
Successfully built pyuvm-2.8.0.tar.gz and pyuvm-2.8.0-py3-none-any.whl
% python3 -m pip install twine
% python3 -m twine --version
twine version 4.0.1 (importlib-metadata: 4.11.4, keyring: 23.5.1, pkginfo: 1.8.2, requests: 2.27.1, requests-toolbelt: 0.9.1, urllib3:
1.26.9)
% python3 -m twine check dist/*
Checking dist/pyuvm-2.8.0-py3-none-any.whl: PASSED
Checking dist/pyuvm-2.8.0.tar.gz: PASSED
% python3 -m twine upload dist/*
Uploading distributions to https://upload.pypi.org/legacy/
Enter your password:
Uploading pyuvm-2.8.0-py3-none-any.whl
100% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 63.5/63.5 kB • 00:00 • 28.6 MB/s
WARNING Error during upload. Retry with the --verbose option for more details.
ERROR HTTPError: 403 Forbidden from https://upload.pypi.org/legacy/
Invalid or non-existent authentication information. See https://pypi.org/help/#invalid-auth for more information.
I was able to reproduce the exception by downgrading pkginfo and running check
:
% python3 -m pip install pkginfo==1.7.1
% python3 -m twine check dist/*
...
File "/Users/bhrutledge/Dev/pyuvm/venv/lib/python3.8/site-packages/twine/package.py", line 185, in metadata_dictionary
"dynamic": meta.dynamic,
AttributeError: 'Wheel' object has no attribute 'dynamic'
pkginfo was upgraded in https://github.com/pypa/twine/pull/833 (released in 3.7.0) to support the dynamic
keyword. So, I'm guessing your Twine 4.0.1 environment somehow has an older version of pkginfo installed.
Thanks!
Is pkginfo in Twine's dependencies? Seems it could be.
Is pkginfo in Twine's dependencies? Seems it could be.
Yep:
https://github.com/pypa/twine/blob/8f5e5d6d42d582ef3ea6ef07da277e0cabd22fd2/setup.cfg#L37-L38
I wonder why it didn’t upgrade when I upgraded twine.
On Mon, Jun 6, 2022 at 8:16 AM Brian Rutledge @.***> wrote:
Is pkginfo in Twine's dependencies? Seems it could be.
Yep:
https://github.com/pypa/twine/blob/8f5e5d6d42d582ef3ea6ef07da277e0cabd22fd2/setup.cfg#L37-L38
— Reply to this email directly, view it on GitHub https://github.com/pypa/twine/issues/905#issuecomment-1147384348, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAYFXWRAAFYNQYWXA2WNG7TVNXTZHANCNFSM5X3YGCZA . You are receiving this because you authored the thread.Message ID: @.***>
I wonder why it didn’t upgrade when I upgraded twine.
That's likely something you could discern with your package manager.
@raysalemi From the traceback, it looks like Twine 4.0.1 was installed in a conda environment, possibly a global one? I don't have a specific example, but I recall seeing odd behavior in other issues where installations of the same package would cause import
confusion.
I got the same issue wtih twine 3.8.0 on Alpine Linux:
(venv2) [23:28] nb2:cdist% twine --version
twine version 3.8.0 (pkginfo: 1.5.0.1, readme-renderer: 29.0, requests: 2.28.1, requests-toolbelt: 0.9.1, urllib3: 1.26.10, tqdm: 4.63.2,
importlib-metadata: 0.0.0, keyring: 23.7.0, rfc3986: 2.0.0, colorama: 0.4.5)
Trying to upload cdist 7.0.0:
cdist% twine upload dist/cdist-7.0.0.tar.gz
Uploading distributions to https://upload.pypi.org/legacy/
Traceback (most recent call last):
File "/usr/bin/twine", line 8, in <module>
sys.exit(main())
File "/usr/lib/python3.10/site-packages/twine/__main__.py", line 28, in main
result = cli.dispatch(sys.argv[1:])
File "/usr/lib/python3.10/site-packages/twine/cli.py", line 68, in dispatch
return main(args.args)
File "/usr/lib/python3.10/site-packages/twine/commands/upload.py", line 197, in main
return upload(upload_settings, parsed_args.dists)
File "/usr/lib/python3.10/site-packages/twine/commands/upload.py", line 141, in upload
resp = repository.upload(package)
File "/usr/lib/python3.10/site-packages/twine/repository.py", line 189, in upload
resp = self._upload(package)
File "/usr/lib/python3.10/site-packages/twine/repository.py", line 144, in _upload
data = package.metadata_dictionary()
File "/usr/lib/python3.10/site-packages/twine/package.py", line 181, in metadata_dictionary
"dynamic": meta.dynamic,
AttributeError: 'SDist' object has no attribute 'dynamic'
Attached are the release files cdist-7.0.0.tar.gz
And my .pypirc:
[distutils]
index-servers =
pypi
[pypi]
username = __token__
password = (token)
I am on Python 3.10.5. I tried the system twine as well as freshly installed in a venv:
bleach==5.0.1
certifi==2022.6.15
cffi==1.15.1
charset-normalizer==2.1.0
commonmark==0.9.1
cryptography==37.0.4
docutils==0.19
idna==3.3
importlib-metadata==4.12.0
jeepney==0.8.0
keyring==23.7.0
pkginfo==1.8.3
pycparser==2.21
Pygments==2.12.0
readme-renderer==35.0
requests==2.28.1
requests-toolbelt==0.9.1
rfc3986==2.0.0
rich==12.5.1
SecretStorage==3.3.2
six==1.16.0
twine==4.0.1
urllib3==1.26.11
webencodings==0.5.1
zipp==3.8.1
Both have the same error
It seems to work in pipx, not in a python venv. I am puzzled.
Cross linking https://gitlab.alpinelinux.org/alpine/aports/-/issues/14066
I got the same issue wtih twine 3.8.0 on Alpine Linux:
(venv2) [23:28] nb2:cdist% twine --version twine version 3.8.0 (pkginfo: 1.5.0.1, readme-renderer: 29.0, requests: 2.28.1, requests-toolbelt: 0.9.1, urllib3: 1.26.10, tqdm: 4.63.2, importlib-metadata: 0.0.0, keyring: 23.7.0, rfc3986: 2.0.0, colorama: 0.4.5)
Trying to upload cdist 7.0.0:
cdist% twine upload dist/cdist-7.0.0.tar.gz Uploading distributions to https://upload.pypi.org/legacy/ Traceback (most recent call last): File "/usr/bin/twine", line 8, in <module> sys.exit(main()) File "/usr/lib/python3.10/site-packages/twine/__main__.py", line 28, in main result = cli.dispatch(sys.argv[1:]) File "/usr/lib/python3.10/site-packages/twine/cli.py", line 68, in dispatch return main(args.args) File "/usr/lib/python3.10/site-packages/twine/commands/upload.py", line 197, in main return upload(upload_settings, parsed_args.dists) File "/usr/lib/python3.10/site-packages/twine/commands/upload.py", line 141, in upload resp = repository.upload(package) File "/usr/lib/python3.10/site-packages/twine/repository.py", line 189, in upload resp = self._upload(package) File "/usr/lib/python3.10/site-packages/twine/repository.py", line 144, in _upload data = package.metadata_dictionary() File "/usr/lib/python3.10/site-packages/twine/package.py", line 181, in metadata_dictionary "dynamic": meta.dynamic, AttributeError: 'SDist' object has no attribute 'dynamic'
Attached are the release files cdist-7.0.0.tar.gz
And my .pypirc:
[distutils] index-servers = pypi [pypi] username = __token__ password = (token)
I am on Python 3.10.5. I tried the system twine as well as freshly installed in a venv:
bleach==5.0.1 certifi==2022.6.15 cffi==1.15.1 charset-normalizer==2.1.0 commonmark==0.9.1 cryptography==37.0.4 docutils==0.19 idna==3.3 importlib-metadata==4.12.0 jeepney==0.8.0 keyring==23.7.0 pkginfo==1.8.3 pycparser==2.21 Pygments==2.12.0 readme-renderer==35.0 requests==2.28.1 requests-toolbelt==0.9.1 rfc3986==2.0.0 rich==12.5.1 SecretStorage==3.3.2 six==1.16.0 twine==4.0.1 urllib3==1.26.11 webencodings==0.5.1 zipp==3.8.1
Both have the same error
You say they both have the same error. Do you mean the exact same traceback including paths? If so it's because you're not using the version installed in the virtual environment, your using the one installed globally. In general, I strongly advise against global installations because it seems you have versions of dependencies that are incompatible but which your installation method did not accommodate for.