Skip to content
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

'Wheel' object has no attribute 'dynamic' #905

Open
raysalemi opened this issue Jun 4, 2022 · 11 comments
Open

'Wheel' object has no attribute 'dynamic' #905

raysalemi opened this issue Jun 4, 2022 · 11 comments

Comments

@raysalemi
Copy link

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.

  1. Your operating system:
    macOS 12.4
  2. Version of python you are running:
python --version
Python 3.8.12
  1. How did you install twine? Did you use your operating system's package manager or pip or something else?
    pip install --upgrade twine
  2. 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)
  1. 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/*
@raysalemi
Copy link
Author

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

@bhrutledge
Copy link
Contributor

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 #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.

@raysalemi
Copy link
Author

Thanks!

Is pkginfo in Twine's dependencies? Seems it could be.

@bhrutledge
Copy link
Contributor

Is pkginfo in Twine's dependencies? Seems it could be.

Yep:

twine/setup.cfg

Lines 37 to 38 in 8f5e5d6

install_requires=
pkginfo >= 1.8.1

@raysalemi
Copy link
Author

raysalemi commented Jun 6, 2022 via email

@sigmavirus24
Copy link
Member

I wonder why it didn’t upgrade when I upgraded twine.

That's likely something you could discern with your package manager.

@bhrutledge
Copy link
Contributor

@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.

@telmich
Copy link

telmich commented Jul 31, 2022

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

@telmich
Copy link

telmich commented Jul 31, 2022

It seems to work in pipx, not in a python venv. I am puzzled.

@telmich
Copy link

telmich commented Jul 31, 2022

@sigmavirus24
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants