aspanov
aspanov

Reputation: 31

Django runserver_plus pyOpenSSL not installed error, although it is

Linux Mint 19.3, Python 3.8 virtual environment. So I try to run runserver_plus using ssl:

python manage.py runserver_plus --cert-file cert.crt

Then I get following error:

CommandError: Python OpenSSL Library is required to use runserver_plus with ssl support. Install via pip (pip install pyOpenSSL).

But the deal is that pyOpenSSL is already installed within my environment. Here is pip list output:

asgiref (3.5.2)
certifi (2022.9.24)
cffi (1.15.1)
charset-normalizer (2.1.1)
cryptography (38.0.3)
defusedxml (0.7.1)
Django (3.0.14)
django-extensions (2.2.5)
idna (3.4)
oauthlib (3.2.2)
Pillow (7.0.0)
pip (9.0.1)
pkg-resources (0.0.0)
pycparser (2.21)
PyJWT (2.6.0)
pyOpenSSL (19.0.0)
python3-openid (3.2.0)
pytz (2022.6)
requests (2.28.1)
requests-oauthlib (1.3.1)
setuptools (39.0.1)
six (1.16.0)
social-auth-app-django (3.1.0)
social-auth-core (4.3.0)
sqlparse (0.4.3)
urllib3 (1.26.12)
Werkzeug (0.16.0)
wheel (0.38.4)

Thanks in forward for any help!

I've tried to install different versions of pyOpenSSL, both erlier and later. Unsuccessfully.

Runserver_plus starts successfully without additional parameters, but my point is to access virtual server securely.

Upvotes: 0

Views: 1519

Answers (3)

CHOI
CHOI

Reputation: 162

I just followed what error message says, and it's resolved

error message:

CommandError: Python OpenSSL Library is required to use runserver_plus with ssl support. Install via pip (pip install pyOpenSSL).

so I did:

pip install pyOpenSSL

Upvotes: 0

aspanov
aspanov

Reputation: 31

So the deal was in outdated pip. I thought that update pip via apt utility is enough, but it's not. Pip official site provides special script for update operation. After update via script is complete PyOpenSSL should be reinstalled. As the result runserver_plus must start correctly.

Upvotes: 1

FilipA
FilipA

Reputation: 612

Such issue can appear when you need to recompile cryptography with the correct openssl.

To do that you can check the cryptography docs.

$ pip uninstall pyopenssl
$ pip uninstall cryptography
$ env LDFLAGS="-L$(brew --prefix openssl)/lib" CFLAGS="-I$(brew --prefix openssl)/include" pip install cryptography
$ pip install pyopenssl
$ python manage.py shell_plus
$ python manage.py runserver_plus --cert=foo.cert

Upvotes: 0

Related Questions