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  <20182019  2020  2021  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  <20182019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: PyEPICS timeout in jupyter
From: "Shen, Guobao" <[email protected]>
To: Matt Newville <[email protected]>
Cc: Talk EPICS Tech <[email protected]>
Date: Wed, 16 May 2018 17:30:08 +0000

Eventually, the root cause was identified.

I have to set the PYEPICS_LIBCA to point to the specific one that pvapy uses.


After that, everything works fine.


Thanks,

Guobao


From: Shen, Guobao
Sent: Wednesday, May 16, 2018 11:48:12 AM
To: Matt Newville
Cc: Talk EPICS Tech
Subject: Re: PyEPICS timeout in jupyter
 

Hi Matt,

I eventually found my problem.

In my code, I imported pvaccess, which is EPICS7 python client.

Once I commented out that line, the problem disappeared.


Thanks for all your helps.

Guobao


From: [email protected] <[email protected]> on behalf of Matt Newville <[email protected]>
Sent: Tuesday, May 15, 2018 4:10:10 PM
To: Shen, Guobao
Cc: Talk EPICS Tech
Subject: Re: PyEPICS timeout in jupyter
 
Hi Guobao,


On Tue, May 15, 2018 at 11:36 AM, Shen, Guobao <[email protected]> wrote:

Hi Matt,

Yes, the outputs are same from both terminal & jupyter.

I am wondering something wrong with Mac or safari. I had no problem with the same script on my linux box.

 

Here is output from my terminal:

>>> print(epics.ca.find_libca())

/Users/xxxxxx/anaconda3/anaconda3/lib/python3.6/site-packages/epics/clibs/darwin64/libca.dylib

>>> chan = epics.ca.create_channel('test')

>>> conn = epics.ca.connect_channel(chan)

>>> print("Connected ", chan, conn== epics.dbr.CS_CONN)

Connected  c_long(140696518603264) False

>>> val = epics.ca.get(chan)

>>> print(val)

5.6

 

 

And output from jupyter notebook:

 

print(epics.ca.find_libca())

chan = epics.ca.create_channel('test')

conn = epics.ca.connect_channel(chan)

print("Connected ", chan, conn== epics.dbr.CS_CONN)

val = epics.ca.get(chan)

 

/Users/xxxxxx/anaconda3/anaconda3/lib/python3.6/site-packages/epics/clibs/darwin64/libca.dylib

Connected  140535502249016 False

/Users/xxxxxx/anaconda3/anaconda3/lib/python3.6/site-packages/epics/ca.py:1306: UserWarning: ca.get('test') timed out after 1.00 seconds.
  warnings.warn(msg % (name(chid), timeout))

 



Sorry, that should have just been
   print("Connected ", chan, conn)

If the channel really is connected, I think you should be able to get the value, and I don't understand what is wrong.


If the channel really is not connected, then the error makes more sense, and probably suggests EPICS_CA_ADDR_LIST is not set. And, depending on how you start the Jupyter Notebook, that setting of an environment variable like EPICS_CA_ADDR_LIST may change.

For me, using Anaconda Python3 on MacOS, starting the Jupyter notebook by typing "~/anaconda3/bin/jupyter-notebook" in a Terminal works fine, using either a Safari or Firefox front-end.  That's because the environmental variables are inherited from the shell.  So, I think there is nothing inherently wrong with any of these.

But if you launch Jupyter (or IPython or jupyterlab) from Anaconda Navigator, the shell environmental variables defined in '.bash_profile' (and similar places) will not be used.
In particular, you may have to set EPICS_CA_ADDR_LIST *before* doing any real CA work:


In[1]: import os,  epics
In[2]: os.environ['EPICS_CA_ADDR_LIST'] = '164.XXX.XXX.255'
In[3]: epics.caget('XXX:m1.VAL')
Out[3]: -0.25

Hope that helps,

--Matt


Replies:
Re: PyEPICS timeout in jupyter Matt Newville
References:
PyEPICS timeout in jupyter Shen, Guobao
Re: PyEPICS timeout in jupyter Matt Newville
Re: PyEPICS timeout in jupyter Shen, Guobao
Re: PyEPICS timeout in jupyter Matt Newville
Re: PyEPICS timeout in jupyter Shen, Guobao

Navigate by Date:
Prev: Re: PyEPICS timeout in jupyter Shen, Guobao
Next: Re: PyEPICS timeout in jupyter Matt Newville
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  <20182019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: PyEPICS timeout in jupyter Shen, Guobao
Next: Re: PyEPICS timeout in jupyter Matt Newville
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  <20182019  2020  2021  2022  2023  2024 
ANJ, 16 May 2018 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·