O Python não pode importar o OpenSSL

1

Eu criei um env virtual para uma instalação do servidor de matriz em um hoster compartilhado .

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

Instalei todas as dependências necessárias e iniciei o servidor, mas por algum motivo o Python não reconhecerá o Openssl. Por que isso e como eu faço o Python pegar o 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)
    
por tristank 11.10.2015 / 12:59

0 respostas