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

v22.1.0 ERROR: deprecated() got an unexpected keyword argument 'name' #1154

Closed
BaiJiangJie opened this issue Sep 27, 2022 · 21 comments
Closed

Comments

@BaiJiangJie
Copy link

image

@BaiJiangJie BaiJiangJie changed the title Error in V22.1.0 v22.1.0 ERROR: deprecated() got an unexpected keyword argument 'name' Sep 27, 2022
@massiou
Copy link

massiou commented Sep 27, 2022

Same issue spotted with awscli==1.22.24

@alex
Copy link
Member

alex commented Sep 27, 2022

See #1151

@Oreolek
Copy link

Oreolek commented Sep 30, 2022

Got this after ArchLinux upgrade: python-cryptography=38.0.1-1, python-pyopenssl=22.1.0-1. Completely broke gajim app.

@reaperhulk
Copy link
Member

This error cannot occur if you're actually using pyopenssl 22.1, so despite upgrading your OS package you're using an older version somewhere.

@Oreolek
Copy link

Oreolek commented Sep 30, 2022

okay turns out i had cryptography=36.0.2 installed as user package.

@AnandMoorthy
Copy link

I too facing same issue, any solutions?

@troyharvey
Copy link

We've downgraded as a temporary workaround in case it helps anyone else:

pyOpenSSL==22.0.0 # TODO: Issue with 22.1 https://github.com/pyca/pyopenssl/issues/1154

@mhils
Copy link
Member

mhils commented Oct 4, 2022

This is not a bug in pyOpenSSL 22.1. pyOpenSSL 22.1 unambiguously specifies a dependency on cryptography>=38.0.0,<39:

pyopenssl/setup.py

Lines 97 to 100 in d7e539c

install_requires=[
# Fix cryptographyMinimum in tox.ini when changing this!
"cryptography>=38.0.0,<39",
],

I'm not sure how y'all end up installing pyOpenSSL 22.1 without also installing a compatible version of cryptography, but it's definitely not a bug in pyOpenSSL but a problem with how you install/upgrade your Python packages.

@richstokes
Copy link

@nicolamarangoni
Copy link

I can confirm that

pip3 install cryptography --upgrade
pip3 install pyOpenSSL --upgrade

breaks awscli on MacOS.
Downgrading pyOpenSSL fixes it:

pip3 install pyOpenSSL==22.0.0

This is the error:

