简体   繁体   中英

Kernel dies when creating new iPython Notebook.

I'm fairly new to coding and any help with this is GREATLY appreciated. It worked a week ago and now I can't get my notebook Kernels to connect. I use anaconda command prompt to open notebooke (ipython notebook) which opens up jupyter iPython page. I press new python2 notebook. after 30 seconds the kernel Dies (I don't think it ever connects in the first place). Here is the error that comes up in the anaconda command prompt. I wish I could understand what it is saying. I leave this in the knowledgable hands of the stack overflow community. Thanks for your help. ~Mark

 global HistoryManager = <class 'IPython.core.history.HistoryManager'>
        global shell = undefined
        self = <ipykernel.zmqshell.ZMQInteractiveShell object at 0x0000000003D0AEB8>
        global parent = undefined
   1637         self.configurables.append(self.history_manager)
   1638

C:\Users\Admin\Anaconda2\lib\site-packages\IPython\core\history.pyc in __init__(self=<IPython.core.history.HistoryManager object>, shell=<ipykernel.zmqshell.ZMQInteractiveShell object>, config=None, **traits={'parent': <ipykernel.zmqshell.ZMQInteractiveShell object>})
    518             self.save_thread.start()
    519
--> 520         self.new_session()
        self.new_session = <bound method HistoryManager.new_session of <IPython.core.history.HistoryManager object at 0x0000000003D20898>>
    521
    522     def _get_hist_file_name(self, profile=None):

C:\Users\Admin\Anaconda2\lib\site-packages\IPython\core\history.pyc in new_session(self=<IPython.core.history.HistoryManager object>, conn=None)

C:\Users\Admin\Anaconda2\lib\site-packages\IPython\core\history.pyc in needs_sqlite(f=<function new_session>, self=<IPython.core.history.HistoryManager object>, *a=(None,), **kw={})
     66         return []
     67     else:
---> 68         return f(self, *a, **kw)
        f = <function new_session at 0x0000000003796048>
        self = <IPython.core.history.HistoryManager object at 0x0000000003D20898>
        a = (None,)
        kw = {}
     69
     70

C:\Users\Admin\Anaconda2\lib\site-packages\IPython\core\history.pyc in new_session(self=<IPython.core.history.HistoryManager object>, conn=<sqlite3.Connection object>)
    536         with conn:
    537             cur = conn.execute("""INSERT INTO sessions VALUES (NULL, ?, NULL,
--> 538                             NULL, "") """, (datetime.datetime.now(),))
        global NULL = undefined
        global Close = undefined
        global the = undefined
        global database = undefined
        global session = undefined
        global filling = undefined
        global end = undefined
        global time = undefined
        global line = undefined
        global count.UPDATE = undefined
        global sessions = undefined
        global SET = undefined
        global num_cmds = undefined
        global WHERE = undefined
    539             self.session_number = cur.lastrowid
    540

OperationalError: attempt to write a readonly database
[W 18:20:53.372 NotebookApp] Timeout waiting for kernel_info reply from 05f482d7-7690-4783-a20f-46c25a5944ce
[I 18:20:55.388 NotebookApp] KernelRestarter: restarting kernel (4/5)
WARNING:root:kernel 05f482d7-7690-4783-a20f-46c25a5944ce restarted
---------------------------------------------------------------------------
OperationalError                          Traceback (most recent call last)
C:\Users\Admin\Anaconda2\lib\runpy.pyc in _run_module_as_main(mod_name='ipykernel.__main__', alter_argv=1)
    160         sys.argv[0] = fname
    161     return _run_code(code, main_globals, None,
--> 162                      "__main__", fname, loader, pkg_name)
        fname = 'C:\\Users\\Admin\\Anaconda2\\lib\\site-packages\\ipykernel\\__main__.py'
        loader = <pkgutil.ImpLoader instance at 0x0000000003BCFD08>
        pkg_name = 'ipykernel'
    163
    164 def run_module(mod_name, init_globals=None,

C:\Users\Admin\Anaconda2\lib\runpy.pyc in _run_code(code=<code object <module> at 00000000026ADDB0, file ...lib\site-packages\ipykernel\__main__.py", line 1>, run_globals={'__builtins__': <module '__builtin__' (built-in)>, '__doc__': None, '__file__': r'C:\Users\Admin\Anaconda2\lib\site-packages\ipykernel\__main__.py', '__loader__': <pkgutil.ImpLoader instance>, '__name__': '__main__', '__package__': 'ipykernel', 'app': <module 'ipykernel.kernelapp' from 'C:\Users\Adm...onda2\lib\site-packages\ipykernel\kernelapp.pyc'>}, init_globals=None, mod_name='__main__', mod_fname=r'C:\Users\Admin\Anaconda2\lib\site-packages\ipykernel\__main__.py', mod_loader=<pkgutil.ImpLoader instance>, pkg_name='ipykernel')
     70                        __loader__ = mod_loader,
     71                        __package__ = pkg_name)
---> 72     exec code in run_globals
        code = <code object <module> at 00000000026ADDB0, file "C:\Users\Admin\Anaconda2\lib\site-packages\ipykernel\__main__.py", line 1>
        run_globals = {'__builtins__': <module '__builtin__' (built-in)>, '__file__': 'C:\\Users\\Admin\\Anaconda2\\lib\\site-packages\\ipykernel\\__main__.py', '__package__': 'ipykernel', '__name__': '__main__', 'app': <module 'ipykernel.kernelapp' from 'C:\Users\Admin\Anaconda2\lib\site-packages\ipykernel\kernelapp.pyc'>, '__loader__': <pkgutil.ImpLoader instance at 0x0000000003BCFD08>, '__doc__': None}
     73     return run_globals
     74

C:\Users\Admin\Anaconda2\lib\site-packages\ipykernel\__main__.py in <module>()
      1 if __name__ == '__main__':
      2     from ipykernel import kernelapp as app
----> 3     app.launch_new_instance()
        global app.launch_new_instance = <bound method MetaHasTraits.launch_instance of <class 'ipykernel.kernelapp.IPKernelApp'>>

C:\Users\Admin\Anaconda2\lib\site-packages\traitlets\config\application.pyc in launch_instance(cls=<class 'ipykernel.kernelapp.IPKernelApp'>, argv=None, **kwargs={})
    589         """
    590         app = cls.instance(**kwargs)
--> 591         app.initialize(argv)
        app.initialize = <bound method IPKernelApp.initialize of <ipykernel.kernelapp.IPKernelApp object at 0x0000000003C8DD30>>
        argv = None
    592         app.start()
    593

C:\Users\Admin\Anaconda2\lib\site-packages\ipykernel\kernelapp.pyc in initialize(self=<ipykernel.kernelapp.IPKernelApp object>, argv=None)

C:\Users\Admin\Anaconda2\lib\site-packages\traitlets\config\application.pyc in catch_config_error(method=<function initialize>, app=<ipykernel.kernelapp.IPKernelApp object>, *args=(None,), **kwargs={})
     73     """
     74     try:
---> 75         return method(app, *args, **kwargs)
        method = <function initialize at 0x0000000003C91908>
        app = <ipykernel.kernelapp.IPKernelApp object at 0x0000000003C8DD30>
        args = (None,)
        kwargs = {}
     76     except (TraitError, ArgumentError) as e:
     77         app.print_help()

C:\Users\Admin\Anaconda2\lib\site-packages\ipykernel\kernelapp.pyc in initialize(self=<ipykernel.kernelapp.IPKernelApp object>, argv=None)
    380         self.init_io()
    381         self.init_signal()
--> 382         self.init_kernel()
        self.init_kernel = <bound method IPKernelApp.init_kernel of <ipykernel.kernelapp.IPKernelApp object at 0x0000000003C8DD30>>
    383         # shell init steps
    384         self.init_path()

C:\Users\Admin\Anaconda2\lib\site-packages\ipykernel\kernelapp.pyc in init_kernel(self=<ipykernel.kernelapp.IPKernelApp object>)
    319                                 log=self.log,
    320                                 profile_dir=self.profile_dir,
--> 321                                 user_ns=self.user_ns,
        global user_ns = undefined
        self.user_ns = None
    322         )
    323         kernel.record_ports(self.ports)

C:\Users\Admin\Anaconda2\lib\site-packages\traitlets\config\configurable.pyc in instance(cls=<class 'ipykernel.ipkernel.IPythonKernel'>, *args=(), **kwargs={'iopub_socket': <zmq.sugar.socket.Socket object>, 'log': <logging.Logger object>, 'parent': <ipykernel.kernelapp.IPKernelApp object>, 'profile_dir': <IPython.core.profiledir.ProfileDir object>, 'session': <jupyter_client.session.Session object>, 'shell_streams': [<zmq.eventloop.zmqstream.ZMQStream object>, <zmq.eventloop.zmqstream.ZMQStream object>], 'stdin_socket': <zmq.sugar.socket.Socket object>, 'user_ns': None})
    378         # Create and save the instance
    379         if cls._instance is None:
--> 380             inst = cls(*args, **kwargs)
        inst = undefined
        cls = <class 'ipykernel.ipkernel.IPythonKernel'>
        args = ()
        kwargs = {'log': <logging.Logger object at 0x0000000003CA3278>, 'parent': <ipykernel.kernelapp.IPKernelApp object at 0x0000000003C8DD30>, 'shell_streams': [<zmq.eventloop.zmqstream.ZMQStream object at 0x0000000003CE9AC8>, <zmq.eventloop.zmqstream.ZMQStream object at 0x0000000003CE9C50>], 'user_ns': None, 'iopub_socket': <zmq.sugar.socket.Socket object at 0x0000000003CA2348>, 'profile_dir': <IPython.core.profiledir.ProfileDir object at 0x0000000003CAEA20>, 'session': <jupyter_client.session.Session object at 0x0000000003CAEB00>, 'stdin_socket': <zmq.sugar.socket.Socket object at 0x0000000003CA23A8>}
    381             # Now make sure that the instance will also be returned by
    382             # parent classes' _instance attribute.

C:\Users\Admin\Anaconda2\lib\site-packages\ipykernel\ipkernel.pyc in __init__(self=<ipykernel.ipkernel.IPythonKernel object>, **kwargs={'iopub_socket': <zmq.sugar.socket.Socket object>, 'log': <logging.Logger object>, 'parent': <ipykernel.kernelapp.IPKernelApp object>, 'profile_dir': <IPython.core.profiledir.ProfileDir object>, 'session': <jupyter_client.session.Session object>, 'shell_streams': [<zmq.eventloop.zmqstream.ZMQStream object>, <zmq.eventloop.zmqstream.ZMQStream object>], 'stdin_socket': <zmq.sugar.socket.Socket object>, 'user_ns': None})
     45             user_module = self.user_module,
     46             user_ns     = self.user_ns,
---> 47             kernel      = self,
        global kernel = undefined
        self = <ipykernel.ipkernel.IPythonKernel object at 0x0000000003CE9D68>
     48         )
     49         self.shell.displayhook.session = self.session

