Can't install Sage NB from Github

127 views
Skip to first unread message

Samuel

unread,
May 29, 2012, 11:50:29 PM5/29/12
to sage-n...@googlegroups.com
I forked and cloned the sagenb repository on github. Following the instructions in the readme, I ran

../sage-5.0/./sage -python setup.py install

and then started up sage and ran:

import sagenb.notebook.notebook_object as nb
nb.notebook(directory="mynotebook")


I got this traceback

The notebook files are stored in: mynotebook.sagenb
**************************************************
*                                                *
* Open your web browser to http://localhost:8080 *
*                                                *
**************************************************
Executing twistd  --pidfile="mynotebook/sagenb.pid" -ny "mynotebook.sagenb/twistedconf.tac"
Unhandled Error
Traceback (most recent call last):
  File "/home/sam/Applications/sage-5.0/local/lib/python2.7/site-packages/Twisted-12.0.0-py2.7-linux-i686.egg/twisted/application/app.py", line 652, in run
    runApp(config)
  File "/home/sam/Applications/sage-5.0/local/lib/python2.7/site-packages/Twisted-12.0.0-py2.7-linux-i686.egg/twisted/scripts/twistd.py", line 23, in runApp
    _SomeApplicationRunner(config).run()
  File "/home/sam/Applications/sage-5.0/local/lib/python2.7/site-packages/Twisted-12.0.0-py2.7-linux-i686.egg/twisted/application/app.py", line 386, in run
    self.application = self.createOrGetApplication()
  File "/home/sam/Applications/sage-5.0/local/lib/python2.7/site-packages/Twisted-12.0.0-py2.7-linux-i686.egg/twisted/application/app.py", line 451, in createOrGetApplication
    application = getApplication(self.config, passphrase)
--- <exception caught here> ---
  File "/home/sam/Applications/sage-5.0/local/lib/python2.7/site-packages/Twisted-12.0.0-py2.7-linux-i686.egg/twisted/application/app.py", line 462, in getApplication
    application = service.loadApplication(filename, style, passphrase)
  File "/home/sam/Applications/sage-5.0/local/lib/python2.7/site-packages/Twisted-12.0.0-py2.7-linux-i686.egg/twisted/application/service.py", line 405, in loadApplication
    application = sob.loadValueFromFile(filename, 'application', passphrase)
  File "/home/sam/Applications/sage-5.0/local/lib/python2.7/site-packages/Twisted-12.0.0-py2.7-linux-i686.egg/twisted/persisted/sob.py", line 210, in loadValueFromFile
    exec fileObj in d, d
  File "mynotebook.sagenb/twistedconf.tac", line 15, in <module>
    import base as flask_base
exceptions.ImportError: No module named base

Failed to load application: No module named base

---------------------------------------------------------------------------
error                                     Traceback (most recent call last)

/home/sam/Applications/sage-5.0/<ipython console> in <module>()

