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  2020  2021  <20222023  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  2020  2021  <20222023  2024 
<== Date ==> <== Thread ==>

Subject: Re: pyDevSup and PyDevice: Virtual Environment
From: Michael Davidsaver via Tech-talk <tech-talk at aps.anl.gov>
To: Kuldeep Joshi <kuldeep.joshi at gmail.com>
Cc: tech-talk at aps.anl.gov
Date: Tue, 26 Apr 2022 11:49:43 -0700
On 4/26/22 02:43, Kuldeep Joshi wrote:
 > for pyDevSup, any suggestions as to how I can automate switching to the virtual environment before invoking the IOC?? (source ~/myvirtEnv/bin/activate??? at the start of st.cmd file??)


    All the 'activate' script does these days is modify $PATH so yoy
    can instead directly reference 'bin/python` in a virtualenv.

     > /path/to/env/bin/python myscript.py

How do I point the path to the virtual environment so that the IOC can use it.

If practical, (re)build pyDevSup against that specific interpreter.

make PYTHON=/path/to/env/bin/python

Alternately, if you are certain that the ABI versions match, you can
add $(TOP)/python$(PY_VER) to $PYTHONPATH and "import devsup".  The
"softIocPy*" executable isn't as special as it used to be.  For an
example run:

make ipython

which is a shortcut to run an ipython shell with $PYTHONPATH set
appropriately to for the $PYTHON used.


Also, I will mention

https://dls-controls.github.io/pythonSoftIOC/master/index.html

as possible an alternative which fits better into the python
ecosystem (cf. "pip install softioc").


W.R.T.

#!../../bin/linux-x86_64/softIocPy2.7
# Interpreter not started
dbLoadDatabase("../../dbd/softIocPy.dbd",0,0)
softIocPy_registerRecordDeviceDriver(pdbbase)
# Interpreter started

    or

     > #!/path/to/env/bin/python
     > ...

How do I do it while invoking the IOC, with st.cmd file where it is the #!/path/points/to/the/softioc

I am presently having another bash script file from which I activate the the virtual environment and invoking the st.cmd file



References:
pyDevSup and PyDevice: Virtual Environment Kuldeep Joshi via Tech-talk
Re: pyDevSup and PyDevice: Virtual Environment Michael Davidsaver via Tech-talk
Re: pyDevSup and PyDevice: Virtual Environment Kuldeep Joshi via Tech-talk

Navigate by Date:
Prev: RE: Olog Features Leblanc, Gregory via Tech-talk
Next: RE: Re: Getting Permission denied messages while building Barrett (US), Patrick E 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  2020  2021  <20222023  2024 
Navigate by Thread:
Prev: Re: pyDevSup and PyDevice: Virtual Environment Kuldeep Joshi via Tech-talk
Next: Eiger Stream API problems Miceli, Antonino 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  2020  2021  <20222023  2024 
ANJ, 14 Sep 2022 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·