C:\Users\Admin\Anaconda2\lib\site-packages\traitlets\config\configurable.pyc in instance(cls=<class 'ipykernel.zmqshell.ZMQInteractiveShell'>, *args=(), **kwargs={'kernel': <ipykernel.ipkernel.IPythonKernel object>, 'parent': <ipykernel.ipkernel.IPythonKernel object>, 'profile_dir': <IPython.core.profiledir.ProfileDir object>, 'user_module': None, 'user_ns': None})
    378         # Create and save the instance
    379         if cls._instance is None:
--> 380             inst = cls(*args, **kwargs)
        inst = undefined
        cls = <class 'ipykernel.zmqshell.ZMQInteractiveShell'>
        args = ()
        kwargs = {'kernel': <ipykernel.ipkernel.IPythonKernel object at 0x0000000003CE9D68>, 'user_ns': None, 'profile_dir': <IPython.core.profiledir.ProfileDir object at 0x0000000003CAEA20>, 'parent': <ipykernel.ipkernel.IPythonKernel object at 0x0000000003CE9D68>, 'user_module': None}
    381             # Now make sure that the instance will also be returned by
    382             # parent classes' _instance attribute.

C:\Users\Admin\Anaconda2\lib\site-packages\IPython\core\interactiveshell.pyc in __init__(self=<ipykernel.zmqshell.ZMQInteractiveShell object>, ipython_dir=None, profile_dir=<IPython.core.profiledir.ProfileDir object>, user_module=None, user_ns=None, custom_exceptions=((), None), **kwargs={'kernel': <ipykernel.ipkernel.IPythonKernel object>, 'parent': <ipykernel.ipkernel.IPythonKernel object>})
    511         self.db = PickleShareDB(os.path.join(self.profile_dir.location, 'db'))
    512
