installing python library modules (general question)

J

Julia Goolia

Hi,

I'm sure this issue has been brought up a billion times... but I'm
having trouble installing a python module. I have read all the
documentation for all the buzz words I know related to this problem
but to no avail.

Basically I downloaded a python module called pymad. This module is
supposed to be simplified API to libmad (an mp3 decoder) (I want to
play mp3's from python).

I installed libmad. The libraries appear to be in /usr/local/lib. I
did all the distutils stuff for the module. Now when I try to "import
mad" I get an ImportError exception:

ImportError: libmad.so.0: cannot open shared object file: No such file
or directory

I know the file /usr/local/lib/libmad.so.0 exists, but python can't
seem to find it. I tried adding this path to LD_LIBRARY_PATH, but
that didn't help.

I guess that I just really dont' know enought about libraries and
linux (redhat 9). I don't really know where they are supposed to go
after being compiled, and how python "loads" and uses them.

Any help is much appreciated,
Julia
 
M

Martin v. =?iso-8859-15?q?L=F6wis?=

ImportError: libmad.so.0: cannot open shared object file: No such file
or directory

I know the file /usr/local/lib/libmad.so.0 exists, but python can't
seem to find it. I tried adding this path to LD_LIBRARY_PATH, but
that didn't help.

Can you please be precise on what "this path" is? Adding
"/usr/local/lib/libmad.so.0" would be wrong, whereas adding
"/usr/local/lib" should work.
I guess that I just really dont' know enought about libraries and
linux (redhat 9). I don't really know where they are supposed to go
after being compiled, and how python "loads" and uses them.

You might also edit /etc/ld.so.conf to add /usr/local/lib, and run
ldconfig afterwards; this would remove the need to set LD_LIBRARY_PATH

HTH,
Martin
 
L

Lee Harr

ImportError: libmad.so.0: cannot open shared object file: No such file
or directory

I know the file /usr/local/lib/libmad.so.0 exists, but python can't
seem to find it. I tried adding this path to LD_LIBRARY_PATH, but
that didn't help.

I guess that I just really dont' know enought about libraries and
linux (redhat 9). I don't really know where they are supposed to go
after being compiled, and how python "loads" and uses them.


Where are your other python libraries? On my system, they are in:

/usr/local/lib/python2.2/

and then modules that get added by distutils go in:

/usr/local/lib/python2.2/site-packages/

I have a bunch of libfoo.so and libbaz.so.1 type files in there, so
I think if you have a directory like that you should try dropping
your libmad.so.0 in there.
 
J

Jeff Epler

Add /usr/local/lib to the list of directories in /etc/ld.so.conf and
then execute /sbin/ldconfig to create some needed symlinks in
/usr/local/lib.

Jeff
 
J

Julia Goolia

jeff,

you are a gentleman and a scholar. that worked like a charm. thank
you so much. just so i know... adding something to /etc/ld/so/conf is
different than setting LD_LIBRARY_PATH? what do you do if you don't
have root access?

thanks again,
julia
 
M

Matthias Baas

you so much. just so i know... adding something to /etc/ld/so/conf is
different than setting LD_LIBRARY_PATH?

The result should actually be the same. Maybe there was a typo when
you set the path in LD_LIBRARY_PATH, this can easily happen (see
above, the config file is actually /etc/ld.so.conf.... ;-)

By the way, if you want to know how loading libraries works, have a
look at this HOWTO (section 3):

http://www.ibiblio.org/pub/Linux/docs/HOWTO/other-formats/html_single/Program-Library-HOWTO.html

(this and more documentation can be found at "The Linux Documentation
Project": http://www.tldp.org/)
what do you do if you don't ave root access?

Then you actually do use LD_LIBRARY_PATH.

- Matthias -
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top