Gunicorn: why can't import _ssl?

Created on 19 Nov 2018  ·  4Comments  ·  Source: benoitc/gunicorn

gunicorn --bind 0.0.0.0:8000 wsgi:app
Traceback (most recent call last):
File "/usr/bin/gunicorn", line 7, in
from gunicorn.app.wsgiapp import run
File "/usr/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 9, in
from gunicorn.app.base import Application
File "/usr/python/lib/python3.6/site-packages/gunicorn/app/base.py", line 14, in
from gunicorn.config import Config, get_default_config_file
File "/usr/python/lib/python3.6/site-packages/gunicorn/config.py", line 18, in
import ssl
File "/usr/python/lib/python3.6/ssl.py", line 101, in
import _ssl # if we can't import it, let the error propagate
ModuleNotFoundError: No module named '_ssl'

based on centos7
have install python3.6
when i into command line import ssl is ok,but when i test this command "gunicorn --bind 0.0.0.0:8000 wsgi:app" for test was done.

Most helpful comment

It means that didn't install Python with ssl support on your machine. Either use a package or follow the advices above :)

Closing the issue as it's not related to gunicorn.

All 4 comments

How did you install Python3.6?
Looking at your logs, python path located in /usr/python, was it manually compiled and installed? I guess you failed to build _ssl module.

Please describe how you obtained/installed Python. Maybe you installed from source and omitted the --with-ssl option.

https://stackoverflow.com/a/5128893/452210.

It means that didn't install Python with ssl support on your machine. Either use a package or follow the advices above :)

Closing the issue as it's not related to gunicorn.

I had same problem.
My python version is 3.7 (64 bit). I just relaunched installation, and clicked 'Repair'.
After repair i relaunched PyCharm, and the problem was solved.

Was this page helpful?
0 / 5 - 0 ratings