--> 513         self.init_history()
        self.init_history = <bound method ZMQInteractiveShell.init_history of <ipykernel.zmqshell.ZMQInteractiveShell object at 0x0000000003C8DEB8>>
    514         self.init_encoding()
    515         self.init_prefilter()

C:\Users\Admin\Anaconda2\lib\site-packages\IPython\core\interactiveshell.pyc in init_history(self=<ipykernel.zmqshell.ZMQInteractiveShell object>)
   1634     def init_history(self):
   1635         """Sets up the command history, and starts regular autosaves."""
-> 1636         self.history_manager = HistoryManager(shell=self, parent=self)
        self.history_manager = None
        global HistoryManager = <class 'IPython.core.history.HistoryManager'>
        global shell = undefined
        self = <ipykernel.zmqshell.ZMQInteractiveShell object at 0x0000000003C8DEB8>
        global parent = undefined
   1637         self.configurables.append(self.history_manager)
   1638

C:\Users\Admin\Anaconda2\lib\site-packages\IPython\core\history.pyc in __init__(self=<IPython.core.history.HistoryManager object>, shell=<ipykernel.zmqshell.ZMQInteractiveShell object>, config=None, **traits={'parent': <ipykernel.zmqshell.ZMQInteractiveShell object>})
    518             self.save_thread.start()
    519
