dtamayo / reboundx

A library for adding additional forces to the REBOUND N-body integration package
GNU General Public License v3.0
80 stars 60 forks source link

librebound.cpython-39-x86_64-linux-gnu.so import error #79

Closed dangcpham closed 2 years ago

dangcpham commented 2 years ago

Hi, it seems like this issue comes up every few years or so (#26, #39) , so I guess it's my turn. I have a custom version of rebound and a custom version of reboundx.

After modifying the source code, I reinstalled rebound and then reboundx (using pip install -e . in their respective directories). This occured without any error. Importing rebound separately worked without any issues too. However, when I tried to import reboundx, I encountered the following error:

>>> import reboundx
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/mnt/g/Documents/pwds/reboundx/reboundx/__init__.py", line 13, in <module>
    clibreboundx = cdll.LoadLibrary(pymodulespath + '/../libreboundx' + suffix)
  File "/home/dang/anaconda3/envs/planets/lib/python3.9/ctypes/__init__.py", line 460, in LoadLibrary
    return self._dlltype(name)
  File "/home/dang/anaconda3/envs/planets/lib/python3.9/ctypes/__init__.py", line 382, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: librebound.cpython-39-x86_64-linux-gnu.so: cannot open shared object file: No such file or directory

I also tried to use python setup.py install in both directories to install, but the same issue occurred. I'm not quite sure what could have went wrong and it seems like the previous issues' solutions don't apply here. Thanks for your help!

Dang

dtamayo commented 2 years ago

Hi Dang, these are always a bit tricky to diagnose on someone else's computer. Could you give us a bit more detail, as done in https://github.com/dtamayo/reboundx/issues/39 ?

dangcpham commented 2 years ago

It seems that after I cleaned up my reboundx directory, reinstalled everything in a new virtual environment, the import issue is no longer a problem.

Here is what I did: virtualenv -p python3 venv source venv/bin/activate In rebound directory: pip install -e . In reboundx directory: pip install -e .

Thanks for your help!