/home/sam/Applications/sage-5.0/local/lib/python2.7/site-packages/sagenb-0.9.0-py2.7.egg/sagenb/notebook/notebook_object.pyc in __call__(self, *args, **kwds)
    208     """
    209     def __call__(self, *args, **kwds):
--> 210         return self.notebook(*args, **kwds)
    211 
    212     notebook = run_notebook.notebook_run

/home/sam/Applications/sage-5.0/local/lib/python2.7/site-packages/sagenb-0.9.0-py2.7.egg/sagenb/notebook/run_notebook.pyc in notebook_run(self, directory, port, interface, port_tries, secure, reset, accounts, openid, server_pool, ulimit, timeout, automatic_login, start_path, fork, quiet, server, profile, subnets, require_login, open_viewer, address)
    556     os.chdir(cwd)
    557     if e == 256:
--> 558         raise socket.error
    559 
    560 def get_admin_passwd():

error: 

Any ideas? Am I the only one with this issue?

Thanks,
Samuel

Jason Yeo

unread,
May 29, 2012, 11:57:40 PM5/29/12
to sage-n...@googlegroups.com

Hi,

there are some dependencies that you've to install before installing the flask version of sagenb. Here are the instructions I've got from Basu(thanks!) to install sagenb.

How to get working with sagenb:

1. First download and install sage devel (or release version) from here for example: http://jambu.spms.ntu.edu.sg/sage/

2. Untar the file, and then cd sage-<release version> then type "make". This will take 3-4hours depending on the speed of your machine.

3. You have a working sage ready now. You may back up the directory sage-<release version> so that you can go back to it if anything goes wrong.

4. We will now upgrade the notebook to the flask notebook. Go to ticket 11080: http://trac.sagemath.org/sage_trac/ticket/11080 Install everything except openssl and the ticket from 12899. Just copy-paste the commands on to your terminal.

5. Now, go to SAGE_ROOT/devel and clone the github repository for sagenb. First fork sagemath/sagenb in github and then clone your own sagenb repository into a directory called sagenb-github (for example).

# fork sagemath/sagenb in github git clone git://github.com/<your username>/sagenb sagenb-github

6. You will now have a directory SAGE_ROOT/devel/sagenb-github. Symlink this directory to SAGE_ROOT/devel/sagenb:

cd SAGE_ROOT/devel rm -f sagenb ln -s ./sagenb-github ./sagenb

7. cd sagenb ../../sage -python setup.py develop

8. Start the sage notebook and check that you are actually running twistd-12.0.0. ../../sage -n

9. You can also add other sagenb repos like jasongrout/sagenb and sagemath/sagenb

Jason

P Purkayastha

unread,
May 30, 2012, 1:48:04 AM5/30/12
to sage-n...@googlegroups.com


On Wednesday, May 30, 2012 11:57:40 AM UTC+8, Jason Yeo wrote:

Hi,

there are some dependencies that you've to install before installing the flask version of sagenb. Here are the instructions I've got from Basu(thanks!) to install sagenb.

How to get working with sagenb:

1. First download and install sage devel (or release version) from here for example: http://jambu.spms.ntu.edu.sg/sage/

2. Untar the file, and then cd sage-<release version> then type "make". This will take 3-4hours depending on the speed of your machine.

3. You have a working sage ready now. You may back up the directory sage-<release version> so that you can go back to it if anything goes wrong.

4. We will now upgrade the notebook to the flask notebook. Go to ticket 11080: http://trac.sagemath.org/sage_trac/ticket/11080 Install everything except openssl and the ticket from 12899. Just copy-paste the commands on to your terminal.

Hello,

  Regarding 4., I gave this direction to jason because he already had openssl dev headers installed. If you don't have the openssl dev headers installed, then you need to install the openssl package too.

Samuel

unread,
May 30, 2012, 1:06:46 PM5/30/12
to sage-n...@googlegroups.com
Thanks when I run notebook() it works great. When I run nb.notebook(directory="mynotebook") I get this though

The notebook files are stored in: mynotebook.sagenb



Please choose a new password for the Sage Notebook 'admin' user.
Do _not_ choose a stupid password, since anybody who could guess your password
and connect to your machine could access or delete your files.
NOTE: Only the hash of the password you type is stored by Sage.
You can change your password by typing notebook(reset=True).



Enter new password: 
Retype new password: 
Please login to the notebook with the username 'admin' and the above password.
Password changed for user 'admin'.
**************************************************
*                                                *
* Open your web browser to http://localhost:8080 *
*                                                *
**************************************************
Executing twistd  --pidfile="mynotebook/sagenb.pid" -ny "mynotebook.sagenb/twistedconf.tac"
2012-05-30 12:59:20-0400 [-] Log opened.
2012-05-30 12:59:20-0400 [-] twistd 12.0.0 (/home/sam/Applications/sage-5.0/local/bin/python 2.7.2) starting up.
2012-05-30 12:59:20-0400 [-] reactor class: twisted.internet.epollreactor.EPollReactor.
2012-05-30 12:59:20-0400 [-] Traceback (most recent call last):
2012-05-30 12:59:20-0400 [-]   File "/home/sam/Applications/sage-5.0/local/bin/twistd", line 5, in <module>
2012-05-30 12:59:20-0400 [-]     pkg_resources.run_script('Twisted==12.0.0', 'twistd')
2012-05-30 12:59:20-0400 [-]   File "/home/sam/Applications/sage-5.0/local/lib/python2.7/site-packages/distribute-0.6.16-py2.7.egg/pkg_resources.py", line 468, in run_script
2012-05-30 12:59:20-0400 [-]     self.require(requires)[0].run_script(script_name, ns)
2012-05-30 12:59:20-0400 [-]   File "/home/sam/Applications/sage-5.0/local/lib/python2.7/site-packages/distribute-0.6.16-py2.7.egg/pkg_resources.py", line 1201, in run_script
2012-05-30 12:59:20-0400 [-]     execfile(script_filename, namespace, namespace)
2012-05-30 12:59:20-0400 [-]   File "/home/sam/Applications/sage-5.0/local/lib/python2.7/site-packages/Twisted-12.0.0-py2.7-linux-i686.egg/EGG-INFO/scripts/twistd", line 14, in <module>
2012-05-30 12:59:20-0400 [-]     run()
2012-05-30 12:59:20-0400 [-]   File "/home/sam/Applications/sage-5.0/local/lib/python2.7/site-packages/Twisted-12.0.0-py2.7-linux-i686.egg/twisted/scripts/twistd.py", line 27, in run
2012-05-30 12:59:20-0400 [-]     app.run(runApp, ServerOptions)
2012-05-30 12:59:20-0400 [-]   File "/home/sam/Applications/sage-5.0/local/lib/python2.7/site-packages/Twisted-12.0.0-py2.7-linux-i686.egg/twisted/application/app.py", line 652, in run
2012-05-30 12:59:20-0400 [-]     runApp(config)
2012-05-30 12:59:20-0400 [-]   File "/home/sam/Applications/sage-5.0/local/lib/python2.7/site-packages/Twisted-12.0.0-py2.7-linux-i686.egg/twisted/scripts/twistd.py", line 23, in runApp
2012-05-30 12:59:20-0400 [-]     _SomeApplicationRunner(config).run()
2012-05-30 12:59:20-0400 [-]   File "/home/sam/Applications/sage-5.0/local/lib/python2.7/site-packages/Twisted-12.0.0-py2.7-linux-i686.egg/twisted/application/app.py", line 390, in run
2012-05-30 12:59:20-0400 [-]     self.postApplication()
2012-05-30 12:59:20-0400 [-]   File "/home/sam/Applications/sage-5.0/local/lib/python2.7/site-packages/Twisted-12.0.0-py2.7-linux-i686.egg/twisted/scripts/_twistd_unix.py", line 208, in postApplication
2012-05-30 12:59:20-0400 [-]     self.startApplication(self.application)
2012-05-30 12:59:20-0400 [-]   File "/home/sam/Applications/sage-5.0/local/lib/python2.7/site-packages/Twisted-12.0.0-py2.7-linux-i686.egg/twisted/scripts/_twistd_unix.py", line 315, in startApplication
2012-05-30 12:59:20-0400 [-]     self.config['pidfile'])
2012-05-30 12:59:20-0400 [-]   File "/home/sam/Applications/sage-5.0/local/lib/python2.7/site-packages/Twisted-12.0.0-py2.7-linux-i686.egg/twisted/scripts/_twistd_unix.py", line 270, in setupEnvironment
2012-05-30 12:59:20-0400 [-]     f = open(pidfile,'wb')
2012-05-30 12:59:20-0400 [-] IOError: [Errno 2] No such file or directory: '/home/sam/Applications/sage-5.0/mynotebook/sagenb.pid'
---------------------------------------------------------------------------
error                                     Traceback (most recent call last)

/home/sam/Applications/sage-5.0/<ipython console> in <module>()

/home/sam/Applications/sage-5.0/devel/sagenb-samuela/sagenb/notebook/notebook_object.pyc in __call__(self, *args, **kwds)
    208     """
    209     def __call__(self, *args, **kwds):
