anaconda / nbpresent

next generation slides for Jupyter Notebooks
BSD 3-Clause "New" or "Revised" License
164 stars 24 forks source link

Updating and uninstalling not working #84

Open cschwem2er opened 8 years ago

cschwem2er commented 8 years ago

Hi,

I just tried to update all my anaconda packages with conda update --all and received an error for nbpresent:

Linking packages ...
[      COMPLETE      ]|#####################################################################################################| 100%
Unrecognized JSON config file version, assuming version 1
Unrecognized JSON config file version, assuming version 1
Disabling notebook extension nbpresent/js/nbpresent.min...
      - Validating: OK
Disabling: nbpresent
- Writing config: /home/cs/anaconda3/etc/jupyter
Traceback (most recent call last):
  File "/home/cs/anaconda3/bin/jupyter-serverextension", line 6, in <module>
    sys.exit(notebook.serverextensions.main())
  File "/home/cs/anaconda3/lib/python3.5/site-packages/jupyter_core/application.py", line 267, in launch_instance
    return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
  File "/home/cs/anaconda3/lib/python3.5/site-packages/traitlets/config/application.py", line 596, in launch_instance
    app.start()
  File "/home/cs/anaconda3/lib/python3.5/site-packages/notebook/serverextensions.py", line 301, in start
    super(ServerExtensionApp, self).start()
  File "/home/cs/anaconda3/lib/python3.5/site-packages/jupyter_core/application.py", line 256, in start
    self.subapp.start()
  File "/home/cs/anaconda3/lib/python3.5/site-packages/notebook/serverextensions.py", line 218, in start
    self.toggle_server_extension_python(arg)
  File "/home/cs/anaconda3/lib/python3.5/site-packages/notebook/serverextensions.py", line 210, in toggle_server_extension_python
    self.toggle_server_extension(module)
  File "/home/cs/anaconda3/lib/python3.5/site-packages/notebook/serverextensions.py", line 193, in toggle_server_extension
    sys_prefix=self.sys_prefix, logger=self.log)
  File "/home/cs/anaconda3/lib/python3.5/site-packages/notebook/serverextensions.py", line 81, in toggle_serverextension_python
    cm.update("jupyter_notebook_config", cfg)
  File "/home/cs/anaconda3/lib/python3.5/site-packages/traitlets/config/manager.py", line 87, in update
    self.set(section_name, data)
  File "/home/cs/anaconda3/lib/python3.5/site-packages/traitlets/config/manager.py", line 74, in set
    f = io.open(filename, 'w', encoding='utf-8')
PermissionError: [Errno 13] Permission denied: '/home/cs/anaconda3/etc/jupyter/jupyter_notebook_config.json'

Uninstalling the package was also not working:

jupyter nbextension uninstall nbpresent
Unrecognized JSON config file version, assuming version 1
Unrecognized JSON config file version, assuming version 1
Removing: /usr/local/share/jupyter/nbextensions/nbpresent
Traceback (most recent call last):
  File "/home/cs/anaconda3/bin/jupyter-nbextension", line 6, in <module>
    sys.exit(notebook.nbextensions.main())
  File "/home/cs/anaconda3/lib/python3.5/site-packages/jupyter_core/application.py", line 267, in launch_instance
    return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
  File "/home/cs/anaconda3/lib/python3.5/site-packages/traitlets/config/application.py", line 596, in launch_instance
    app.start()
  File "/home/cs/anaconda3/lib/python3.5/site-packages/notebook/nbextensions.py", line 961, in start
    super(NBExtensionApp, self).start()
  File "/home/cs/anaconda3/lib/python3.5/site-packages/jupyter_core/application.py", line 256, in start
    self.subapp.start()
  File "/home/cs/anaconda3/lib/python3.5/site-packages/notebook/nbextensions.py", line 804, in start
    self.uninstall_extensions()
  File "/home/cs/anaconda3/lib/python3.5/site-packages/notebook/nbextensions.py", line 797, in uninstall_extensions
    uninstall_nbextension(self.extra_args[0], **kwargs)
  File "/home/cs/anaconda3/lib/python3.5/site-packages/notebook/nbextensions.py", line 283, in uninstall_nbextension
    shutil.rmtree(full_dest)
  File "/home/cs/anaconda3/lib/python3.5/shutil.py", line 474, in rmtree
    _rmtree_safe_fd(fd, path, onerror)
  File "/home/cs/anaconda3/lib/python3.5/shutil.py", line 412, in _rmtree_safe_fd
    _rmtree_safe_fd(dirfd, fullname, onerror)
  File "/home/cs/anaconda3/lib/python3.5/shutil.py", line 432, in _rmtree_safe_fd
    onerror(os.unlink, fullname, sys.exc_info())
  File "/home/cs/anaconda3/lib/python3.5/shutil.py", line 430, in _rmtree_safe_fd
    os.unlink(name, dir_fd=topfd)
PermissionError: [Errno 13] Permission denied: 'nbpresent.min.css'

My user account is the owner of the corresponding packages and thus has read and write permissions. Can you help me out here?

damianavila commented 8 years ago

It does not seem you have writing permission on home/cs/anaconda3/etc, am I right? If you can't change that thing, I guess you will have to perform a "manual" installation and write the config files in the "user" space. Pinging @bollwyvl, so he can give you his advice as well...

bollwyvl commented 8 years ago

@methodds Yep, hooray permissions!

Perhaps some part of your install was run by a different user? This could potentially be problematic!

ls -lathr /home/cs/anaconda3

If you're seeing anything other than cs as the owner, then you probably just want to:

chown -R cs /home/cs/anaconda3

... unless this is a shared install between cs and other users...

Resorting to a "manual" install is a bit nasty, and would likely run into the same issues as the conda-managed approaches... and is fraught with more peril (though your jupyter should always still work). But anyhoo:

jupyter nbextension install nbpresent --user --py
jupyter nbextension enable nbpresent --user --py
jupyter serverextension enable nbpresent --user --py

Of note, though, is that doing this may will mess with your other extensions, as presently serverextensions from your conda env will be clobbered by your user dir config... but not your nbextensions, which can lead to some "interesting" effects.

Let us know how we can be of additional assistance!