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  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: EPICS7 and Python
From: Juan F. Esteban Müller via Tech-talk <tech-talk at aps.anl.gov>
To: Matt Newville <newville at cars.uchicago.edu>
Cc: "Cobb, Tom \(DLSLtd,RAL,LSCI\) via Tech-talk" <tech-talk at aps.anl.gov>
Date: Tue, 18 Aug 2020 16:27:38 +0000

Thanks for your replies, Tom, Michael, and Matt.

 

It looks like indeed the problem is that pyepics is using a different version of the EPICS libraries. I might have been confused about how this is done.

 

I installed pyepics and p4p using pip, and it was fetching epicscorelibs, but then I was setting PYEPICS_LIBCA to use a patched 7.0.4 to fix a couple of other issues I was having (https://github.com/epics-base/pva2pva/pull/34, https://github.com/epics-base/epics-base/issues/83).

It seems that pyepics is using that environment variable, but p4p is ignoring it, so each module is trying to load different versions of the libraries. I was probably lucky that it worked in the past with Python 3.7.3 on macos Mojave and on Python 2.7.

 

I’ll try to stick to the bundled libraries. Thanks!

 

Cheers,

Juan

 

From: Matt Newville <newville at cars.uchicago.edu>
Date: Tuesday, 18 August 2020 at 17:44
To: "Juan F. Esteban Müller" <JuanF.EstebanMuller at ess.eu>
Cc: "Cobb, Tom (DLSLtd,RAL,LSCI) via Tech-talk" <tech-talk at aps.anl.gov>
Subject: Re: EPICS7 and Python

 

Hi Juan,

 

 

 

On Tue, Aug 18, 2020 at 4:18 AM Juan F. Esteban Müller via Tech-talk <tech-talk at aps.anl.gov> wrote:

Hi all,

 

I have been using CA and PVA clients in Python for some time, but in the last few days I started to have issues. I recently updated to macos Catalina and python 3.7.7, and I am using epics base 7.0.4.

 

I wrote a small script to reproduce my issues:

import time

from __future__ import print_function

import epics

import p4p.client.thread

 

pv = epics.PV('SOME:PV', connection_callback=lambda pvname,conn,pv: print('connected'))

time.sleep(1)

pv.connect(timeout=0)

pv.get()

 

This script fails to connect to the PV if I run it on python 3.7.7, using pyepics 3.4.2 with PYEPICS_LIBCA pointing to epics base 7.0.4, and p4p 3.5.1. Even trying to stop the python interpreter with ctrl-C doesn’t work, I have to kill the process. Removing the p4p import fixes the issue.

I tried different EPICS7 releases and all fail, while EPICSv3 seems to work just fine. Unsetting PYEPICS_LIBCA also works, because the internal ca lib is 3.16.

It also runs fine on python 2.7, with and without PYEPICS_LIBCA pointing to epics base 7.

 

Any clue where the issue might be? Thanks!

 

Best regards,

Juan


Hm, I'm not sure.  That (or something very close to it) actually works for me on MacOS Cataline (10.15.5), using either the built-in libca (as you see) or the one distributed with 'epicscorelibs'.  I'm using Anaconda Python 3.7.7, pyepics 3.4.2, and did a fresh install of p4p with `pip install p4p`, which installed epicscorelibs 7.0.3.99.  

 

I guess the only difference from your setup is the version of epicscore/base being 7.0.3.99 instead of 7.0.4.  Maybe that goes to Tom's and Michael's questions about how you installed 7.0.4?

 

 

Python 3.7.7 (default, Mar 23 2020, 17:31:31)
[Clang 4.0.1 (tags/RELEASE_401/final)] :: Anaconda, Inc. on darwin
Type "help", "copyright", "credits" or "license" for more information.
Imported history from '/Users/Newville/.pyhist'
>>> import os
>>> os.environ['PYEPICS_LIBCA'] = '/Users/Newville/opt/anaconda3/lib/python3.7/site-packages/epicscorelibs/lib/libca.7.0.3.99.4.dylib'
>>> import epics
>>> import p4p
>>> import p4p.client.thread
>>> epics.caget('13IDA:m1.VAL')
-0.25
>>> epics.ca.libca
<CDLL '/Users/Newville/opt/anaconda3/lib/python3.7/site-packages/epicscorelibs/lib/libca.7.0.3.99.4.dylib', handle 7fe3ceeada70 at 0x7fe3ceb7c6d0>
>>> pv = epics.PV('13IDA:m2.VAL', connection_callback=lambda pvname,conn,pv: print('connected'))
connected
>>> pv.get()
0.8

 

 

 

--Matt 


Replies:
Re: EPICS7 and Python Matt Newville via Tech-talk
References:
EPICS7 and Python Juan F. Esteban Müller via Tech-talk
Re: EPICS7 and Python Matt Newville via Tech-talk

Navigate by Date:
Prev: Re: How to write a soft record with a constant long string value Johnson, Andrew N. via Tech-talk
Next: Re: EPICS7 and Python Matt Newville via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024 
Navigate by Thread:
Prev: Re: EPICS7 and Python Matt Newville via Tech-talk
Next: Re: EPICS7 and Python Matt Newville via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024 
ANJ, 18 Aug 2020 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·