--> 520         self.new_session()
        self.new_session = <bound method HistoryManager.new_session of <IPython.core.history.HistoryManager object at 0x0000000003CA3898>>
    521
    522     def _get_hist_file_name(self, profile=None):

C:\Users\Admin\Anaconda2\lib\site-packages\IPython\core\history.pyc in new_session(self=<IPython.core.history.HistoryManager object>, conn=None)

C:\Users\Admin\Anaconda2\lib\site-packages\IPython\core\history.pyc in needs_sqlite(f=<function new_session>, self=<IPython.core.history.HistoryManager object>, *a=(None,), **kw={})
     66         return []
     67     else:
---> 68         return f(self, *a, **kw)
        f = <function new_session at 0x0000000003716048>
        self = <IPython.core.history.HistoryManager object at 0x0000000003CA3898>
        a = (None,)
        kw = {}
     69
     70

C:\Users\Admin\Anaconda2\lib\site-packages\IPython\core\history.pyc in new_session(self=<IPython.core.history.HistoryManager object>, conn=<sqlite3.Connection object>)
    536         with conn:
    537             cur = conn.execute("""INSERT INTO sessions VALUES (NULL, ?, NULL,
--> 538                             NULL, "") """, (datetime.datetime.now(),))
        global NULL = undefined
        global Close = undefined
        global the = undefined
        global database = undefined
        global session = undefined
        global filling = undefined
        global end = undefined
        global time = undefined
        global line = undefined
        global count.UPDATE = undefined
        global sessions = undefined
        global SET = undefined
        global num_cmds = undefined
        global WHERE = undefined
    539             self.session_number = cur.lastrowid
    540

OperationalError: attempt to write a readonly database

You'll need to find the database file and grant write access. The file would be of the form history.sqlite and should be found in the IPython directory.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM