Hi Juan,
Did you install p4p using pip, or as an EPICS module from source?
If you installed via pip, what version of epicscorelibs did it pull in?
Personally, I always install it with pip, and it pulls in a version of epicscorelibs with a matching version of epics base bundled in it. I'm not sure what happens if you try to then load a different version of epics base into the same Python process,
I imagine you might get odd issues like you have seen.
My suggestion would be to make pyepics use the bundled version of epics base as suggested here:
Thanks,
Tom
From: Tech-talk <tech-talk-bounces at aps.anl.gov> on behalf of Juan F. Esteban Müller via Tech-talk <tech-talk at aps.anl.gov>
Sent: 18 August 2020 13:39
To: Cobb, Tom (DLSLtd,RAL,LSCI) via Tech-talk <tech-talk at aps.anl.gov>
Subject: Re: EPICS7 and Python
Hi again,
It seems that if I create a CA context before importing the p4p client, it all works fine. It is still a mystery for me, but it seems to be a good workaround for the moment.
import epics
epics.ca.create_context()
import p4p.client.thread
Cheers,
Juan
From: Tech-talk <tech-talk-bounces at aps.anl.gov> on behalf of "Juan F. Esteban Müller via Tech-talk" <tech-talk at aps.anl.gov>
Reply-To: "Juan F. Esteban Müller" <JuanF.EstebanMuller at ess.eu>
Date: Tuesday, 18 August 2020 at 11:18
To: "Cobb, Tom (DLSLtd,RAL,LSCI) via Tech-talk" <tech-talk at aps.anl.gov>
Subject: EPICS7 and Python
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
--
This e-mail and any attachments may contain confidential, copyright and or privileged material, and are for the use of the intended addressee only. If you are not the intended addressee or an authorised recipient of the addressee please notify us of receipt by returning the e-mail and do not use, copy, retain, distribute or disclose the information in or attached to the e-mail. Any opinions expressed within this e-mail are those of the individual and not necessarily of Diamond Light Source Ltd. Diamond Light Source Ltd. cannot guarantee that this e-mail or any attachments are free from viruses and we cannot accept liability for any damage which you may sustain as a result of software viruses which may be transmitted in or with the message. Diamond Light Source Limited (company no. 4375679). Registered in England and Wales with its registered office at Diamond House, Harwell Science and Innovation Campus, Didcot, Oxfordshire, OX11 0DE, United Kingdom
|