Ask Your Question
2

Get the error "NameError: name '_interact_' is not defined" when run sagenb.

asked 2020-09-19 05:44:33 +0200

Xie gravatar image

updated 2020-09-19 07:05:44 +0200

Hi, I still want to run sagenb for sagemath 9.1. I follow wiki.sagemath.org/Python3-Switch use the following codes to compile sage 9.1.

make configure;   ./configure --with-python=2; make build

Then I run ‘ ./sage -i sagenb’. But I get errors in the notebook:

Traceback (most recent call last):

  File "<stdin>", line 1, in <module>

  File "_sage_input_6.py", line 8, in <module>

    _interact_.SAGE_CELL_ID=1

NameError: name '_interact_' is not defined

This problem may be caused by the codes in sage/local/lib/python2.7/site-packages/sagenb-1.1.3-py2.7.egg/sagenb/notebook/worksheet.py.

   def initialize_sage(self):
            S = self.__sage
            try:
                from . import misc
                cmd = '''import base64
import sagenb.misc.support as _support_
import sagenb.notebook.interact as _interact_ # for setting current cell id
....  '''

          S.execute(cmd)

I think 'cmd' is not be executed. If I put some error code in 'cmd', there were nothing happened.

edit retag flag offensive close merge delete

Comments

One way to get SageNB to build is to use --enable-sagenb=yes at the ./configure step.

In the situation where Sage is already built,

  • either run the configure step again with --enable-sagenb and run make again
  • or, without re-running the configure, step, build SageNb with make sagenb

Then run sage -n sagenb to launch the SageNB notebook server.

slelievre gravatar imageslelievre ( 2020-09-20 11:12:31 +0200 )edit

1 Answer

Sort by » oldest newest most voted
2

answered 2020-09-20 10:35:25 +0200

slelievre gravatar image

updated 2020-09-20 11:08:43 +0200

Building Sage 9.1 and SageNB from source

Here are the steps to build Sage and SageNB from source, and to launch the SageNB notebook.

Build Sage and SageNB

Here are the steps I would suggest.

Note that the ./configure output might end with a list of recommendations of additional system packages to install. Following those recommendations can speed up the make step.

If you know you already have all the possible recommended software and you want the ./configure step to be less verbose, add -q (for "quiet") to the ./configure line, after --enable-sagenb=yes.

Linux

Configure

$ V=0
$ MAKE='make -j1'
$ make configure
$ ./configure --with-python=2 --enable-sagenb=yes

Make

$ make -s V=0

macOS

Preliminary brew installation

If brew is not installed yet, install it following the instructions at

Then run

$ brew update
$ brew install autoconf automake bdw-gc boost cairo ccache \
  cmake coreutils cryptominisat curl curl-openssl docutils \
  ffmpeg fontconfig freetype gambit gcc@9 gd gettext glib \
  glpk gmp gnutls gsl imagemagick isl jpeg libffi libmpc \
  libogg libomp libpng libtiff libtool mpfi mpfr mpir nauty \
  ncurses ninja numpy octave open-mpi openblas openjdk \
  openjpeg openssl@1.1 pandoc pari pkg-config ppl python@3.7 \
  r readline scipy scons sip sphinx-doc sqlite suite-sparse \
  wget xz yasm zeromq

Configure

$ V=0
$ MAKE='make -j1'
$ source .homebrew-build-env
$ make configure
$ FC=gfortran-9 ./configure --with-python=2 --enable-sagenb=yes

Make

$ make -s V=0 openssl
$ make -s V=0

Symbolic link

Add a symbolic link to your Sage installation somewhere in your PATH.

For example by running this from the sage root folder:

$ ln -sf `pwd`/sage /usr/local/bin

of if that complains about a permission problem,

$ sudo ln -sf `pwd`/sage /usr/local/bin

which might require entering the password for your user account on the computer on which you are installing.

Check that this worked by running

$ which sage
$ sage --version

Launch the SageNB notebook

Launch the Sage notebook by running this in the terminal:

$ sage -n sagenb
edit flag offensive delete link more

Comments

Unfortunately, I did this and still the same error。 have you tried?

Xie gravatar imageXie ( 2020-09-25 06:05:27 +0200 )edit

This computer no longer had a Python2-based Sage.

I installed it again when writing my answer, and tested it.

slelievre gravatar imageslelievre ( 2020-09-25 13:37:56 +0200 )edit

Do you get errors at the time of starting the sagenb notebook?

Or does it start without error, and do you get an error when executing some code?

slelievre gravatar imageslelievre ( 2020-09-25 13:38:56 +0200 )edit

When I starting the sagenb notebook,there are some errors as follows: Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix") ERROR:ssl_client_socket_impl.cc(960)] handshake failed; returned -1, SSL error code 1, net_error -202

In the notebook, the error just as my question. That is "NameError: name '_interact_' is not defined. "

Xie gravatar imageXie ( 2020-09-29 13:08:57 +0200 )edit

I have try Arch linux and Ubuntu 18.04. All have the problem "NameError: name '_interact_' is not defined. " .

Xie gravatar imageXie ( 2020-09-29 13:17:02 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2020-09-19 05:44:33 +0200

Seen: 932 times

Last updated: Sep 20 '20