3

I am unable to open jupyter notebook .ipynb files (i can open jupyter notebook, but when i click on a .ipynb it exits with unkown error) Therefore i want to completely get rid of jupyter and ipython.

I deinstalled jupyter and ipython with sudo pip uninstall, also with pip2 and pip3, but still i am able to find jupyter at /usr/local/bin/jupyter and i am also able to start it with jupyter.

If i now reinstall jupyter with pip, i get the same errors as before, so i guess it always starts the same that i still installed.

So how can i deinstall this? just remove the binary?

Edit1: i am using python 2.7 and Ubuntu 16.04 if that matters

Edit2: i got basically the same problem as this pip uninstall jupyter does not work but which jupyter returns

Edit3: The complete error output when i try to open a jupyter-notebook:

[E 14:59:58.222 NotebookApp] Uncaught exception GET /api/contents/workspace/Mobile_Mask_RCNN/samples/demo.ipynb?type=notebook&_=1523883598008 (127.0.0.1)
    HTTPServerRequest(protocol='http', host='localhost:8888', method='GET', uri='/api/contents/workspace/Mobile_Mask_RCNN/samples/demo.ipynb?type=notebook&_=1523883598008', version='HTTP/1.1', remote_ip='127.0.0.1', headers={'Accept-Language': 'de-DE,en-US;q=0.5', 'Accept-Encoding': 'gzip, deflate', 'X-Xsrftoken': '2|ef5ec4f7|efb210b548db14e572dec5fa47cd9d4c|1523879395', 'X-Requested-With': 'XMLHttpRequest', 'Host': 'localhost:8888', 'Accept': 'application/json, text/javascript, */*; q=0.01', 'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:59.0) Gecko/20100101 Firefox/59.0', 'Connection': 'keep-alive', 'Referer': 'http://localhost:8888/notebooks/workspace/Mobile_Mask_RCNN/samples/demo.ipynb', 'Cookie': '_xsrf=2|ef5ec4f7|efb210b548db14e572dec5fa47cd9d4c|1523879395; username-localhost-8888="2|1:0|10:1523883578|23:username-localhost-8888|44:YjJhYjc1MjI4Y2UwNDBlMDg1ZGJkN2QyMTkzZmM5ZGU=|c9400d948f07d89cf10b581a1251394138f0f7180395bdcffd5df47bd396c189"'})
    Traceback (most recent call last):
      File "/usr/local/lib/python2.7/dist-packages/tornado/web.py", line 1512, in _execute
        result = yield result
      File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 1055, in run
        value = future.result()
      File "/usr/local/lib/python2.7/dist-packages/tornado/concurrent.py", line 238, in result
        raise_exc_info(self._exc_info)
      File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 307, in wrapper
        yielded = next(result)
      File "/usr/local/lib/python2.7/dist-packages/notebook/services/contents/handlers.py", line 112, in get
        path=path, type=type, format=format, content=content,
      File "/usr/local/lib/python2.7/dist-packages/notebook/services/contents/filemanager.py", line 418, in get
        model = self._notebook_model(path, content=content)
      File "/usr/local/lib/python2.7/dist-packages/notebook/services/contents/filemanager.py", line 378, in _notebook_model
        self.mark_trusted_cells(nb, path)
      File "/usr/local/lib/python2.7/dist-packages/notebook/services/contents/manager.py", line 502, in mark_trusted_cells
        trusted = self.notary.check_signature(nb)
      File "/usr/local/lib/python2.7/dist-packages/nbformat/sign.py", line 438, in check_signature
        signature = self.compute_signature(nb)
      File "/usr/local/lib/python2.7/dist-packages/nbformat/sign.py", line 413, in compute_signature
        hmac = HMAC(self.secret, digestmod=self.digestmod)
      File "/usr/local/lib/python2.7/dist-packages/traitlets/traitlets.py", line 556, in __get__
        return self.get(obj, cls)
      File "/usr/local/lib/python2.7/dist-packages/traitlets/traitlets.py", line 535, in get
        value = self._validate(obj, dynamic_default())
      File "/usr/local/lib/python2.7/dist-packages/nbformat/sign.py", line 387, in _secret_default
        self._write_secret_file(secret)
      File "/usr/local/lib/python2.7/dist-packages/nbformat/sign.py", line 397, in _write_secret_file
        with io.open(self.secret_file, 'wb') as f:
    IOError: [Errno 13] Permission denied: '/home/gustav/.local/share/jupyter/notebook_secret'
[W 14:59:58.223 NotebookApp] Unhandled error
[E 14:59:58.223 NotebookApp] {
      "Accept-Language": "de-DE,en-US;q=0.5", 
      "Accept-Encoding": "gzip, deflate", 
      "X-Xsrftoken": "2|ef5ec4f7|efb210b548db14e572dec5fa47cd9d4c|1523879395", 
      "X-Requested-With": "XMLHttpRequest", 
      "Host": "localhost:8888", 
      "Accept": "application/json, text/javascript, */*; q=0.01", 
      "User-Agent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:59.0) Gecko/20100101 Firefox/59.0", 
      "Connection": "keep-alive", 
      "Referer": "http://localhost:8888/notebooks/workspace/Mobile_Mask_RCNN/samples/demo.ipynb", 
      "Cookie": "_xsrf=2|ef5ec4f7|efb210b548db14e572dec5fa47cd9d4c|1523879395; username-localhost-8888=\"2|1:0|10:1523883578|23:username-localhost-8888|44:YjJhYjc1MjI4Y2UwNDBlMDg1ZGJkN2QyMTkzZmM5ZGU=|c9400d948f07d89cf10b581a1251394138f0f7180395bdcffd5df47bd396c189\""
    }
[E 14:59:58.223 NotebookApp] 500 GET /api/contents/workspace/Mobile_Mask_RCNN/samples/demo.ipynb?type=notebook&_=1523883598008 (127.0.0.1) 37.67ms referer=http://localhost:8888/notebooks/workspace/Mobile_Mask_RCNN/samples/demo.ipynb
gustavz
  • 2,964
  • 3
  • 25
  • 47
  • i know conda and i knrow virstual envs, but my problem is as stated and i want to get rid of it :D – gustavz Apr 16 '18 at 14:14
  • You have a permissions issue. Hopefully it's just due to the `/home/gustav/.local/share/jupyter` directory not existing, cuz that's easy to fix – tel Apr 17 '18 at 23:04

1 Answers1

4

Fixing the jupyter error

You have a permissions issue:

IOError: [Errno 13] Permission denied: '/home/gustav/.local/share/jupyter/notebook_secret'

Uninstalling is not going to help, at least not directly. You might be able to fix it by entering this command in a terminal:

mkdir -p ${HOME}/.local/share/jupyter

This will fix the error if it was due to the .local/share/jupyter directory not existing.

Completely uninstalling jupyter

If you can't fix the permission issue, here's the simplest set of commands for nuking jupyter from space:

pip install pip-autoremove
pip-autoremove jupyter -y

From a little bit of testing I just did, you might also have to run at the end:

pip-autoremove jupyter-core -y

Opening .ipynb files with a doubleclick

You can't open .ipynb with just vanilla Jupyter by double clicking. This is by design (also arguably a design flaw, but eh). You can add this functionality with the nbopen project.

To install on Ubuntu, just run the following in a terminal:

python3 -m pip install nbopen
python3 -m nbopen.install_xdg

I haven't tested this though since I'm not running Linux.

How to open .ipynb files the "normal" way

You can't open .ipynb with just vanilla Jupyter by double clicking. This is by design (also arguably a design flaw, but eh).

Instead, you have to open files in the Jupyter file manager, which you run like this:

  1. Open a new terminal window (in Ubuntu you can just enter Ctrl+Alt+T).

  2. Start up the notebook server by running jupyter notebook

  3. This should automatically open a new window in your internet browser that's pointing to the Jupyter file manager. If it doesn't, there'll be a line in your terminal that says something like

    Copy/paste this URL into your browser when you connect for the first time, to login with a token:
    

    In that case, just copy the following URL into the address bar of a browser window and hit enter.

  4. You should now have a browser window showing the Jupyter file manager. Use the file manager to navigate to the .ipynb you want to open, and then just click on it.

Admittedly a bit convoluted, especially at first. I believe the reason Jupyter is set up this way goes back to its server-based architecture, and the fact that the design team wanted it to be easily/seamlessly deployed on remote computers.

tel
  • 13,005
  • 2
  • 44
  • 62