Reputation: 2284
I am attempting to run a Docker registry on Ubuntu 14 using the following command:
sudo gunicorn --access-logfile - --debug -k gevent -b 0.0.0.0:5000 -w 1 docker_registry.wsgi:application
Unfortunately, when I attempt this I get the following failure message:
Error: class uri 'gevent' invalid or not found:
[Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/gunicorn/util.py", line 139, in load_class
mod = import_module('.'.join(components))
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/usr/local/lib/python2.7/dist-packages/gunicorn/workers/ggevent.py", line 24, in <module>
from gevent.server import StreamServer
File "/usr/local/lib/python2.7/dist-packages/gevent/server.py", line 6, in <module>
from gevent.socket import EWOULDBLOCK, socket
File "/usr/local/lib/python2.7/dist-packages/gevent/socket.py", line 659, in <module>
from gevent.ssl import sslwrap_simple as ssl, SSLError as sslerror, SSLSocket as SSLType
File "/usr/local/lib/python2.7/dist-packages/gevent/ssl.py", line 386, in <module>
def get_server_certificate(addr, ssl_version=PROTOCOL_SSLv3, ca_certs=None):
NameError: name 'PROTOCOL_SSLv3' is not defined
I did some searching and discovered something that told me to install python-gevent in order to get the gevent:
sudo apt-get install python-gevent
I did this and a subsequent invocation of dpkg:
dpkg -l|grep python
shows that python-gevent is installed.
Unfortunately, the install has not resolved the problem. I am still getting the same failure message saying that gevent isn't valid or found.
Does anyone know how to resolve this problem??? Please advise...
Upvotes: 3
Views: 5905
Reputation: 5221
If you're getting this in late 2022 or later, know that gevent
versions 20.9.0 and earlier depend on greenlet
, without specifying an upper bound on that version. greenlet
has just released a breaking change in v2.x.x, and gevent
doesn't work with it.
Pinning greenlet=1.1.3
fixed it for me. More details about this issue here: https://github.com/python-greenlet/greenlet/issues/178
Upvotes: 4
Reputation: 129
re-Install python-gevent
apt-get install python-gevent
pip install --upgrade gevent
Upvotes: 4
Reputation: 11
try it:
1.find your python gevent package folder:
$ cd /usr/local/lib/python2.7/dist-packages/gevent
2.update ssl.py
from:
def get_server_certificate(addr, ssl_version=PROTOCOL_SSLv3, ca_certs=None):
to:
def get_server_certificate(addr, ssl_version=PROTOCOL_SSLv23, ca_certs=None):
3.try again:
$sudo gunicorn --access-logfile - --debug -k gevent -b 0.0.0.0:5000 -w 1 docker_registry.wsgi:application
Upvotes: 1