Bug 1471360

Summary: AttributeError: 'module' object has no attribute 'Cryptography_HAS_SSL_ST'
Product: [Fedora] Fedora Reporter: Marcin Juszkiewicz <mjuszkie>
Component: pyOpenSSLAssignee: Tomas Mraz <tmraz>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 26CC: jlieskov, mcepl, mcepl, mjuszkie, tmraz
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-07-17 16:37:46 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Marcin Juszkiewicz 2017-07-15 09:19:10 UTC
Description of problem:

I can not run virt-manager under Fedora 26.


Version-Release number of selected component (if applicable):

python2-pyOpenSSL-16.2.0-4.fc26.noarch

How reproducible:

always

Steps to Reproduce:
1. dnf install virt-manager
2. virt-manager


Actual results:

11:11 hrw@puchatek:tv$ virt-manager 
Traceback (most recent call last):
  File "/usr/share/virt-manager/virt-manager", line 33, in <module>
    from virtinst import util as util
  File "/usr/share/virt-manager/virtinst/__init__.py", line 89, in <module>
    from virtinst.distroinstaller import DistroInstaller
  File "/usr/share/virt-manager/virtinst/distroinstaller.py", line 23, in <module>
    from . import urlfetcher
  File "/usr/share/virt-manager/virtinst/urlfetcher.py", line 34, in <module>
    import requests
  File "/usr/lib/python2.7/site-packages/requests/__init__.py", line 52, in <module>
    from .packages.urllib3.contrib import pyopenssl
  File "/usr/lib/python2.7/site-packages/requests/packages/urllib3/contrib/pyopenssl.py", line 46, in <module>
    import OpenSSL.SSL
  File "/usr/lib/python2.7/site-packages/OpenSSL/__init__.py", line 8, in <module>
    from OpenSSL import rand, crypto, SSL
  File "/usr/lib/python2.7/site-packages/OpenSSL/SSL.py", line 112, in <module>
    if _lib.Cryptography_HAS_SSL_ST:
AttributeError: 'module' object has no attribute 'Cryptography_HAS_SSL_ST'


Expected results:

virt-manager runs

Additional info:

11:13 hrw@puchatek:tv$ rpm -qf /usr/lib/python2.7/site-packages/OpenSSL/SSL.py
python2-pyOpenSSL-16.2.0-4.fc26.noarch

Comment 1 Tomas Mraz 2017-07-17 08:51:05 UTC
Can you please try packages from https://koji.fedoraproject.org/koji/buildinfo?buildID=919273 if they solve your problem?

Comment 2 Marcin Juszkiewicz 2017-07-17 12:06:07 UTC
Same issue ;(


14:04 hrw@puchatek:~$ virt-manager
Traceback (most recent call last):
  File "/usr/share/virt-manager/virt-manager", line 33, in <module>
    from virtinst import util as util
  File "/usr/share/virt-manager/virtinst/__init__.py", line 89, in <module>
    from virtinst.distroinstaller import DistroInstaller
  File "/usr/share/virt-manager/virtinst/distroinstaller.py", line 23, in <module>
    from . import urlfetcher
  File "/usr/share/virt-manager/virtinst/urlfetcher.py", line 34, in <module>
    import requests
  File "/usr/lib/python2.7/site-packages/requests/__init__.py", line 52, in <module>
    from .packages.urllib3.contrib import pyopenssl
  File "/usr/lib/python2.7/site-packages/requests/packages/urllib3/contrib/pyopenssl.py", line 46, in <module>
    import OpenSSL.SSL
  File "/usr/lib/python2.7/site-packages/OpenSSL/__init__.py", line 8, in <module>
    from OpenSSL import rand, crypto, SSL
  File "/usr/lib/python2.7/site-packages/OpenSSL/SSL.py", line 115, in <module>
    if _lib.Cryptography_HAS_SSL_ST:
AttributeError: 'module' object has no attribute 'Cryptography_HAS_SSL_ST'

14:05 hrw@puchatek:~$ rpm -qf /usr/lib/python2.7/site-packages/OpenSSL/SSL.py
python2-pyOpenSSL-17.1.0-1.fc26.noarch

Comment 3 Tomas Mraz 2017-07-17 13:19:18 UTC
What is your installed python-cryptography version?
Do you have the current package installed?

Comment 4 Marcin Juszkiewicz 2017-07-17 15:07:12 UTC
17:06 root@puchatek:hrw# LANGUAGE=C dnf list python*crypto* python*ssl*
Last metadata expiration check: 0:00:34 ago on pon, 17 lip 2017, 17:06:10.
Installed Packages
python-backports-ssl_match_hostname.noarch    3.5.0.1-4.fc26       @fedora      
python2-crypto.x86_64                         2.6.1-14.fc26        @fedora      
python2-cryptography.x86_64                   1.7.2-1.fc26         @fedora      
python2-passlib.noarch                        1.7.0-4.fc26         @fedora      
python2-pyOpenSSL.noarch                      17.1.0-1.fc26        @@commandline
python3-cryptography.x86_64                   1.7.2-1.fc26         @fedora      
python3-pyOpenSSL.noarch                      17.1.0-1.fc26        @@commandline
Available Packages
python-cryptominisat4.x86_64                  4.5.3-8.fc26         fedora       
python-jwcrypto.noarch                        0.3.2-3.fc26         fedora       
python-rsslib.noarch                          0-8.20130310.fc26    fedora       
python2-cryptography-vectors.noarch           1.7.2-1.fc26         fedora       
python2-zope-processlifetime.noarch           2.1.0-3.fc26         fedora       
python3-crypto.x86_64                         2.6.1-14.fc26        fedora       
python3-cryptography-vectors.noarch           1.7.2-1.fc26         fedora       
python3-jwcrypto.noarch                       0.3.2-3.fc26         fedora       
python3-passlib.noarch                        1.7.0-4.fc26         fedora       
python3-zope-processlifetime.noarch           2.1.0-3.fc26         fedora

Comment 5 Tomas Mraz 2017-07-17 16:12:29 UTC
This is really strange - I cannot reproduce the problem with these packages here.

It looks like you have some third party copy of old version of python-cryptography present or something like that.

Can you reproduce the problem if you run
 python -c 'import requests'

Comment 6 Marcin Juszkiewicz 2017-07-17 16:37:46 UTC
18:34 hrw@puchatek:~$ python -c 'import requests'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python2.7/site-packages/requests/__init__.py", line 52, in <module>
    from .packages.urllib3.contrib import pyopenssl
  File "/usr/lib/python2.7/site-packages/requests/packages/urllib3/contrib/pyopenssl.py", line 46, in <module>
    import OpenSSL.SSL
  File "/usr/lib/python2.7/site-packages/OpenSSL/__init__.py", line 8, in <module>
    from OpenSSL import rand, crypto, SSL
  File "/usr/lib/python2.7/site-packages/OpenSSL/SSL.py", line 115, in <module>
    if _lib.Cryptography_HAS_SSL_ST:
AttributeError: 'module' object has no attribute 'Cryptography_HAS_SSL_ST'
18:35 hrw@puchatek:~$ sudo python -c 'import requests'
18:35 hrw@puchatek:~$ 

Looks like local issue. 

some minutes later after strace session...

rm -rf ~/.local/lib/python2.7/

works now.