EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  <20082009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  <20082009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: Problems getting the Python module to work
From: "J. Lewis Muir" <[email protected]>
To: [email protected]
Date: Wed, 06 Aug 2008 13:17:15 -0400
On 8/6/08 12:58 PM, Adam Kadzban wrote:
> Hey all, I'm a relative newcomer to both Linux, Python, and Epics, so
> sorry if this has an easy solution.  I guess I'm not even sure if it's a
> problem with Epics itself, or Python, or something else.  I'm having
> some problems getting Python to import the EpicsCA module.  I'm running
> Ubuntu 8.04 (Hardy), and it's an x86_64 system.  The epics base seems to
> have installed fine, I put it in /usr/local/lib/epics/base.  I got the
> epics module here <http://cars9.uchicago.edu/%7Enewville/Epics/Python/>
> (http://cars9.uchicago.edu/~newville/Epics/Python/), and again it looked
> like it installed fine to /usr/local/EpicsCA-2.1.5.
> 
> The problem is, whenever I try to do anything with EpicsCA in Python, it
> dies on me because it can't find libca.so.  Here's what it shows when I
> try to import EpicsCA:
> 
>>>> import EpicsCA
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "/usr/lib/python2.5/site-packages/EpicsCA/__init__.py", line 116,
> in <module>
>     import _epics
> ImportError: libca.so: cannot open shared object file: No such file or
> directory
> 
> (it does the same if I try "from EpicsCA import *")
> 
> However, I know libca.so exists, it's here:
> 
> adam:$ locate libca.so
> /usr/local/lib/epics/base/lib/linux-x86_64/libca.so
> /usr/local/lib/epics/base/lib/linux-x86_64/libca.so.3.14
> /usr/local/lib/epics/base/src/ca/O.linux-x86_64/libca.so.3.14

Hi, Adam.

Keep in mind that locate uses a database to look up files.  So your
locate results are only current as of the last time the database was
updated.  If you've recently installed software or made changes to your
file system, locate's results might not be accurate.

> So there it is, in the epics base folder.  Why can't Python find it?  I
> was digging around online, and found how to add places for Python looks
> for modules to import them (though I don't think that's the problem,
> because it can't find libca.so, not a module), and I added a bunch of
> places, to no avail.  Anyone have any ideas?

Is your LD_LIBRARY_PATH environment variable set correctly?  You
probably want it to contain the path to your EPICS libraries which
include libca.so.  So you should add the following to LD_LIBRARY_PATH:

  /usr/local/lib/epics/base/lib/linux-x86_64

> Not sure if it's relevant, but when I ran the setup.py script to install
> EpicsCA, I had to edit the environment variable manually.  I added
> "EPICS_BASE=/usr/local/lib/epics/base" to /etc/environment, but for some
> reason os.environ['EPICS_BASE'] wasn't finding
> /usr/local/lib/epics/base.  I had to change the setup script to look
> there.  Though if I opened a Python interpreter and printed
> os.environ['EPICS_BASE'], it came out as /usr/local/lib/epics/base.  So
> something fishy was going on there, not sure if it's related though.

This works fine for me without modifying setup.py.

I'm not sure how your /etc/environment system works, but it could be
that it requires you to export the environment variable explicitly.  So
you might need to make that

  export EPICS_BASE=/usr/local/lib/epics/base

This will make the environment variable get passed as part of the
environment of any subprocesses (i.e. your Python interpreter running
setup.py).

-lewis

References:
Problems getting the Python module to work Adam Kadzban

Navigate by Date:
Prev: Re: Problems getting the Python module to work Antonino Miceli
Next: Re: Problems getting the Python module to work Tim Mooney
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  <20082009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: Problems getting the Python module to work Antonino Miceli
Next: Re: Problems getting the Python module to work Tim Mooney
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  <20082009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 02 Sep 2010 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·