Having trouble importing REBOUND in Jupyter Notebook

38 views
Skip to first unread message

Dean Sayre

unread,
Jul 12, 2017, 6:09:40 PM7/12/17
to Project Jupyter

I usually use Atom as a text editor when coding, but I need to use the notebook to make use of its widget capabilities. First off, running a notebook in my home directory, I'm able to import Rebound but for some reason it doesn't recognize one of the functions I jot down. I'm certain that I have it typed in correctly, I've attached the screenshot.


Then I try running rebound outside of my home directory, and it doesn't even recognize at all, leaving me unable to import it.

I find this odd since I'm not having these problems in Atom.


I'm running Jupyter Notebook 5.0.0. If you'd like to know more about rebound, here is the link: http://rebound.readthedocs.io/en/latest/index.html

Screen Shot 2017-07-12 at 11.58.57 AM.png

Dean Sayre

unread,
Jul 12, 2017, 8:01:03 PM7/12/17
to Project Jupyter
Further, I've checked to make sure that the attribute 'Simulation' was in the rebound module and it was. This leads me to believe that the error involves Jupyter and Rebound not communicating.

Thomas Kluyver

unread,
Jul 13, 2017, 3:55:59 AM7/13/17
to Project Jupyter
You may have a file called rebound.py in your home directory which you're importing instead of the real rebound package.

If you can't import it at all, that probably means that Jupyter is running on another Python installation or environment from the one on which you installed rebound. Packages have to be installed in each Python environment you want to use them from. Check sys.executable to see which Python you're running, and sys.path to see where it imports from.

Thomas

--
You received this message because you are subscribed to the Google Groups "Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+unsubscribe@googlegroups.com.
To post to this group, send email to jup...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jupyter/2e7fdd83-7e90-4c1c-a05a-21e53e61aff7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Dean Sayre

unread,
Jul 13, 2017, 2:50:52 PM7/13/17
to jup...@googlegroups.com
The executable spits out: /Users/Dean/anaconda3/bin/python

and the path: ['', '/Users/Dean/anaconda3/lib/python36.zip', '/Users/Dean/anaconda3/lib/python3.6', '/Users/Dean/anaconda3/lib/python3.6/lib-dynload', '/Users/Dean/anaconda3/lib/python3.6/site-packages', '/Users/Dean/anaconda3/lib/python3.6/site-packages/Sphinx-1.5.6-py3.6.egg', '/Users/Dean/anaconda3/lib/python3.6/site-packages/aeosa', '/Users/Dean/anaconda3/lib/python3.6/site-packages/setuptools-27.2.0-py3.6.egg', '/Users/Dean/anaconda3/lib/python3.6/site-packages/IPython/extensions', '/Users/Dean/.ipython']

I'm a bit of a mediocre programmer here, so I don't really know how to analyze the two.

--
You received this message because you are subscribed to a topic in the Google Groups "Project Jupyter" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jupyter/46Rj3tB0r_g/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jupyter+unsubscribe@googlegroups.com.

To post to this group, send email to jup...@googlegroups.com.

Dean Sayre

unread,
Jul 13, 2017, 2:57:32 PM7/13/17
to jup...@googlegroups.com
I ran sys.path in Atom and got: ['/Users/Dean', '/Users/anaconda/lib/python35.zip', '/Users/anaconda/lib/python3.5', '/Users/anaconda/lib/python3.5/plat-darwin', '/Users/anaconda/lib/python3.5/lib-dynload', '/Users/anaconda/lib/python3.5/site-packages', '/Users/anaconda/lib/python3.5/site-packages/Sphinx-1.4.1-py3.5.egg', '/Users/anaconda/lib/python3.5/site-packages/aeosa', '/Users/anaconda/lib/python3.5/site-packages/setuptools-23.0.0-py3.5.egg']

The difference is in the python/package versions. My terminal is also running this same path.

Thomas Kluyver

unread,
Jul 14, 2017, 6:40:25 AM7/14/17
to Project Jupyter
It looks like you have two Anaconda installations; Jupyter is running in one, and Atom (and your terminal) in another.

Reply all
Reply to author
Forward
0 new messages