Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"OSError: librebound.cpython-37m-x86_64-linux-gnu.so: cannot open shared object file: No such file or directory" when importing reboundx on Google Colab #87

Closed
rcanalese opened this issue Oct 17, 2022 · 6 comments

Comments

@rcanalese
Copy link

Hello,
I have been trying to use rebound and reboundx in a Google Colab notebook, but I keep getting the following error:

import reboundx

OSError                                   Traceback (most recent call last)

[<ipython-input-5-44515272dadb>](https://localhost:8080/#) in <module>
----> 1 import reboundx

2 frames

[/usr/local/lib/python3.7/dist-packages/reboundx/__init__.py](https://localhost:8080/#) in <module>
     11 pymodulespath = os.path.dirname(__file__)
     12 from ctypes import *
---> 13 clibreboundx = cdll.LoadLibrary(pymodulespath + '/../libreboundx' + suffix)
     14 
     15 # Version

[/usr/lib/python3.7/ctypes/__init__.py](https://localhost:8080/#) in LoadLibrary(self, name)
    440 
    441     def LoadLibrary(self, name):
--> 442         return self._dlltype(name)
    443 
    444 cdll = LibraryLoader(CDLL)

[/usr/lib/python3.7/ctypes/__init__.py](https://localhost:8080/#) in __init__(self, name, mode, handle, use_errno, use_last_error)
    362 
    363         if handle is None:
--> 364             self._handle = _dlopen(self._name, mode)
    365         else:
    366             self._handle = handle

OSError: librebound.cpython-37m-x86_64-linux-gnu.so: cannot open shared object file: No such file or directory

I could share an example notebook if it helps, but the only other thing I've done is run pip install rebound reboundx. Is there any workaround, or is the library incompatible with Google Colab?

@rcanalese rcanalese changed the title "OSError: librebound.cpython-37m-x86_64-linux-gnu.so: cannot open shared object file: No such file or directory" when installing reboundx on Google Colab "OSError: librebound.cpython-37m-x86_64-linux-gnu.so: cannot open shared object file: No such file or directory" when importing reboundx on Google Colab Oct 17, 2022
@dtamayo
Copy link
Owner

dtamayo commented Oct 17, 2022 via email

@rcanalese
Copy link
Author

@dtamayo
Copy link
Owner

dtamayo commented Oct 17, 2022 via email

@rcanalese
Copy link
Author

Sorry, I think I fixed the access issue now.
Either way, I may have found a tentative solution. I had been using pip install rebound reboundx at first, but when I switched to !pip install I had no trouble importing reboundx. I'm still testing to see if any other issues arise, but at least the importing issue seems to have been solved.

@hannorein
Copy link
Collaborator

hannorein commented Oct 17, 2022

I'm not sure what is going on but one issue could occur when trying to install both packages at once. I tend to have more luck first installing rebound, then reboundx. We're probably doing something wrong with the package requirements and shared libraries, but I'm not sure what...

@dtamayo
Copy link
Owner

dtamayo commented Oct 17, 2022

I'm not totally sure what

pip install reboundx

is doing in colab when you don't include an exclamation point, but

!pip install reboundx

is definitely the right command to execute the command in the shell. I just ran it in a colab notebook (without installing rebound first) and it installed both no problem.

Closing for now, but feel free to reopen if there are further issues!

@dtamayo dtamayo closed this as completed Oct 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants