python, libsvn and cant file python imports - python

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

Related

How to reinstall or fix Python interpreter for XCode lldb?

I got this message at XCode after deleting some system files.
(lldb) script
Traceback (most recent call last):
File "<string>", line 1, in <module>
NameError: name 'run_python_interpreter' is not defined
P.S. Had to reinstall XCode, but I've got same message at debugger after reinstalling IDE
Terminal output
$ lldb
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "/usr/local/Cellar/python#2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/copy.py", line 52, in <module>
import weakref
File "/usr/local/Cellar/python#2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/weakref.py", line 14, in <module>
from _weakref import (
ImportError: cannot import name _remove_dead_weakref
You have a local installation of python on your computer (in /usr/local/Cellar). There's a problem when you have two different pythons on your system; lldb links against /System/Library/Frameworks/Python.framework but that python somehow ends up using the python libraries from your installed copy instead. I saw someone work around this once but I forget if it was by putting their local python last in $PATH or if they un-set their $PYTHONPATH before starting lldb.

Can't find submodule in package

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.

ImportError: couldn't find library

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.

Problem using PYTHONPATH

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.

activestate pythonwin missing import modules?

I'm working my way through DiveIntoPython.com and I'm having trouble getting the import to work. I've installed ActiveState's Pythonwin on a windows xp prof environment.
In the website, there is an exercise which involves 'import odbchelper' and odbchelper.name
http://www.diveintopython.org/getting_to_know_python/testing_modules.html
When I run it interactive, i get:
>>> import odbchelper
Traceback (most recent call last):
File "<interactive input>", line 1, in <module>
ImportError: No module named odbchelper
>>> odbchelper.__name__
Traceback (most recent call last):
File "<interactive input>", line 1, in <module>
NameError: name 'odbchelper' is not defined
I'm guessing either i don't have the pathing set correctly or the module does not exist referenced in one of the folders when I run 'sys.path'. Any ideas?
thanks in advance
This module doesn't come packaged with Python2.6 for sure (just tried on my machine). Have you tried googling where this module might be?
Consider this post.
figured it out..
found this:
http://www.faqs.org/docs/diveintopython/odbchelper_divein.html
downloaded the file and then put it into a folder. c:\temp\python\ in my case with the commands:
>> import sys
>> sys.path.append('c:\\temp\\python\\')

Categories

Resources