--> 210         return self.notebook(*args, **kwds)
    211 
    212     notebook = run_notebook.notebook_run

/home/sam/Applications/sage-5.0/devel/sagenb-samuela/sagenb/notebook/run_notebook.pyc in notebook_run(self, directory, port, interface, port_tries, secure, reset, accounts, openid, server_pool, ulimit, timeout, automatic_login, start_path, fork, quiet, server, profile, subnets, require_login, open_viewer, address)
    556     os.chdir(cwd)
    557     if e == 256:
--> 558         raise socket.error
    559 
    560 def get_admin_passwd():

error: 

I think I can start developing with just notebook() but is there a way to get nb.notebook(directory="...") to work?

Thanks,
Samuel

P Purkayastha

unread,
May 31, 2012, 1:03:14 AM5/31/12
to sage-n...@googlegroups.com


On Thursday, May 31, 2012 1:06:46 AM UTC+8, Samuel wrote:
Thanks when I run notebook() it works great. When I run nb.notebook(directory="mynotebook") I get this though

/home/sam/Applications/sage-5.0/<ipython console> in <module>()

/home/sam/Applications/sage-5.0/devel/sagenb-samuela/sagenb/notebook/notebook_object.pyc in __call__(self, *args, **kwds)
    208     """
    209     def __call__(self, *args, **kwds):
--> 210         return self.notebook(*args, **kwds)
    211 
    212     notebook = run_notebook.notebook_run

/home/sam/Applications/sage-5.0/devel/sagenb-samuela/sagenb/notebook/run_notebook.pyc in notebook_run(self, directory, port, interface, port_tries, secure, reset, accounts, openid, server_pool, ulimit, timeout, automatic_login, start_path, fork, quiet, server, profile, subnets, require_login, open_viewer, address)
    556     os.chdir(cwd)
    557     if e == 256:
--> 558         raise socket.error
    559 
    560 def get_admin_passwd():

error: 

I think I can start developing with just notebook() but is there a way to get nb.notebook(directory="...") to work?

Thanks,
Samuel

1. Do you get this same error if you run your notebook like this:

sage -n directory=mynotebook?

2. What if you append a sagenb at the end?

sage -n directory=mynotebook.sagenb

or, from inside sage prompt

notebook(directory="mynotebook.sagenb")

3. Is there any difference if you run it as notebook(directory="...") instead of nb.notebook(directory="...")?

RickG

unread,
Jun 9, 2012, 5:31:33 PM6/9/12
to sage-n...@googlegroups.com
I confirmed Samuel's report on OS X 10.6.  As for the last question, here's what I got:  


1. Do you get this same error if you run your notebook like this:

sage -n directory=mynotebook?

Yes.  
 
2. What if you append a sagenb at the end?

sage -n directory=mynotebook.sagenb

No.  Works fine.  
 
or, from inside sage prompt

notebook(directory="mynotebook.sagenb")

No, works fine.  But inside prompt using directory="mynotebook" gives the error.  
 
3. Is there any difference if you run it as notebook(directory="...") instead of nb.notebook(directory="...")?
 
No, "mynotebook" still fails, and "mynotebook.sagenb" still succeeds.  

Rick  

P Purkayastha

unread,
Jun 10, 2012, 1:42:27 PM6/10/12
to sage-n...@googlegroups.com
This confirms my suspicion that notebook directories must have .sagenb extension. :) 
Reply all
Reply to author
Forward
0 new messages