如何完全卸载jupyter

时间:2018-04-16 12:20:40

标签: pip ipython jupyter-notebook jupyter

我无法打开jupyter笔记本.ipynb文件(我可以打开jupyter笔记本,但是当我点击.ipynb时,它会以未知错误退出) 因此,我想完全摆脱jupyter和ipython。

我用sudo pip uninstallpip2pip3卸载了jupyter和ipython,但我仍能在/usr/local/bin/jupyter找到jupyter,我也能够开始它与jupyter

如果我现在用pip重新安装jupyter,我会得到和以前一样的错误,所以我猜它总是与我仍然安装的相同。

那么我该如何卸载呢?只是删除二进制文件?

EDIT1: 如果重要,我正在使用python 2.7Ubuntu 16.04

EDIT2: 我得到了与pip uninstall jupyter does not work but which jupyter returns

基本相同的问题

EDIT3: 我尝试打开一个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

1 个答案:

答案 0 :(得分:0)

修复jupyter错误

您有权限问题:

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

卸载不会有帮助,至少不会直接帮助。您可以通过在终端中输入此命令来修复它:

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

如果错误是由于.local/share/jupyter目录不存在,这将解决错误。

完全卸载jupyter

如果您无法解决权限问题,请参阅以下最简单的空间jupyter命令集:

pip install pip-autoremove
pip-autoremove jupyter -y

从我刚刚做过的一些测试中,你可能还需要在最后运行:

pip-autoremove jupyter-core -y

使用双击

打开.ipynb个文件

双击后,您只能通过香草Jupyter打开.ipynb。这是设计(也可以说是一个设计缺陷,但是呃)。您可以使用nbopen项目添加此功能。

要在Ubuntu上安装,只需在终端中运行以下命令:

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

我还没有对此进行测试,因为我没有运行Linux。

如何打开.ipynb文件"正常"方式

双击后,您只能通过香草Jupyter打开.ipynb。这是设计(也可以说是一个设计缺陷,但是呃)。

相反,你必须在Jupyter文件管理器中打开文件,你可以这样运行:

  1. 打开一个新的终端窗口(在Ubuntu中,您只需输入 Ctrl + Alt + T )。

  2. 运行jupyter notebook

  3. 启动笔记本电脑服务器
  4. 这应该会在您的互联网浏览器中自动打开一个指向Jupyter文件管理器的新窗口。如果它没有,那么终端中就会出现类似

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

    在这种情况下,只需将以下网址复制到浏览器窗口的地址栏中,然后按回车键。

  5. 您现在应该有一个显示Jupyter文件管理器的浏览器窗口。使用文件管理器导航到您要打开的.ipynb,然后点击它。

  6. 不可否认,特别是起初有点费解。我相信Jupyter以这种方式设置的原因可以追溯到其基于服务器的架构,以及设计团队希望它可以轻松/无缝地部署在远程计算机上的事实。