Error while importing LXML - python-2.7

I was importing "from docx import Document".
This gave an error
File "", line 1, in File
"/usr/local/lib/python2.7/site-packages/docx.py", line 17, in
from lxml import etree ImportError: /usr/local/lib/python2.7/site-packages/lxml-3.7.0-py2.7-linux-i686.egg/lxml/etree.so:
undefined symbol: gcry_check_version
Same error I am getting while trying to install lxml.
Python Version: 2.7, OS: CentOS release 5.8

Libcrypt Issue
Try:
LD_PRELOAD=/usr/lib/libgcrypt.so
export LD_PRELOAD
This should fix it

Related

how to install numba and link to llvm & llvmlite to import it in Python27

When I am trying to run python file .py that uses numba it gives me the below error
Traceback (most recent call last):
File "C:\Myfile.py", line 16, in <module>
import myfile2 as m
File "C:\myfile2.py", line 8, in <module>
import numba
File "C:\Python27\lib\site-packages\numba\__init__.py", line 9, in <module>
from . import config, errors, runtests, types
File "C:\Python27\lib\site-packages\numba\config.py", line 11, in <module>
import llvmlite.binding as ll
File "C:\Python27\lib\site-packages\llvmlite\binding\__init__.py", line 6, in <module>
from .dylib import *
File "C:\Python27\lib\site-packages\llvmlite\binding\dylib.py", line 4, in <module>
from . import ffi
File "C:\Python27\lib\site-packages\llvmlite\binding\ffi.py", line 50, in <module>
raise e
WindowsError: [Error 126] The specified module could not be found
I've tried to isntall numba from command propmt as below :
pip install numba
but it gives me a message that it already exists before
Requirements already satisfied...........etc
so could anyone help me to fix this error ? also How to install numba and link it with llvm and llvmlite ?
I've uninstall the python and re-install it again
and install the below packages in order
pip install scikit_learn
pip install numby+mkl
pip install scipy
pip install numba
pip install matplotlib
also I've installed mini conda and it is working fine as well

undefined symbol: _ZTVN10__cxxabiv117__class_type_infoE when importing sklearn

