0

Although I have installed cppyy-cling, cppyy-backend, CPyCppyy and cppyy (in that order) using pip3 install, I am unable to do a basic import of cppyy from the Python3 prompt.

Python 3.6.9 (default, Oct  8 2020, 12:12:24) 
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cppyy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.6/dist-packages/cppyy/__init__.py", line 74, in <module>
    from ._cpython_cppyy import *
  File "/usr/local/lib/python3.6/dist-packages/cppyy/_cpython_cppyy.py", line 20, in <module>
    c = loader.load_cpp_backend()
  File "/home/<user>/.local/lib/python3.6/site-packages/cppyy_backend/loader.py", line 74, in load_cpp_backend
    raise RuntimeError("could not load cppyy_backend library")
RuntimeError: could not load cppyy_backend library

Please help if you know a way to resolve this. Thank you!

  • please, share the output of `pip --version` – Nicolas Martinez Nov 20 '20 at 20:17
  • Can you verify that `libcppyy_backend.so` is indeed installed under `/home//.local/lib/python3.6/site-packages/cppyy_backend/lib`? (Aside, I'm not sure why you chose to install the dependencies separately instead of just `pip install cppyy`, but that should not have mattered.) – Wim Lavrijsen Nov 21 '20 at 00:09
  • For that matter, it seems that `cppyy` is installed in the system directory `/usr/local/lib` and `cppyy_cling` was installed in a user local directory. Since the backend is searched for using relative paths, it won't work if it lives under `/usr/local/lib`. You can use the envar `CPPYY_BACKEND_LIBRARY` to point to `libcppyy_backend.so` when installing it in an unusual location. – Wim Lavrijsen Nov 21 '20 at 00:12
  • Thanks for all the comments! The problem was alluded to in @WimLavrijsen's answer. The problem was I had installed the packages using sudo (bad practice!) therefore getting installed elsewhere and my python was invoked without sudo. –  Nov 25 '20 at 14:14

0 Answers0