~ % aws --version
Traceback (most recent call last):
  File "/usr/local/bin/aws", line 19, in <module>
    import awscli.clidriver
  File "/usr/local/Cellar/awscli/2.7.31/libexec/lib/python3.10/site-packages/awscli/clidriver.py", line 20, in <module>
    import botocore.session
  File "/usr/local/Cellar/awscli/2.7.31/libexec/lib/python3.10/site-packages/awscli/botocore/session.py", line 27, in <module>
    import botocore.client
  File "/usr/local/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 "/usr/local/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 "/usr/local/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 "/usr/local/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 "/usr/local/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 "/usr/local/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 "/usr/local/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 "/usr/local/Cellar/awscli/2.7.31/libexec/lib/python3.10/site-packages/awscli/botocore/utils.py", line 32, in <module>
    import botocore.httpsession
  File "/usr/local/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 "/usr/local/Cellar/awscli/2.7.31/libexec/lib/python3.10/site-packages/urllib3/contrib/pyopenssl.py", line 50, in <module>
    import OpenSSL.SSL
  File "/usr/local/lib/python3.10/site-packages/OpenSSL/__init__.py", line 8, in <module>
    from OpenSSL import SSL, crypto
  File "/usr/local/lib/python3.10/site-packages/OpenSSL/SSL.py", line 19, in <module>
    from OpenSSL.crypto import (
  File "/usr/local/lib/python3.10/site-packages/OpenSSL/crypto.py", line 3224, in <module>
    utils.deprecated(
TypeError: deprecated() got an unexpected keyword argument 'name'

@n1ngu
Copy link

n1ngu commented Oct 6, 2022

This can happen if you install incompatible versions of pyOpenSSL and cryptography in separate pip instructions like

pip install pyOpenSSL==22.1.0
pip install cryptography==3.0

During the second install transaction, you will see

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
pyopenssl 22.1.0 requires cryptography<39,>=38.0.0, but you have cryptography 3.0 which is incompatible.

Had you installed both in a single instruction, you would have run into an installation error instead

pip install cryptography==3.0 pyOpenSSL==22.1.0
...
ERROR: Cannot install cryptography==3.0 and pyopenssl==22.1.0 because these package versions have conflicting dependencies.

The conflict is caused by:
    The user requested cryptography==3.0
    pyopenssl 22.1.0 depends on cryptography<39 and >=38.0.0

To fix this you could try to:
1. loosen the range of package versions you've specified
2. remove package versions to allow pip attempt to solve the dependency conflict

ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts

So that's it:

  • fix you install scripts
  • upgrade your setups, holy fuck

@nicolamarangoni
Copy link

@n1ngu
cryptography uninstalled:

~ % pip3 uninstall cryptography
Found existing installation: cryptography 38.0.1
Uninstalling cryptography-38.0.1:
  Would remove:
    /usr/local/lib/python3.10/site-packages/cryptography-38.0.1.dist-info/*
    /usr/local/lib/python3.10/site-packages/cryptography/*
Proceed (Y/n)?
  Successfully uninstalled cryptography-38.0.1

pyOpenSSL uninstalled:

~ % pip3 uninstall pyOpenSSL
Found existing installation: pyOpenSSL 22.0.0
Uninstalling pyOpenSSL-22.0.0:
  Would remove:
    /usr/local/lib/python3.10/site-packages/OpenSSL/*
    /usr/local/lib/python3.10/site-packages/pyOpenSSL-22.0.0.dist-info/*
Proceed (Y/n)?
  Successfully uninstalled pyOpenSSL-22.0.0

pyOpenSSL installed, what automatically installs the right version of cryptography

~ % pip3 install pyOpenSSL
Collecting pyOpenSSL
  Using cached pyOpenSSL-22.1.0-py3-none-any.whl (57 kB)
Collecting cryptography<39,>=38.0.0
  Using cached cryptography-38.0.1-cp36-abi3-macosx_10_10_x86_64.whl (2.8 MB)
Requirement already satisfied: cffi>=1.12 in /usr/local/lib/python3.10/site-packages (from cryptography<39,>=38.0.0->pyOpenSSL) (1.15.1)
Requirement already satisfied: pycparser in /usr/local/lib/python3.10/site-packages (from cffi>=1.12->cryptography<39,>=38.0.0->pyOpenSSL) (2.21)
Installing collected packages: cryptography, pyOpenSSL
Successfully installed cryptography-38.0.1 pyOpenSSL-22.1.0

awscli still broken with cryptography-38.0.1 and pyOpenSSL-22.1.0:

~ % aws --version
Traceback (most recent call last):
  File "/usr/local/bin/aws", line 19, in <module>
    import awscli.clidriver
  File "/usr/local/Cellar/awscli/2.7.31/libexec/lib/python3.10/site-packages/awscli/clidriver.py", line 20, in <module>
    import botocore.session
  File "/usr/local/Cellar/awscli/2.7.31/libexec/lib/python3.10/site-packages/awscli/botocore/session.py", line 27, in <module>
    import botocore.client
  File "/usr/local/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 "/usr/local/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 "/usr/local/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 "/usr/local/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 "/usr/local/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 "/usr/local/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 "/usr/local/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 "/usr/local/Cellar/awscli/2.7.31/libexec/lib/python3.10/site-packages/awscli/botocore/utils.py", line 32, in <module>
    import botocore.httpsession
  File "/usr/local/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 "/usr/local/Cellar/awscli/2.7.31/libexec/lib/python3.10/site-packages/urllib3/contrib/pyopenssl.py", line 50, in <module>
    import OpenSSL.SSL
  File "/usr/local/lib/python3.10/site-packages/OpenSSL/__init__.py", line 8, in <module>
    from OpenSSL import SSL, crypto
  File "/usr/local/lib/python3.10/site-packages/OpenSSL/SSL.py", line 19, in <module>
    from OpenSSL.crypto import (
  File "/usr/local/lib/python3.10/site-packages/OpenSSL/crypto.py", line 3224, in <module>
    utils.deprecated(
TypeError: deprecated() got an unexpected keyword argument 'name'

@renanxx1
Copy link

renanxx1 commented Oct 6, 2022

I'm facing the same error. I tried to uninstall the packages like examples above but the error is also happening when I use pip3 install/uninstall. I'm using ubuntu 20.04.5. deprecated() got an unexpected keyword argument 'name'
Any suggestions ?

@reaperhulk
Copy link
Member

reaperhulk commented Oct 6, 2022

These issues are almost certainly caused by version mismatches. For example, in the stack trace provided by @nicolamarangoni AWS CLI is loading libraries out of at least two different site-packages directories. In fact, looking at an install of awscli in homebrew on my laptop I see that it installs cryptography 36.0.2. When awscli attempts to load libraries it is loading version 36 from that. botocore then attempts to opportunistically import pyOpenSSL through urllib3 for some fallback behavior, but that's not necessary functionality and it will eat the ImportError if the library is not present.

Unfortunately, this doesn't fail with the way homebrew has this packaged (since the awscli site-packages are not entirely isolated) and so it imports pyOpenSSL from the site packages that your pip installs to. cryptography 38 was installed into the same site-packages directory as pyOpenSSL, but is not the version that is loaded, which causes this exception.

There are a few fixes possible here, listed in order of how robust they would be

  1. Figure out how to make homebrew formulas entirely isolated from the site-packages of the parent Python installation.
  2. Investigate if the pyopenssl fallback behavior in botocore is still needed for any scenarios and remove it entirely if not.
  3. Upgrade awscli to use cryptography 38
  4. Uninstall pyOpenSSL if you don't need it
  5. Downgrade to pyOpenSSL 22.0 (very fragile!)

Any of those options will "fix" this particular problem, but only the first will prevent any possible problems in the future. However, that one is also likely to be the most challenging so I'd suggest folks affected by this who know they need pyOpenSSL pursue both option 1 and 3.

@nicolamarangoni
Copy link

Homebrew guys are informed and will correct their awscli distribution.

This fixes the issue temporarily:

~ % /usr/local/Cellar/awscli/2.7.31/libexec/bin/python -m pip install cryptography --upgrade
Requirement already satisfied: cryptography in /usr/local/Cellar/awscli/2.7.31/libexec/lib/python3.10/site-packages (36.0.2)
Collecting cryptography
  Using cached cryptography-38.0.1-cp36-abi3-macosx_10_10_x86_64.whl (2.8 MB)
Requirement already satisfied: cffi>=1.12 in /usr/local/Cellar/awscli/2.7.31/libexec/lib/python3.10/site-packages (from cryptography) (1.15.1)
Requirement already satisfied: pycparser in /usr/local/Cellar/awscli/2.7.31/libexec/lib/python3.10/site-packages (from cffi>=1.12->cryptography) (2.21)
Installing collected packages: cryptography
  Attempting uninstall: cryptography
    Found existing installation: cryptography 36.0.2
    Uninstalling cryptography-36.0.2:
      Successfully uninstalled cryptography-36.0.2
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
awscli 2.7.31 requires awscrt<=0.14.0,>=0.12.4, but you have awscrt 0.14.3 which is incompatible.
awscli 2.7.31 requires cryptography<37.0.0,>=3.3.2, but you have cryptography 38.0.1 which is incompatible.
Successfully installed cryptography-38.0.1

@jrgallibot
Copy link

image

how to fix this? please help me.

@dhairyag
Copy link

dhairyag commented Oct 12, 2022

I have highlighted issue here

Even pip uninstall pip does not work. Any command with pip throws an error.

@evelynegroen
Copy link

Same here, one of the apache airflow provider packages I use to set up a managed airflow locally with docker, seems to install OpenSSL==22.1.0.
As a workaround, n the bootstrap.sh file, I set:
pip3 install pyOpenSSL==22.0.0
that fixed the issue.

@stevenperumean
Copy link

pip3 install pyOpenSSL==22.0.0

Thank you!

gerrit-photon pushed a commit to vmware/photon that referenced this issue Nov 29, 2022
- Due to an upstream issue
pyca/pyopenssl#1154
 downgrading the version to v22.0.0
- This fixes the issue during installation time
"ERROR: deprecated() got an unexpected keyword argument 'name'"

Change-Id: I694e3c4366c2455c683878271ff0079b601327be
Signed-off-by: Ankit Jain <[email protected]>
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/18672
Tested-by: Michelle Wang <[email protected]>
Reviewed-by: Tapas Kundu <[email protected]>
@lzskyline
Copy link

lzskyline commented Jul 24, 2023

If you cannot run pip uninstall pyOpenSSL command, have a try:

cd /usr/local/lib/python3.8/dist-packages/
sudo rm -rf OpenSSL
sudo rm -rf pyOpenSSL-23.1.1.dist-info
pip3 install pyOpenSSL

@Momin9
Copy link

Momin9 commented Nov 15, 2023

I applied one by one all solution but not resolved same error faced

    import boto3
  File "/home/workspace/.local/share/virtualenvs/workspace-hArTflJD/lib/python3.8/site-packages/boto3/__init__.py", line 17, in <module>
    from boto3.session import Session
  File "/home/workspace/.local/share/virtualenvs/workspace-hArTflJD/lib/python3.8/site-packages/boto3/session.py", line 17, in <module>
    import botocore.session
  File "/home/workspace/.local/share/virtualenvs/workspace-hArTflJD/lib/python3.8/site-packages/botocore/session.py", line 26, in <module>
    import botocore.client
  File "/home/workspace/.local/share/virtualenvs/workspace-hArTflJD/lib/python3.8/site-packages/botocore/client.py", line 15, in <module>
    from botocore import waiter, xform_name
  File "/home/workspace/.local/share/virtualenvs/workspace-hArTflJD/lib/python3.8/site-packages/botocore/waiter.py", line 18, in <module>
    from botocore.docs.docstring import WaiterDocstring
  File "/home/workspace/.local/share/virtualenvs/workspace-hArTflJD/lib/python3.8/site-packages/botocore/docs/__init__.py", line 15, in <module>
    from botocore.docs.service import ServiceDocumenter
  File "/home/workspace/.local/share/virtualenvs/workspace-hArTflJD/lib/python3.8/site-packages/botocore/docs/service.py", line 14, in <module>
    from botocore.docs.client import ClientDocumenter, ClientExceptionsDocumenter
  File "/home/workspace/.local/share/virtualenvs/workspace-hArTflJD/lib/python3.8/site-packages/botocore/docs/client.py", line 14, in <module>
    from botocore.docs.example import ResponseExampleDocumenter
  File "/home/workspace/.local/share/virtualenvs/workspace-hArTflJD/lib/python3.8/site-packages/botocore/docs/example.py", line 13, in <module>
    from botocore.docs.shape import ShapeDocumenter
  File "/home/workspace/.local/share/virtualenvs/workspace-hArTflJD/lib/python3.8/site-packages/botocore/docs/shape.py", line 19, in <module>
    from botocore.utils import is_json_value_header
  File "/home/workspace/.local/share/virtualenvs/workspace-hArTflJD/lib/python3.8/site-packages/botocore/utils.py", line 34, in <module>
    import botocore.httpsession
  File "/home/workspace/.local/share/virtualenvs/workspace-hArTflJD/lib/python3.8/site-packages/botocore/httpsession.py", line 41, in <module>
    from urllib3.contrib.pyopenssl import orig_util_SSLContext as SSLContext
  File "/home/workspace/.local/share/virtualenvs/workspace-hArTflJD/lib/python3.8/site-packages/urllib3/contrib/pyopenssl.py", line 50, in <module>
    import OpenSSL.crypto
  File "/home/workspace/.local/share/virtualenvs/workspace-hArTflJD/lib/python3.8/site-packages/OpenSSL/__init__.py", line 8, in <module>
    from OpenSSL import SSL, crypto
  File "/home/workspace/.local/share/virtualenvs/workspace-hArTflJD/lib/python3.8/site-packages/OpenSSL/SSL.py", line 34, in <module>
    from OpenSSL.crypto import (
  File "/home/workspace/.local/share/virtualenvs/workspace-hArTflJD/lib/python3.8/site-packages/OpenSSL/crypto.py", line 945, in <module>
    utils.deprecated(
TypeError: deprecated() got an unexpected keyword argument 'name'

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests