ERROR: Installing this module requires OpenSSL python bindings

Hi, I can’t deploy a flask app because of the following error:

Aug 14 10:03:55 AM  Collecting secrets
Aug 14 10:03:55 AM    Downloading secrets-1.0.2.tar.gz (7.9 kB)
Aug 14 10:03:55 AM      ERROR: Command errored out with exit status 1:
Aug 14 10:03:55 AM       command: /opt/render/project/src/.venv/bin/python3.9 -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ql86avd3/secrets_d8bb1f2054b44774891ca775d5b41ed0/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ql86avd3/secrets_d8bb1f2054b44774891ca775d5b41ed0/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-6x6g7gre
Aug 14 10:03:55 AM           cwd: /tmp/pip-install-ql86avd3/secrets_d8bb1f2054b44774891ca775d5b41ed0/
Aug 14 10:03:55 AM      Complete output (12 lines):
Aug 14 10:03:55 AM      Traceback (most recent call last):
Aug 14 10:03:55 AM        File "/tmp/pip-install-ql86avd3/secrets_d8bb1f2054b44774891ca775d5b41ed0/setup.py", line 10, in <module>
Aug 14 10:03:55 AM          import OpenSSL
Aug 14 10:03:55 AM      ModuleNotFoundError: No module named 'OpenSSL'
Aug 14 10:03:55 AM  
Aug 14 10:03:55 AM      During handling of the above exception, another exception occurred:
Aug 14 10:03:55 AM  
Aug 14 10:03:55 AM      Traceback (most recent call last):
Aug 14 10:03:55 AM        File "<string>", line 1, in <module>
Aug 14 10:03:55 AM        File "/tmp/pip-install-ql86avd3/secrets_d8bb1f2054b44774891ca775d5b41ed0/setup.py", line 12, in <module>
Aug 14 10:03:55 AM          raise ImportError('Installing this module requires OpenSSL python bindings')
Aug 14 10:03:55 AM      ImportError: Installing this module requires OpenSSL python bindings

My requements.txt looks like this

cryptography
pyOpenSSL
Flask
Gunicorn
pandas
werkzeug
requests
secrets
flask_sqlalchemy
scrypt

It seems that OpenSSL should first be installed in the server (so the bindings are created).
Everything runs smoothly on my local machine, with a clean virtual environment on which I run pip install -r requirements.txt.

Hi @vene_1,

It looks like the secrets installation is failing with that error. I tried to find more information on the secrets library @1.0.2 that you’re trying to install, and am not seeing much information on it aside from here: https://pypi.org/project/secrets/#history. It looks like the latest and only release was from 2012, so I’m not sure if it’s compatible with the current version of OpenSSL you’ve installed, and I don’t see any support or issues for this module.

I’m wondering if you were instead intending to use python’s built-in secrets module: https://docs.python.org/3/library/secrets.html. If this is the case, then you can remove secrets from your requirements.txt file. Let me know exactly what it is that you’re trying to do.

Best,

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.