sosey / astronomy-resources

Information, Tutorials and Help for Astronomers writing code for data analysis and vizualization
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Starting Ipython Notebook #3

Open dborncamp opened 10 years ago

dborncamp commented 10 years ago

I usually just code programs in VI then import and run them in Ipython. But this is annoying when trying to script and test something because I don't know python well enough to not use the help features. After watching people code using the notebook, it seems like a much easier way to script.

So my question is, How do I start an instance of Ipython Notebook?

meredith-durbin commented 10 years ago

If everything's configured properly, you should be able to just type 'ipython notebook' in the command line and the notebook interface will pop up in your browser.

dborncamp commented 10 years ago

No good... I don't really know what this traceback is telling me.

1% ipython notebook Traceback (most recent call last): File "/usr/stsci/pyssgx/Python-2.7.3/bin/ipython", line 7, in launch_new_instance() File "/usr/stsci/pyssgx/Python-2.7.3/lib/python2.7/site-packages/IPython/frontend/terminal/ipapp.py", line 388, in launch_new_instance app.initialize() File "", line 2, in initialize File "/usr/stsci/pyssgx/Python-2.7.3/lib/python2.7/site-packages/IPython/config/application.py", line 84, in catch_config_error return method(app, _args, _kwargs) File "/usr/stsci/pyssgx/Python-2.7.3/lib/python2.7/site-packages/IPython/frontend/terminal/ipapp.py", line 313, in initialize super(TerminalIPythonApp, self).initialize(argv) File "", line 2, in initialize File "/usr/stsci/pyssgx/Python-2.7.3/lib/python2.7/site-packages/IPython/config/application.py", line 84, in catch_config_error return method(app, _args, _kwargs) File "/usr/stsci/pyssgx/Python-2.7.3/lib/python2.7/site-packages/IPython/core/application.py", line 325, in initialize self.parse_command_line(argv) File "/usr/stsci/pyssgx/Python-2.7.3/lib/python2.7/site-packages/IPython/frontend/terminal/ipapp.py", line 308, in parse_command_line return super(TerminalIPythonApp, self).parse_command_line(argv) File "", line 2, in parse_command_line File "/usr/stsci/pyssgx/Python-2.7.3/lib/python2.7/site-packages/IPython/config/application.py", line 84, in catch_config_error return method(app, _args, _kwargs) File "/usr/stsci/pyssgx/Python-2.7.3/lib/python2.7/site-packages/IPython/config/application.py", line 420, in parse_command_line return self.initialize_subcommand(subc, subargv) File "", line 2, in initialize_subcommand File "/usr/stsci/pyssgx/Python-2.7.3/lib/python2.7/site-packages/IPython/config/application.py", line 84, in catch_config_error return method(app, _args, _kwargs) File "/usr/stsci/pyssgx/Python-2.7.3/lib/python2.7/site-packages/IPython/config/application.py", line 352, in initialize_subcommand subapp = import_item(subapp) File "/usr/stsci/pyssgx/Python-2.7.3/lib/python2.7/site-packages/IPython/utils/importstring.py", line 40, in import_item module = import(package,fromlist=[obj]) File "/usr/stsci/pyssgx/Python-2.7.3/lib/python2.7/site-packages/IPython/frontend/html/notebook/init.py", line 8, in raise ImportError(msg) ImportError: The IPython Notebook requires tornado >= 2.1.0 2%

meredith-durbin commented 10 years ago

Yikes. My only guess is that you should try updating Ureka :/

dborncamp commented 10 years ago

Also, when I try on my laptop, I get the following with nothing starting in firefox:

2% ipython notebook 2014-10-09 13:27:57.185 [NotebookApp] Using existing profile dir: u'/Users/dborncamp/.ipython/profile_default' 2014-10-09 13:27:57.195 [NotebookApp] Using MathJax from CDN: http://cdn.mathjax.org/mathjax/latest/MathJax.js 2014-10-09 13:27:57.247 [NotebookApp] Serving notebooks from local directory: /Users/dborncamp 2014-10-09 13:27:57.247 [NotebookApp] 0 active kernels 2014-10-09 13:27:57.248 [NotebookApp] The IPython Notebook is running at: http://127.0.0.1:8888/ 2014-10-09 13:27:57.248 [NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).

astrocaribe commented 10 years ago

@dborncamp This message is just saying that one of the backends that iPython needs is outdated (last line of traceback, tornado). You can check what version you have by importing tornado in ipython:

> import tornado > print tornado.__version__

If you have pip installed, try:

pip install --upgrade tornado

astrocaribe commented 10 years ago

If you are indeed using Ureka, I second @meredith-durbin, do a Ureka update.

meredith-durbin commented 10 years ago

Sometimes the notebook just sort of forgets to actually make things show up in the browser, but as long as the http://127.0.0.1:8888/ url shows up you can copy/paste that and it should work.

dborncamp commented 10 years ago

My current Ureka is ssbx from 8/22/14... and tornado is ver 3.2, greater then 2.1.0...

2% ur_setup common ssbx 3% ipython Python 2.7.5 (default, Aug 22 2014, 00:44:15) Type "copyright", "credits" or "license" for more information.

IPython 2.0.0 -- An enhanced Interactive Python. ? -> Introduction and overview of IPython's features. %quickref -> Quick reference. help -> Python's own help system. object? -> Details about 'object', use 'object??' for extra details.

In [1]: import tornado

In [2]: print tornado. version

AttributeError Traceback (most recent call last)

in () ----> 1 print tornado._ _ version _ _ AttributeError: 'module' object has no attribute '_ _ version _ _' In [3]: print tornado.v tornado.version tornado.version_info In [3]: print tornado.version 3.2 ## Trying to install via pip gets me: error: could not create '/usr/stsci/pyssgx/Python-2.7.3/lib/python2.7/site-packages/tornado': Permission denied