1

I created a virtual env for a matrix home server installation on a shared hoster.

$ virtualenv -p python2.7 /home/tristank/venv/synapse
$ source /home/tristank/venv/synapse/bin/activate

I installed all the necessary dependencies and started the server but for some reason Python won't recognize Openssl. Why is that and how do I make Python pick up OpenSSL?

$ python -V
Python 2.7.3

$ python -c 'import ssl; print ssl.OPENSSL_VERSION'
OpenSSL 1.0.0-fips 29 Mar 2010

$ which openssl 
~/.toast/armed/bin/openssl

$ toast status openssl
openssl
  version 1.0.2d: stored
    urls:
      https://www.openssl.org/source/openssl-1.0.2d.tar.gz
    build 1: armed

$ python -m synapse.app.homeserver \
> --server-name my.domain.name \
> --config-path homeserver.yaml \
> --generate-config
ERROR:root:Can't import 'OpenSSL' which is part of 'pyopenssl>=0.14'
Traceback (most recent call last):
  File "/home/tristank/venv/synapse/lib/python2.7/site-packages/synapse/python_dependencies.py", line 90, in check_requirements
    module = __import__(module_name)
      File "/home/tristank/venv/synapse/lib/python2.7/site-packages/OpenSSL/__init__.py", line 8, in <module>
    from OpenSSL import rand, crypto, SSL
  File "/home/tristank/venv/synapse/lib/python2.7/site-packages/OpenSSL/rand.py", line 11, in <module>
    from OpenSSL._util import (
  File "/home/tristank/venv/synapse/lib/python2.7/site-packages/OpenSSL/_util.py", line 6, in <module>
    from cryptography.hazmat.bindings.openssl.binding import Binding
  File "/home/tristank/venv/synapse/lib/python2.7/site-packages/cryptography/hazmat/bindings/openssl/binding.py", line 13, in <module>
    from cryptography.hazmat.bindings._openssl import ffi, lib
ImportError: libssl.so.1.0.0: cannot open shared object file: No such file or directory
Traceback (most recent call last):
  File "/package/host/localhost/python-2.7/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/package/host/localhost/python-2.7/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/home/tristank/venv/synapse/lib/python2.7/site-packages/synapse/app/homeserver.py", line 22, in <module>
    check_requirements()
  File "/home/tristank/venv/synapse/lib/python2.7/site-packages/synapse/python_dependencies.py", line 98, in check_requirements
    % (module_name, dependency)
synapse.python_dependencies.MissingRequirementError: Can't import 'OpenSSL' which is part of 'pyopenssl>=0.14'

$ pip install pyopenssl
Requirement already satisfied (use --upgrade to upgrade): pyopenssl in /home/tristank/venv/synapse/lib/python2.7/site-packages
Requirement already satisfied (use --upgrade to upgrade): six>=1.5.2 in /home/tristank/venv/synapse/lib/python2.7/site-packages (from pyopenssl)
Requirement already satisfied (use --upgrade to upgrade): cryptography>=0.7 in /home/tristank/venv/synapse/lib/python2.7/site-packages (from pyopenssl)
Requirement already satisfied (use --upgrade to upgrade): setuptools in /home/tristank/venv/synapse/lib/python2.7/site-packages (from cryptography>=0.7->pyopenssl)
Requirement already satisfied (use --upgrade to upgrade): enum34 in /home/tristank/venv/synapse/lib/python2.7/site-packages (from cryptography>=0.7->pyopenssl)
Requirement already satisfied (use --upgrade to upgrade): ipaddress in /home/tristank/venv/synapse/lib/python2.7/site-packages (from cryptography>=0.7->pyopenssl)
Requirement already satisfied (use --upgrade to upgrade): pyasn1>=0.1.8 in /home/tristank/venv/synapse/lib/python2.7/site-packages (from cryptography>=0.7->pyopenssl)
Requirement already satisfied (use --upgrade to upgrade): idna>=2.0 in /home/tristank/venv/synapse/lib/python2.7/site-packages (from cryptography>=0.7->pyopenssl)
Requirement already satisfied (use --upgrade to upgrade): cffi>=1.1.0 in /home/tristank/venv/synapse/lib/python2.7/site-packages (from cryptography>=0.7->pyopenssl)
Requirement already satisfied (use --upgrade to upgrade): pycparser in /home/tristank/venv/synapse/lib/python2.7/site-packages (from cffi>=1.1.0->cryptography>=0.7->pyopenssl)
7
  • How did you install pyopenssl? Did you use pip?
    – PM 2Ring
    Commented Oct 11, 2015 at 13:12
  • Yes, I installed it with pip.
    – tristank
    Commented Oct 11, 2015 at 15:23
  • Are you sure that you installed pyopenssl while within your virtual environment?
    – earthmeLon
    Commented Oct 11, 2015 at 18:33
  • Yes, I'm sure. See the edit.
    – tristank
    Commented Oct 11, 2015 at 20:03
  • I have this same issue, did you figure anything out? Commented Feb 17, 2016 at 18:14

0

You must log in to answer this question.

Browse other questions tagged .