paulscherrerinstitute / pcaspy

Portable Channel Access Server in Python
BSD 3-Clause "New" or "Revised" License
32 stars 24 forks source link

Import Error on macOS when using pcaspy installed from pip. #34

Closed mattgibbs closed 7 years ago

mattgibbs commented 7 years ago

I just upgraded pcaspy to the latest release through pip: $ pip install --upgrade pcaspy but now when I try to use it, I get the following error:

Traceback (most recent call last): File "testing-ioc.py", line 5, in from pcaspy import Driver, SimpleServer File "/usr/local/lib/python2.7/site-packages/pcaspy/init.py", line 1, in from driver import Driver, SimpleServer, PVInfo, SimplePV File "/usr/local/lib/python2.7/site-packages/pcaspy/driver.py", line 1, in import cas File "/usr/local/lib/python2.7/site-packages/pcaspy/cas.py", line 28, in _cas = swig_import_helper() File "/usr/local/lib/python2.7/site-packages/pcaspy/cas.py", line 24, in swig_import_helper _mod = imp.load_module('_cas', fp, pathname, description) ImportError: dlopen(/usr/local/lib/python2.7/site-packages/pcaspy/_cas.so, 2): Library not loaded: /Users/wang/epics/base-3.14.12.5/lib/darwin-x86/libasIoc.3.14.12.dylib Referenced from: /usr/local/lib/python2.7/site-packages/pcaspy/_cas.so Reason: image not found

It looks like _cas.so is trying to find the EPICS libraries in '/Users/wang/epics/base-3.14.12.5', rather than wherever $EPICS_BASE is. If I download the source tarball, and do: $ python setup.py build $ python setup.py install everything works fine, so it must be an issue with getting a pre-built version from pip.

xiaoqiangwang commented 7 years ago

Thanks for spotting the bug. I always try to link EPICS libraries statically. But it looks I have used the wrong epics path. I will be more careful for the packaging.

mattgibbs commented 7 years ago

Thanks for all your work, Xiaoqiang!

xiaoqiangwang commented 7 years ago

0.6.3 is released to PyPI with EPICS base 3.14.12.6 builtin.