I am trying to install few packages and started getting an error. Then used multiple commands in ubuntu to update few things but errors are similar
pip install -U pip setuptools
or
python3 -m pip install --upgrade pip
or
sudo -H pip3 install --upgrade pip
Following is the error sample
user@machine:~$ pip install cryptography
Traceback (most recent call last):
File "/usr/bin/pip", line 11, in <module>
load_entry_point('pip==20.0.2', 'console_scripts', 'pip')()
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 490, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2854, in load_entry_point
return ep.load()
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2445, in load
return self.resolve()
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2451, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/usr/lib/python3/dist-packages/pip/_internal/cli/main.py", line 10, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "/usr/lib/python3/dist-packages/pip/_internal/cli/autocompletion.py", line 9, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "/usr/lib/python3/dist-packages/pip/_internal/cli/main_parser.py", line 7, in <module>
from pip._internal.cli import cmdoptions
File "/usr/lib/python3/dist-packages/pip/_internal/cli/cmdoptions.py", line 24, in <module>
from pip._internal.exceptions import CommandError
File "/usr/lib/python3/dist-packages/pip/_internal/exceptions.py", line 10, in <module>
from pip._vendor.six import iteritems
File "/usr/lib/python3/dist-packages/pip/_vendor/__init__.py", line 65, in <module>
vendored("cachecontrol")
File "/usr/lib/python3/dist-packages/pip/_vendor/__init__.py", line 36, in vendored
__import__(modulename, globals(), locals(), level=0)
.
.
.
.
File "<frozen zipimport>", line 259, in load_module
File "/usr/share/python-wheels/urllib3-1.25.8-py2.py3-none-any.whl/urllib3/contrib/pyopenssl.py", line 46, in <module>
File "/home/dhome/.local/lib/python3.8/site-packages/OpenSSL/__init__.py", line 8, in <module>
from OpenSSL import SSL, crypto
File "/home/dhome/.local/lib/python3.8/site-packages/OpenSSL/SSL.py", line 19, in <module>
from OpenSSL.crypto import (
File "/home/dhome/.local/lib/python3.8/site-packages/OpenSSL/crypto.py", line 3224, in <module>
utils.deprecated(
TypeError: deprecated() got an unexpected keyword argument 'name'
I have updated the system with apt-get install libffi-dev python-dev python3-dev
and
apt-get install build-essential libssl-dev
already as suggested in here
5
Answers
Something got broken down in OpenSSL and no command was working with
pip
afterwards. I was even unable uninstallpip
.I removed installation files manually (most likely not a recommended approach) with
and reinstalled using
pip3 install pyOpenSSL==22.0.0
. The other version was having some issue as described here.For me even uninstall of pyOpenSSL was encountering same error
TypeError: deprecated() got an unexpected keyword argument 'name'
so first I upgraded pip to 23.0 ,uninstall PyOpenSSL,manually deleted openSSL folder from
/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages
then installedPyOpenSSL 20.0.0
, finally issue resolved.I know this isn’t a good fix but you can just add sudo before the rest of the command. It bypasses the error.
without sudo
with sudo
Upgrading
pyOpenSSL
worked for me!The accepted answer did not work for me (Python 3.8.10).
I solved the issue by creating a fresh virtual environment and upgrading pip (from 20.x to latest version as of now 23.1):
Only after that I installed the other dependencies.