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

REBOUNDx error: Force 'type_I_migration' not found in REBOUNDx library. #89

Closed fpazcorrea closed 1 year ago

fpazcorrea commented 1 year ago

Hello,

I am having issues with implementing Type I Migration. I downloaded the ipython example and tried running it without any modifications and it showed me the following error

---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-7-10ea43c03dd8> in <module>
      1 rebx = reboundx.Extras(sim)
----> 2 mig = rebx.load_force("type_I_migration")
      3 rebx.add_force(mig)
      4 
      5 mig.params["tIm_scale_height_1"] = 0.03

/usr/local/Cellar/jupyterlab/3.0.1/libexec/lib/python3.9/site-packages/reboundx/extras.py in load_force(self, name)
     81         clibreboundx.rebx_load_force.restype = POINTER(Force)
     82         ptr = clibreboundx.rebx_load_force(byref(self), c_char_p(name.encode('ascii')))
---> 83         self.process_messages()
     84         return ptr.contents
     85 

/usr/local/Cellar/jupyterlab/3.0.1/libexec/lib/python3.9/site-packages/reboundx/extras.py in process_messages(self)
    205     def process_messages(self):
    206         try:
--> 207             self._sim.contents.process_messages()
    208         except ValueError: # _sim is NULL
    209             raise AttributeError("REBOUNDx Error: The Simulation instance REBOUNDx was attached to no longer exists. This can happen if the Simulation instance goes out of scope or otherwise gets garbage collected.")

/usr/local/Cellar/jupyterlab/3.0.1/libexec/lib/python3.9/site-packages/rebound/simulation.py in process_messages(self)
    703                 warnings.warn(msg[1:], RuntimeWarning)
    704             elif msg[0]=='e':
--> 705                 raise RuntimeError(msg[1:])
    706 
    707 

RuntimeError: REBOUNDx error: Force 'type_I_migration' not found in REBOUNDx library.

I already tried uninstalling reboundx and installing it again with pip.

Thanks in advance

dtamayo commented 1 year ago

Thank you for this bug report. I can reproduce your errors, and have narrowed it down to a bug in version 3.7.2. I will work on this tomorrow afternoon, but until then you could use version 3.7.1 (git hash 5df207c8038bb55d4cde882cd3fd97f81d5c0977) instead.

dtamayo commented 1 year ago

Hi, it sounds like you have the repository cloned on your computer. Could you navigate to the reboundx directory and run

git fetch origin
git merge origin/master
python setup.py clean --all
pip install -e .

If you still get the same error, can you give me the output of running this in the jupyter notebook?

reboundx.__version__, reboundx.__githash__
fpazcorrea commented 1 year ago

Hi, thank you very much for your answer, the issue was solved by moving to version 3.7.1.

I installed it via pip (pip install https://github.com/dtamayo/reboundx/archive/5df207c.zip), so as far as I know I do not have the repository cloned, but the output of the last two commands are: version: '3.7.1' githash: '47ee9392ba633b93cebbfbf0a56b433df024811f'

Should I clone the repository anyway and run the rest of the commands you indicated or should I just keep using 3.7.1?

dtamayo commented 1 year ago

Could you try pip install reboundx --upgrade? When you check the version it should say 3.8 for reboundx.version. Do you still get the same error with that?

fpazcorrea commented 1 year ago

I successfully upgraded to version 3.8 and it does not show any errors now.

Thank you!