aws-cli icon indicating copy to clipboard operation
aws-cli copied to clipboard

TypeError: deprecated() got an unexpected keyword argument 'name'

Open richstokes opened this issue 4 years ago • 13 comments

Describe the bug

Installed via brew install awscli, getting:

aws

Traceback (most recent call last):
  File "/opt/homebrew/bin/aws", line 19, in <module>
    import awscli.clidriver
  File "/opt/homebrew/Cellar/awscli/2.7.31/libexec/lib/python3.10/site-packages/awscli/clidriver.py", line 20, in <module>
    import botocore.session
  File "/opt/homebrew/Cellar/awscli/2.7.31/libexec/lib/python3.10/site-packages/awscli/botocore/session.py", line 27, in <module>
    import botocore.client
  File "/opt/homebrew/Cellar/awscli/2.7.31/libexec/lib/python3.10/site-packages/awscli/botocore/client.py", line 16, in <module>
    from botocore import UNSIGNED, waiter, xform_name
  File "/opt/homebrew/Cellar/awscli/2.7.31/libexec/lib/python3.10/site-packages/awscli/botocore/waiter.py", line 17, in <module>
    from botocore.docs.docstring import WaiterDocstring
  File "/opt/homebrew/Cellar/awscli/2.7.31/libexec/lib/python3.10/site-packages/awscli/botocore/docs/__init__.py", line 15, in <module>
    from botocore.docs.service import ServiceDocumenter
  File "/opt/homebrew/Cellar/awscli/2.7.31/libexec/lib/python3.10/site-packages/awscli/botocore/docs/service.py", line 14, in <module>
    from botocore.docs.client import ClientDocumenter, ClientExceptionsDocumenter
  File "/opt/homebrew/Cellar/awscli/2.7.31/libexec/lib/python3.10/site-packages/awscli/botocore/docs/client.py", line 16, in <module>
    from botocore.docs.example import ResponseExampleDocumenter
  File "/opt/homebrew/Cellar/awscli/2.7.31/libexec/lib/python3.10/site-packages/awscli/botocore/docs/example.py", line 13, in <module>
    from botocore.docs.shape import ShapeDocumenter
  File "/opt/homebrew/Cellar/awscli/2.7.31/libexec/lib/python3.10/site-packages/awscli/botocore/docs/shape.py", line 19, in <module>
    from botocore.utils import is_json_value_header
  File "/opt/homebrew/Cellar/awscli/2.7.31/libexec/lib/python3.10/site-packages/awscli/botocore/utils.py", line 32, in <module>
    import botocore.httpsession
  File "/opt/homebrew/Cellar/awscli/2.7.31/libexec/lib/python3.10/site-packages/awscli/botocore/httpsession.py", line 41, in <module>
    from urllib3.contrib.pyopenssl import orig_util_SSLContext as SSLContext
  File "/opt/homebrew/Cellar/awscli/2.7.31/libexec/lib/python3.10/site-packages/urllib3/contrib/pyopenssl.py", line 50, in <module>
    import OpenSSL.SSL
  File "/Users/rich/Library/Python/3.10/lib/python/site-packages/OpenSSL/__init__.py", line 8, in <module>
    from OpenSSL import SSL, crypto
  File "/Users/rich/Library/Python/3.10/lib/python/site-packages/OpenSSL/SSL.py", line 19, in <module>
    from OpenSSL.crypto import (
  File "/Users/rich/Library/Python/3.10/lib/python/site-packages/OpenSSL/crypto.py", line 3224, in <module>
    utils.deprecated(
TypeError: deprecated() got an unexpected keyword argument 'name'

Expected Behavior

Not error

Current Behavior

see above

Reproduction Steps

see above

Possible Solution

No response

Additional Information/Context

Python 3.10.7

brew info awscli                                                            

==> awscli: stable 2.7.31 (bottled), HEAD
Official Amazon AWS command-line interface
https://aws.amazon.com/cli/
/opt/homebrew/Cellar/awscli/2.7.31 (12,785 files, 104.3MB) *
  Poured from bottle on 2022-10-05 at 11:17:09
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/awscli.rb
License: Apache-2.0
==> Dependencies
Build: cmake ✔, rust ✘
Required: [email protected] ✔, six ✔
==> Options
--HEAD
	Install HEAD version
==> Caveats
The "examples" directory has been installed to:
  /opt/homebrew/share/awscli/examples

zsh completions and functions have been installed to:
  /opt/homebrew/share/zsh/site-functions
==> Analytics
install: 174,547 (30 days), 681,760 (90 days), 2,614,888 (365 days)
install-on-request: 172,229 (30 days), 671,892 (90 days), 2,586,882 (365 days)
build-error: 51 (30 days)

CLI version used

2.7.31

Environment details (OS name and version, etc.)

MacOS 12.6, Apple Silicon

richstokes avatar Oct 05 '22 18:10 richstokes

pip3 uninstall pyOpenSSL fixed it, must have been some kind of local conflict

richstokes avatar Oct 05 '22 18:10 richstokes

Hi @richstokes thanks for reporting this. It's something that the team will need to look further into. In the meantime uninstalling pyOpenSSL fixes the issue as you mentioned or you could downgrade pyOpenSSL to 22.0.0 as referenced in a comment from the issue you linked. If anyone else is affected by this please 👍 this issue and leave a comment if you had any additional info to share.

tim-finnigan avatar Oct 05 '22 22:10 tim-finnigan

https://github.com/pyca/pyopenssl/issues/1154#issuecomment-1270332681 explains why this is happening (to at least the subset of users who are installing awscli via homebrew, but likely other similar scenarios as well).

Additionally, as a cryptography developer I'd recommend that awscli update their cryptography dependency to <39, which would technically "fix" this, but is not the true cause.

reaperhulk avatar Oct 06 '22 16:10 reaperhulk

Hi @reaperhulk thanks for checking in here. Brew installation isn't officially supported per the AWS CLI documentation but the team can look into increasing the ceiling for the cryptography package as you suggested. (We also have a tracking issue open for updating the version ranges of several dependencies which I'll link here: https://github.com/aws/aws-cli/issues/5943.)

A more long-term fix would likely require involvement on brew's side and updating how the packaging is done. And the brew team would need to update their pin on cryptography as well once the ceiling is updated for the CLI. Also the CLI/botocore don't use pyOpenSSL but this comment provides more context on the relationship between pyOpenSSL and urllib3: https://github.com/boto/botocore/issues/2744#issuecomment-1270464232

tim-finnigan avatar Oct 06 '22 18:10 tim-finnigan

Update: https://github.com/aws/aws-cli/pull/7329 was just merged to increase the version range for cryptography. This should unblock the homebrew team once it is released tomorrow to raise their pin as well

tim-finnigan avatar Oct 06 '22 22:10 tim-finnigan

Since uninstalling pyOpenSSL resolves the original issue reported I'm going to close this.

tim-finnigan avatar Nov 14 '22 21:11 tim-finnigan

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see. If you need more assistance, please open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.

github-actions[bot] avatar Nov 14 '22 21:11 github-actions[bot]

I opened a new issue regarding this problem, I can't solve with the solutions provided here. Please see : https://github.com/aws/aws-cli/issues/7607

stoccalino avatar Jan 23 '23 14:01 stoccalino

But when I use the command "pip3 uninstall pyOpenSSL",it still throws the error "TypeError: deprecated() got an unexpected keyword argument 'name'".And even I execute "pip -V",it throws the error too.It sounds sadly.I would try to uninstall python3.8 which I am using and install python3.10.

qingzheng-web avatar May 30 '23 00:05 qingzheng-web

But when I use the command "pip3 uninstall pyOpenSSL",it still throws the error "TypeError: deprecated() got an unexpected keyword argument 'name'".And even I execute "pip -V",it throws the error too.It sounds sadly.I would try to uninstall python3.8 which I am using and install python3.10.

Just go to this path: cd ~/.local/lib/python3.8/site-packages and simply delete OpenSSL: rm -r OpenSSL

rai-usman avatar May 30 '23 09:05 rai-usman

@richstokes Not Fixed with this command pip3 uninstall pyOpenSSL I already not install

Momin9 avatar Nov 15 '23 13:11 Momin9

For Windows users: who are getting this error with sam:

Go to C:\Program Files\Amazon\AWSSAMCLI\runtime\Lib\site-packages and rename or delete the OpenSSL folder

sryze avatar Nov 23 '23 16:11 sryze

But when I use the command "pip3 uninstall pyOpenSSL",it still throws the error "TypeError: deprecated() got an unexpected keyword argument 'name'".And even I execute "pip -V",it throws the error too.It sounds sadly.I would try to uninstall python3.8 which I am using and install python3.10.

Just go to this path: cd ~/.local/lib/python3.8/site-packages and simply delete OpenSSL: rm -r OpenSSL

thx!!! it works~

jiaohuix avatar Nov 23 '24 06:11 jiaohuix