After successfully installing /illumina/thirdparty/python/python-2.7.5/bin/pip2.7 install -U scikit-learn I have problems launching regression analysis.
from sklearn import linear_model gives
File "/illumina/thirdparty/python/python-2.7.5/lib/python2.7/site-packages/sklearn/linear_model/__init__.py", line 25, in <module>
from .logistic import (LogisticRegression, LogisticRegressionCV,
File "/illumina/thirdparty/python/python-2.7.5/lib/python2.7/site-packages/sklearn/linear_model/logistic.py", line 23, in <module>
from ..svm.base import _fit_liblinear
File "/illumina/thirdparty/python/python-2.7.5/lib/python2.7/site-packages/sklearn/svm/__init__.py", line 13, in <module>
from .classes import SVC, NuSVC, SVR, NuSVR, OneClassSVM, LinearSVC, \
File "/illumina/thirdparty/python/python-2.7.5/lib/python2.7/site-packages/sklearn/svm/classes.py", line 4, in <module>
from .base import _fit_liblinear, BaseSVC, BaseLibSVM
File "/illumina/thirdparty/python/python-2.7.5/lib/python2.7/site-packages/sklearn/svm/base.py", line 8, in <module>
from . import libsvm, liblinear
ImportError: /illumina/thirdparty/python/python-2.7.5/lib/python2.7/site-packages/sklearn/svm/libsvm.so: undefined symbol: _ZTVN10__cxxabiv117__class_type_inf
Seems like the issue is with libsvm as from sklearn import datasets works well.
Any suggestions will be most appreciated.
Environment:
Python 2.7.5
GCC 4.1.2 20080704 (Red Hat 4.1.2-44)
scipy 0.16.0
numpy 1.9.1
This is clearly an ABI mismatch. You probably are involuntarily using a python module that is linked against a native library that should be of a different version. Make sure there's only one libsvm to be found by your system when you run python.
Try to uninstall sklearn first.
apt-get remove sklearn
Delete previous sklearn directory created in packages folder
Install again
apt-get install python-sklearn

(Scikit - Python) ImportError: No module named scipy

I'm trying to install Scikit and run a python file that only has:
import sklearn
To check if Scikit works. This is the error I get:
Traceback (most recent call last):
File "hello-world.py", line 1, in
import sklearn
File "/Library/Python/2.7/site-packages/sklearn/init.py", line 57, in
from .base import clone
File "/Library/Python/2.7/site-packages/sklearn/base.py", line 9, in
from scipy import sparse
ImportError: No module named scipy
I have been at this for hours now. My python version is Python 2.7.11
which -a python
gives me this:
/usr/local/bin/python
/usr/bin/python
/Library/Frameworks/Python.framework/Versions/2.7/bin/python
/Users/Iliad/anaconda/bin/python
I had had Python 3.5 Installed before, but downloaded Anaconda for 2.7, but can't make sure it is set to work with that version.
Thanks!
I will start with
python --version
Just to be sure
and then in python repl. Use this
import site
site.getsitepackages()
This would give you something like :
['/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages']
Check in all the dist-packages for scipy. My guess is that it is not there.
If you have any other "dist-packages" type of folder then you should add that to your PYTHONPATH.

Pyside Import Error "No Module named Ctypes"

Im pretty new to working with this side of python so pardon me if I'm a bit off kilter.
I am trying to incorporate PySide into Cryengine's Python 2.7.5 Integration; I used PIP to install the Site - Package to Cryengines Python Directory using the pip install PySide.whl -t CRYENGINE/Editor/Python/Lib/Site - Package command through command prompt.
Here is the script I am trying to run in the Python Shell Of CryEngine:
import sys
import site
site.ENABLE_USER_SITE
print site.USER_BASE
site.addsitedir("F:\SteamLibrary\steamapps\common\CRYENGINE\Editor\Python\Lib\site-packages\PySide")
from PySide import QtGui
app = QtGui.QApplication(sys.argv)
wid = QtGui.QWidget()
wid.resize(250, 150)
wid.setWindowTitle('Simple')
wid.show()
sys.exit(app.exec_())
I get the following error in the Python script terminal:
] from PySide import QtGui
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Python27\lib\site-packages\PySide\__init__.py", line 41, in <module>
_setupQtDirectories()
File "C:\Python27\lib\site-packages\PySide\__init__.py", line 9, in _setupQtDirectories
from . import _utils
File "C:\Python27\lib\site-packages\PySide\_utils.py", line 31, in <module>
import ctypes
ImportError: No module named ctypes
I used pip to install the PySide wheel files. So its really weird that I am getting this error. I double checked the files that ctypes uses are there, and in the Python 2.7 installation. And all of them are there. I tested this using Python Shell, and it works great! But for some reason when I run it through CryEngine's python 2.7.5 integration even though the file path is to C:\Python27 where all of those file Ctypes files are!
I am almost sure that I am oversimplifying the problem, but I'm not sure where to start getting this problem solved. I want to get this working so I can build an integration that will work for the whole CryEngine Community. I've looked all over the place for a solution, but am really at the end of my rope here.
Any help would be greatly appreciated!!

Upgrade to Python 2.7.10: Target WSGI script cannot be loaded as Python module

When I upgrade Python from 2.7.9 to 2.7.10 with anaconda, I get the following error in my apache2 log and my websites don't work any more.
mod_wsgi (pid=608): Target WSGI script '/www/wsgi_scripts/django_myproject.wsgi' cannot be loaded as Python module.
Exception occurred processing WSGI script '/www/wsgi_scripts/django_myproject.wsgi'.
Traceback (most recent call last):
File "/www/wsgi_scripts/django_myproject.wsgi", line 8, in <module>
import django.core.handlers.wsgi
File "/Users/xnx/anaconda/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 6, in <module>
from io import BytesIO
File "/Users/xnx/anaconda/lib/python2.7/io.py", line 51, in <module>
import _io
ImportError: dlopen(/Users/xnx/anaconda/lib/python2.7/lib-dynload/_io.so, 2): Symbol not found: __PyErr_ReplaceException
Referenced from: /Users/xnx/anaconda/lib/python2.7/lib-dynload/_io.so
Expected in: dynamic lookup
I expect this is some kind of mismatch in package library versions, but does anyone know which one?
Double check your PYTHONPATH if it's correct (you don't override it anywhere in your startup files).
Otherwise you may consider downgrading your Python from 2.7.10 to 2.7.9.
For example (as suggested in here):
conda install python=2.7.9
or when using Homebrew try:
brew switch python 2.7.9
as it could be some particular problem with 2.7.10.
Alternatively use Python 3.x instead.
My suspicion is that this is a problem with Anaconda as I've just hit the same problem. I've reported an issue here: https://github.com/conda/conda/issues/1367
update:
The conda guys have now released a fixed virtualenv package that no longer has this problem.