Impossible to import OpenSSL module in Python
-
Hi everyone,
I'm kind of going mad on this.
I have a simple script that imports ssl from OpenSSL module:from OpenSSL import ssl
of course I installed the library via OPKG and made any kind of test and manual install you can imagine but
ImportError: No module named OpenSSL
There's no way I can load it. I'm going crazy.
Thank you guys - I hope I'm missing something really basic.
-
@tommaso-tani
Omega2+ v0.1.10-b160opkg update
opkg install python
root@Omega-5BE1:~# opkg list-installed | grep python python - 2.7.13-4 python-base - 2.7.13-4 python-codecs - 2.7.13-4 python-compiler - 2.7.13-4 python-ctypes - 2.7.13-4 python-db - 2.7.13-4 python-decimal - 2.7.13-4 python-distutils - 2.7.13-4 python-email - 2.7.13-4 python-gdbm - 2.7.13-4 python-light - 2.7.13-4 python-logging - 2.7.13-4 python-multiprocessing - 2.7.13-4 python-ncurses - 2.7.13-4 python-openssl - 2.7.13-4 python-pydoc - 2.7.13-4 python-sqlite3 - 2.7.13-4 python-unittest - 2.7.13-4 python-xml - 2.7.13-4 root@Omega-5BE1:~# python Python 2.7.13 (default, Jul 19 2017, 18:12:37) [GCC 5.4.0] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> help ('modules') Please wait a moment while I gather a list of all available modules... BaseHTTPServer audiodev imaplib select Bastion audioop imghdr sets CDROM base64 imp sgmllib CGIHTTPServer bdb importlib sha ConfigParser binascii imputil shelve Cookie binhex inspect shlex DLFCN bisect io shutil DocXMLRPCServer bsddb itertools signal HTMLParser bz2 json site IN cPickle keyword smtpd MimeWriter cProfile linecache smtplib Queue cStringIO linuxaudiodev sndhdr SimpleHTTPServer calendar locale socket SimpleXMLRPCServer cgi logging spwd SocketServer cgitb macpath sqlite3 StringIO chunk macurl2path sre TYPES cmath mailbox sre_compile UserDict cmd mailcap sre_constants UserList code markupbase sre_parse UserString codecs marshal ssl _LWPCookieJar codeop math stat _MozillaCookieJar collections md5 statvfs __builtin__ colorsys mhlib string __future__ commands mimetools stringold _abcoll compileall mimetypes stringprep _ast compiler mimify strop _bisect contextlib mmap struct _bsddb cookielib modulefinder subprocess _codecs copy multifile sunau _codecs_cn copy_reg multiprocessing sunaudio _codecs_hk crypt mutex symbol _codecs_iso2022 csv netrc symtable _codecs_jp ctypes new sys _codecs_kr curses nntplib sysconfig _codecs_tw datetime ntpath syslog _collections dbhash nturl2path tabnanny _csv dbm numbers tarfile _ctypes decimal opcode telnetlib _ctypes_test difflib operator tempfile _curses dircache optparse termios _curses_panel dis os textwrap _elementtree distutils os2emxpath this _functools doctest ossaudiodev thread _hashlib dumbdbm parser threading _heapq dummy_thread pdb time _hotshot dummy_threading pickle timeit _io email pickletools toaiff _json encodings pipes token _locale errno pkgutil tokenize _lsprof exceptions platform trace _multibytecodec fcntl plistlib traceback _multiprocessing filecmp popen2 tty _osx_support fileinput poplib types _pyio fnmatch posix unicodedata _random formatter posixfile unittest _socket fpformat posixpath urllib _sqlite3 fractions pprint urllib2 _sre ftplib profile urlparse _ssl functools pstats user _strptime future_builtins pty uu _struct gc pwd uuid _symtable gdbm py_compile warnings _sysconfigdata genericpath pyclbr wave _threading_local getopt pydoc weakref _warnings getpass pydoc_data whichdb _weakref gettext pyexpat wsgiref _weakrefset glob quopri xdrlib abc grp random xml aifc gzip re xmllib antigravity hashlib repr xmlrpclib anydbm heapq resource xxsubtype argparse hmac rexec zipfile array hotshot rfc822 zipimport ast htmlentitydefs rlcompleter zlib asynchat htmllib robotparser asyncore httplib runpy atexit ihooks sched Enter any module name to get more help. Or, type "modules spam" to search for modules whose descriptions contain the word "spam". >>> import _ssl >>>
import _ssl
Maybe this is what you want.
-
@György-Farkas said in Impossible to import OpenSSL module in Python:
Well, the point is that I'm using the Twisted module and it has# System imports from OpenSSL import SSL supported = True
The module is installed tho:
root@Omega:~# opkg list-installed | grep python python - 2.7.13-6 python-base - 2.7.13-4 python-cffi - 1.8.3-1 python-codecs - 2.7.13-6 python-compiler - 2.7.13-4 python-crypto - 2.6.1-1 python-ctypes - 2.7.13-4 python-db - 2.7.13-4 python-decimal - 2.7.13-4 python-distutils - 2.7.13-4 python-email - 2.7.13-6 python-gdbm - 2.7.13-4 python-light - 2.7.13-4 python-logging - 2.7.13-6 python-multiprocessing - 2.7.13-4 python-ncurses - 2.7.13-4 python-openssl - 2.7.13-6 python-ply - 3.9-1 python-pycparser - 2.14-3 python-pydoc - 2.7.13-4 python-sqlite3 - 2.7.13-4 python-unittest - 2.7.13-4 python-xml - 2.7.13-4 root@Omega:~# opkg files python-openssl Package python-openssl (2.7.13-6) is installed on root and has the following files: /usr/lib/python2.7/lib-dynload/_hashlib.so /usr/lib/python2.7/lib-dynload/_ssl.so
Still haven't find a way to fix it, damn.
-
Moreover, I run into another funny paradox. I suspect I need to install python-pyopenssl in order to have to right module but opkg is not on my side with this:
root@Omega:/etc/opkg# opkg list | grep -i python-pyopenssl python-pyopenssl - 17.2.0-1 root@Omega:/etc/opkg# opkg info python-pyopenssl Package: python-pyopenssl Version: 17.2.0-1 Depends: libc, python-light, python-cryptography, python-six Status: install user not-installed Architecture: mipsel_24kc
So, it is listed. Good. an
opkg update
just to be sure, but then:root@Omega:/etc/opkg# opkg install python-pyopenssl Installing python-pyopenssl (17.2.0-1) to root... Collected errors: * opkg_download_pkg: Package python-pyopenssl is not available from any configured src. * opkg_install_pkg: Failed to download python-pyopenssl. Perhaps you need to run 'opkg update'? * opkg_install_cmd: Cannot install package python-pyopenssl.
-
@tommaso-tani
Sorry, I can't follow you. Unfortunately I don't know the Twisted framework.
So - most probably - I can't solve your problem. I can only show what is the situation on my Omega2+ (v0.1.10-b160) now.
Hope this helps (a little ;-).I enabled the lede 'packages' repo too - earlier it was disabled.
root@Omega-5BE1:~# cat /etc/opkg/distfeeds.conf #src/gz reboot_core http://downloads.lede-project.org/snapshots/targets/ramips/mt7688/packages #src/gz reboot_base http://downloads.lede-project.org/snapshots/packages/mipsel_24kc/base #src/gz reboot_onion http://downloads.lede-project.org/snapshots/packages/mipsel_24kc/onion ## src/gz reboot_luci http://downloads.lede-project.org/snapshots/packages/mipsel_24kc/luci src/gz reboot_packages http://downloads.lede-project.org/snapshots/packages/mipsel_24kc/packages ## src/gz reboot_routing http://downloads.lede-project.org/snapshots/packages/mipsel_24kc/routing ## src/gz reboot_telephony http://downloads.lede-project.org/snapshots/packages/mipsel_24kc/telephony src/gz omega2_core http://repo.onion.io/omega2/packages/core src/gz omega2_base http://repo.onion.io/omega2/packages/base src/gz omega2_packages http://repo.onion.io/omega2/packages/packages src/gz omega2_onion http://repo.onion.io/omega2/packages/onion root@Omega-5BE1:~# opkg update Downloading http://downloads.lede-project.org/snapshots/packages/mipsel_24kc/packages/Packages.gz Updated list of available packages in /var/opkg-lists/reboot_packages Downloading http://downloads.lede-project.org/snapshots/packages/mipsel_24kc/packages/Packages.sig Signature check passed. Downloading http://repo.onion.io/omega2/packages/core/Packages.gz Updated list of available packages in /var/opkg-lists/omega2_core Downloading http://repo.onion.io/omega2/packages/core/Packages.sig Signature check passed. Downloading http://repo.onion.io/omega2/packages/base/Packages.gz Updated list of available packages in /var/opkg-lists/omega2_base Downloading http://repo.onion.io/omega2/packages/base/Packages.sig Signature check passed. Downloading http://repo.onion.io/omega2/packages/packages/Packages.gz Updated list of available packages in /var/opkg-lists/omega2_packages Downloading http://repo.onion.io/omega2/packages/packages/Packages.sig Signature check passed. Downloading http://repo.onion.io/omega2/packages/onion/Packages.gz Updated list of available packages in /var/opkg-lists/omega2_onion Downloading http://repo.onion.io/omega2/packages/onion/Packages.sig Signature check passed. root@Omega-5BE1:~# opkg install python-pyopenssl Installing python-pyopenssl (17.2.0-1) to root... Downloading http://downloads.lede-project.org/snapshots/packages/mipsel_24kc/packages/python-pyopenssl_17.2.0-1_mipsel_24kc.ipk Installing python-cryptography (2.0.3-1) to root... Downloading http://downloads.lede-project.org/snapshots/packages/mipsel_24kc/packages/python-cryptography_2.0.3-1_mipsel_24kc.ipk Installing python-cffi (1.8.3-1) to root... Downloading http://repo.onion.io/omega2/packages/packages/python-cffi_1.8.3-1_mipsel_24kc.ipk Installing python-pycparser (2.17-1) to root... Downloading http://downloads.lede-project.org/snapshots/packages/mipsel_24kc/packages/python-pycparser_2.17-1_mipsel_24kc.ipk Installing python-ply (3.10-1) to root... Downloading http://downloads.lede-project.org/snapshots/packages/mipsel_24kc/packages/python-ply_3.10-1_mipsel_24kc.ipk Installing python-enum34 (1.1.6-2) to root... Downloading http://repo.onion.io/omega2/packages/packages/python-enum34_1.1.6-2_mipsel_24kc.ipk Installing python-idna (2.5-1) to root... Downloading http://downloads.lede-project.org/snapshots/packages/mipsel_24kc/packages/python-idna_2.5-1_mipsel_24kc.ipk Installing python-ipaddress (1.0.17-1) to root... Downloading http://repo.onion.io/omega2/packages/packages/python-ipaddress_1.0.17-1_mipsel_24kc.ipk Installing python-asn1crypto (0.22.0-1) to root... Downloading http://downloads.lede-project.org/snapshots/packages/mipsel_24kc/packages/python-asn1crypto_0.22.0-1_mipsel_24kc.ipk Installing python-six (1.10.0-4) to root... Downloading http://downloads.lede-project.org/snapshots/packages/mipsel_24kc/packages/python-six_1.10.0-4_mipsel_24kc.ipk Configuring python-idna. Configuring python-ply. Configuring python-six. Configuring python-pycparser. Configuring python-cffi. Configuring python-enum34. Configuring python-ipaddress. Configuring python-asn1crypto. Configuring python-cryptography. Configuring python-pyopenssl. root@Omega-5BE1:~# opkg list-installed | grep python python - 2.7.13-4 python-asn1crypto - 0.22.0-1 python-base - 2.7.13-4 python-cffi - 1.8.3-1 python-codecs - 2.7.13-4 python-compiler - 2.7.13-4 python-cryptography - 2.0.3-1 python-ctypes - 2.7.13-4 python-db - 2.7.13-4 python-decimal - 2.7.13-4 python-distutils - 2.7.13-4 python-email - 2.7.13-4 python-enum34 - 1.1.6-2 python-gdbm - 2.7.13-4 python-idna - 2.5-1 python-ipaddress - 1.0.17-1 python-light - 2.7.13-4 python-logging - 2.7.13-4 python-multiprocessing - 2.7.13-4 python-ncurses - 2.7.13-4 python-openssl - 2.7.13-4 python-ply - 3.10-1 python-pycparser - 2.17-1 python-pydoc - 2.7.13-4 python-pyopenssl - 17.2.0-1 python-six - 1.10.0-4 python-sqlite3 - 2.7.13-4 python-unittest - 2.7.13-4 python-xml - 2.7.13-4
Good luck!
-
So, apparently I solved the issue with the opkg (didn't update, I downloaded the .ipk package from the repo and installed manually).
I solved the OpenSSL, now I'm struggling with another module (Twisted). LOLThank you so much anyway!