-
Notifications
You must be signed in to change notification settings - Fork 63
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
Need to attach reboundx.Extras instance to simulation before setting params. #112
Comments
Hi Eloy, Apologies for the slow response. I'm not able to reproduce this issue. Usually when you get errors like this, versions/installations have got mixed up. The first thing to try is to reinstall. If you make a new virtualenv or conda environment and you pip install reboundx, do you get this same error? |
From a clean installation in a new environment in MacOS with pip, I got the same error. |
Everything works fine when I try this: rein@m1air:~ # mkdir eloytest
rein@m1air:~ # cd eloytest
rein@m1air:~/eloytest # python3 -m venv venv
rein@m1air:~/eloytest # source venv/bin/activate
rein@m1air:~/eloytest # pip install reboundx eloytest|
Collecting reboundx
Using cached reboundx-3.10.1.tar.gz (90 kB)
Preparing metadata (setup.py) ... done
Collecting rebound>=3.23.0
Using cached rebound-3.28.3-cp310-cp310-macosx_11_0_arm64.whl (221 kB)
Collecting numpy
Using cached numpy-1.26.0-cp310-cp310-macosx_11_0_arm64.whl (14.0 MB)
Using legacy 'setup.py install' for reboundx, since package 'wheel' is not installed.
Installing collected packages: rebound, numpy, reboundx
Running setup.py install for reboundx ... done
Successfully installed numpy-1.26.0 rebound-3.28.3 reboundx-3.10.1
WARNING: You are using pip version 22.0.4; however, version 23.2.1 is available.
You should consider upgrading via the '/Users/rein/eloytest/venv/bin/python3 -m pip install --upgrade pip' command.
rein@m1air:~/eloytest # python eloytest|
Python 3.10.5 (v3.10.5:f377153967, Jun 6 2022, 12:36:10) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import reboundx
>>> import rebound
>>> sim = rebound.Simulation()
>>> sim.add(m=1.)
>>> sim.add(a=1.)
>>> rebx = reboundx.Extras(sim)
>>> mm = rebx.load_operator("modify_mass")
>>> rebx.add_operator(mm)
>>> sim.particles[0].params["tau_mass"] = -1000
>>> gr = rebx.load_force("gr")
>>> rebx.add_force(gr)
>>> gr.params['c'] = 1.e4 # set speed of light
>>> sim.integrate(100.) What version of MacOS and Python do you use? |
I am using Python 3.11.5 on macOS Monterey |
Ok, I tried and the error does not happen in Python 3.9. It should be the Python version |
I've tried it with python 3.11 and still see no problems. I'm not sure why it doesn't work on your side. My only guess is that you might have (accidentally) changed something in your python 3.11 installation. |
It looks like... But it is strange that reboundx version 3.9 does not give me this problem. Thank you for the help! |
I also just tried a clean install with python 3.11 and it worked fine for me. It's so tricky to debug these kind of problems! I'll close this for now, but please feel free to open a new one if you run into more problems. Thanks Hanno. |
Now when I try to use reboundx in Python I get this error (with any of the examples):
"Need to attach reboundx.Extras instance to simulation before setting params."
It does not happen in reboundx-3.9.0
The text was updated successfully, but these errors were encountered: