Unable to import ssl on linux - python

When I try to import ssl on any Python version I get
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.5/ssl.py", line 98, in <module>
import _ssl # if we can't import it, let the error propagate
ImportError: /lib/x86_64-linux-gnu/libssl.so.1.0.0: symbol X509_chain_up_ref, version
OPENSSL_1.0.2 not defined in file libcrypto.so.1.0.0 with link time reference
I have compiled Python 3.5 myself with libssl-dev version 1.0.2. According to aptitude I have libssl1.0.0.0 version 1.0.2 and openssl version 1.0.2 installed.
It seems to be a problem with the different version of libssl, openssl and libssl-dev but I have installed an reinstalled the newest version of all of them via the Package manager.
Im using Ubuntu 15.10 64-bit

Related

How to resolve openssl not found error while installing new Python version with Pyenv on M1 Mac OS Ventura 13.1?

The system is M1 processor on MacOS Ventura 13.1. While installing a new version with pyenv, it throws following error regarding openssl not found on the system. openssl is already installed with the version number LibreSSL 3.3.6
Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'readline'
WARNING: The Python readline extension was not compiled. Missing the GNU readline lib?
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Users/divyesh.parmar#postman.com/.pyenv/versions/3.10.6/lib/python3.10/ssl.py", line 99, in <module>
import _ssl # if we can't import it, let the error propagate
ModuleNotFoundError: No module named '_ssl'
ERROR: The Python ssl extension was not compiled. Missing the OpenSSL lib?
I've mostly tried approaches mentioned on this thread, but none of that seems to lead to anywhere. How to resolve this?
After looking at several Github threads on Pyenv project, one of the simplest method worked like a charm.
# Providing an incorrect openssl version forces a proper openssl version to be downloaded and linked during the build
export PYTHON_BUILD_HOMEBREW_OPENSSL_FORMULA=openssl#1.0
After setting this, upon running the command to install any version, it will automatically download and link the required version of openssl
Reference : https://github.com/pyenv/pyenv/issues/1768#issuecomment-1423144852
You can use a higher version of openssl with :
export CONFIGURE_OPTS="--with-openssl=$(brew --prefix openssl)"

ModuleNotFoundError: No module named 'msgpack', but msgpack is already installed

I'm on Windows using PowerShell and I'm trying to run a python script that calls another script that imports msgpack. My msgpack version is 1.0.2.
> python3 .\testing.py
Traceback (most recent call last):
File "C:\<path>\testing.py", line 1, in <module>
import b0RemoteApi
File "C:\<path>\b0RemoteApi.py", line 7, in <module>
import msgpack
ModuleNotFoundError: No module named 'msgpack'
I solved the issue. For anyone else who had this problem, I had two versions of Python installed, 3.8 and 3.9. msgpack was installed in the 3.8 directory and PowerShell was using Python 3.9, so I uninstalled the older version and reinstalled msgpack.

Cannot import numpy in pypy3 (installs fine with pip)

Been trying to install numpy on pypy3 with pip. The install works fine, but when I do import numpy, I get the following error. Anyone have any advice?
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/carl/pypy3-v6.0.0-linux64/site-packages/numpy/__init__.py", line 142, in <module>
from . import core
File "/home/carl/pypy3-v6.0.0-linux64/site-packages/numpy/core/__init__.py", line 16, in <module>
from . import multiarray
File "/home/carl/pypy3-v6.0.0-linux64/site-packages/numpy/core/multiarray.py", line 44, in <module>
arange.__module__ = 'numpy'
AttributeError: readonly attribute '__module__'
Using the latest pypy3 versions from the site on Ubuntu
Python 3.5.3 (fdd60ed87e94, Apr 24 2018, 06:10:04)
[PyPy 6.0.0 with GCC 6.2.0 20160901] on linux
Latest pip too
pip 18.1 from /home/carl/pypy3-v6.0.0-linux64/site-packages/pip (python 3.5)
numpy 1.16.0 is incompatible with pypy3 v6.0, more details here. The solution is to use either numpy 1.15.4, or to use a pypy3 nightly while waiting for the next release.

How to import PyCrypto inside App Engine development server (OS X)?

My app.yaml include this lines:
libraries:
- name: pycrypto
version: "2.6"
I have the correct version of PyCrypto:
$ python
>>> import Crypto
>>> Crypto.__version__
'2.6'
But when I try evaluate import Crypto in GAE Development SDK interactive console, I get this:
Traceback (most recent call last):
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/devappserver2/python/request_handler.py", line 225, in handle_interactive_request
exec(compiled_code, self._command_globals)
File "<string>", line 12, in <module>
ImportError: No module named Crypto
Because pycrypto includes native compiled code, you need to install that yourself for your Python installation. Assuming you have pip installed:
pip install pycrypto

Installing PySide on OSX 10.6.8

Trying to get my feet wet with PySide development but having trouble
getting setup. I tried installing the binaries 1.0.4-r1 and 1.0.5 but
both of those produced the following message on import PySide
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Python/2.6/site-packages/PySide/__init__.py", line 2,
in <module>
import private
File "/Library/Python/2.6/site-packages/PySide/private.py", line 2,
in <module>
from QtCore import __moduleShutdown
ImportError: dlopen(/Library/Python/2.6/site-packages/PySide/
QtCore.so, 2): Library not loaded: QtCore.framework/Versions/4/QtCore
Referenced from: /Library/Python/2.6/site-packages/PySide/QtCore.so
Reason: image not found
Then I tried doing the install from the gitorious build scripts. Using
sudo ./dependencies.osx.sh. After that completed I now get the
following error on import PySide.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Python/2.6/site-packages/PySide/__init__.py", line 2,
in <module>
File "/Library/Python/2.6/site-packages/PySide/private.py", line 2,
in <module>
ImportError: No module named QtCore
Any advice is appreciated. I'm using QtCreator 2.2.1 and Qt SDK
1.1.2 / Qt Library 4.7.3. Thank you!
Try to install latest version MacPorts and python 2.7 first and set python2.7 as default python version:
sudo port install python27
port select --list python
sudo port select --set python python27
then re-install PySide again:
sudo port install py27-pyside
I just encountered exactly the same problem:
Library not loaded: QtCore.framework/Versions/4/QtCore
You need to find installed QT libraries and make them visible to the dynamic linker.
My Qt*.framework folders live in /usr/local/lib (Qt is installed with Homebrew package manager). So, I added
export DYLD_FRAMEWORK_PATH=/usr/local/lib:$DYLD_FRAMEWORK_PATH
to ~/.bash_profile and restarted the console.
That's it.
I just solved the same problem by using homebrew to install pyside.
$ sudo -H pip uninstall pyside
$ brew install pyside

Categories

Resources