I'm trying to use PYTHONPATH to let Python know where my library is located, but it seems to ignore it:
$ PYTHONPATH=/home/osqa/EC2/backup/src/boto/
$ ls /home/osqa/EC2/backup/src/boto/boto/ec2/connection.py
/home/osqa/EC2/backup/src/boto/boto/ec2/connection.py
$ python backup.py
Traceback (most recent call last):
File "backup.py", line 4, in <module>
from boto.ec2.connection import EC2Connection
ImportError: No module named boto.ec2.connection
Try
export PYTHONPATH=/home/osqa/EC2/backup/src/
instead, i.e. use export and remove the last path component.
Related
I am attempting to install exchangelib on a Mac (OS X 10.13.5). I was having issues with the install, so I created a minimal environment in which to work:
pushd /tmp
curl -SLO https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh
bash ./Miniconda3-latest-MacOSX-x86_64.sh -b -p /tmp/lxml
source /tmp/lxml/bin/activate
conda create -n py35 python=3.5 lxml -y
source activate py35
I then installed exchangelib within that environment. When I attempt to use it, though, I find that it's trying to load winkerberos instead of pykerberos.
>>> import exchangelib
Traceback (most recent call last):
File "/tmp/lxml/envs/py35/lib/python3.5/site-packages/requests_kerberos/kerberos_.py", line 2, in <module>
import kerberos
ImportError: dlopen(/tmp/lxml/envs/py35/lib/python3.5/site-packages/kerberos.cpython-35m-darwin.so, 2): Symbol not found: _mempcpy
Referenced from: /tmp/lxml/envs/py35/lib/python3.5/site-packages/kerberos.cpython-35m-darwin.so
Expected in: flat namespace
in /tmp/lxml/envs/py35/lib/python3.5/site-packages/kerberos.cpython-35m-darwin.so
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/tmp/lxml/envs/py35/lib/python3.5/site-packages/exchangelib/__init__.py", line 4, in <module>
from .account import Account
File "/tmp/lxml/envs/py35/lib/python3.5/site-packages/exchangelib/account.py", line 12, in <module>
from exchangelib.services import GetUserOofSettings, SetUserOofSettings
File "/tmp/lxml/envs/py35/lib/python3.5/site-packages/exchangelib/services.py", line 37, in <module>
from .transport import wrap, extra_headers, SOAPNS, TNS, MNS, ENS
File "/tmp/lxml/envs/py35/lib/python3.5/site-packages/exchangelib/transport.py", line 9, in <module>
import requests_kerberos
File "/tmp/lxml/envs/py35/lib/python3.5/site-packages/requests_kerberos/__init__.py", line 17, in <module>
from .kerberos_ import HTTPKerberosAuth, REQUIRED, OPTIONAL, DISABLED
File "/tmp/lxml/envs/py35/lib/python3.5/site-packages/requests_kerberos/kerberos_.py", line 4, in <module>
import winkerberos as kerberos
ImportError: No module named 'winkerberos'
>>>
I'm kind of at a loss here. Any ideas how to get the install to not look for winkerberos?
It looks like it is trying to load pykerberos first, which fails with a library issue (Symbol not found: _mempcpy) and as a fallback tries to load winkerberos, which it does not find. This should start working as soon as you can make the pykerberos on your system work.
I'm using Anaconda3 version 4.2.0 on ubuntu (in docker).
Anaconda is installed in /root/anaconda3 folder.
I installed theano_bpr package using pip install theano_bpr.
Now when i open python and try import theano_bpr, i get the following message:
>>> import theano_bpr
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/root/anaconda3/lib/python3.5/site-packages/theano_bpr/__init__.py", line 17, in <module>
from bpr import BPR
ImportError: No module named 'bpr'
However, when i navigate to /root/anaconda3/lib/python3.5/site-packages/theano_bpr/ and run python there, i'm able to import theano_bpr.
In /root/anaconda3/lib/python3.5/site-packages/theano_bpr/ there are following files:
__init__.py, bpr.py (this one is causing problems), t.py, and utils.py.
I install a python2.7.6 locally, and there is another 2.7.6 installed on cluster publicly.
Then I use my local python to install a pip but when I 'pip list', it returns:
$ pip list Traceback (most recent call last): File
"/home/zengh/.local/bin/pip", line 7, in
from pip import main File "/home/zengh/.local/lib/python2.7/site-packages/pip/init.py", line
13, in
from pip.utils import get_installed_distributions, get_prog File "/home/zengh/.local/lib/python2.7/site-packages/pip/utils/init.py",
line 5, in
import locale File "/home/software/rhel6/python/2.7.6/lib/python2.7/locale.py", line 18,
in
import operator ImportError: /home/software/rhel6/python/2.7.6/lib/python2.7/lib-dynload/operator.so:
undefined symbol: _PyUnicodeUCS2_AsDefaultEncodedString
Obviously it calls the locale.py on the cluster while my PYTHONPATH only contains my local python's path. How can I make it call the
/.local/python2.7.6/lib/python2.7/locale.py?
Thanks
Depends on whether you want to set it from within a script or from os.
From script:
import sys
sys.path.append('additional dir')
From os:
export PYTHONPATH=somewhere
I have installed libsvm-3.12 and placed into:
/home/ubuntu/libsvm-3.12
In my pythonpath I have the following:
echo $PYTHONPATH
/home/ubuntu/libsvm-3.12/python:/home/ubuntu/libsvm-3.12:$PYTHONPATH
This is in both .bashrc in home and in /etc/enviroments
I rebooted the machine.
From python I get:
>>> import svmulti
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named svmulti
How do I let python know where the lib is?
Given installation via make in .../libsvm-3.12/python,I think you also want:
>>> import svmutil
not:
>>> import svmulti
I am encountering these errors frequently when I install python libraries and I'm wondering what I am doing wrong
the current example is the libchromaprint library
http://acoustid.org/chromaprint
I install it and everything, try to run the python example, get:
Traceback (most recent call last):
File "examples/fpwav.py", line 7, in <module>
import chromaprint
File "build/bdist.linux-x86_64/egg/chromaprint/__init__.py", line 24, in <module>
ImportError: couldn't find libchromaprint
and then when I check:
find /usr/local/lib/libch*
/usr/local/lib/libchromaprint.so
/usr/local/lib/libchromaprint.so.0
/usr/local/lib/libchromaprint.so.0.1.3
what am I doing wrong?
Python does not use your usual library path. The chromaprint you're looking for should be somewhere like /usr/lib/pymodules/python2.6.
From the python interpreter do:
>>> import sys
>>> sys.path
This will show you the directories python searches for a module.