How to reset iPython/Jupyter profile after upgrade to 'factory' defaults?

*爱你&永不变心* 提交于 2020-05-29 06:05:21

问题


Returning to using iPython Notebooks after a year, [I installed my distro's version of Jupyter and now] Jupyter launches without menu bar. I'm guessing some of my old settings are carrying over. I'm guessing the fastest way to fix this is to .bak the old profile and create a new default.

First, initialized a Jupyter profile from instructions on how-to setup multiple Jupyter profiles:

$ jupyter notebook --generate-config

Then, [after further investigation] I created a new iPython profile,

$ ipython profile create foo

I followed found advise to renamed profile_foo to profile_default. Then,

Still not reset to 'factory'. What am I missing?

UPDATE: [edit] plus, I reordered what were my actual rebuilding profiles steps--in case there is some propagation of settings, where the order matters (haha. Maybe I'm recreating the incorrect order...?)


回答1:


You can use jupyter --paths to get a list of all the places Jupyter is storing dynamic data. That includes configuration + extensions + kernel information.

For me it looked like something like this:

$ jupyter --paths
config:
    /home/username/.jupyter
    /home/username/.pyenv/versions/miniconda3-4.3.30/etc/jupyter
    /usr/local/etc/jupyter
    /etc/jupyter
data:
    /home/username/Library/Jupyter
    /home/username/.pyenv/versions/miniconda3-4.3.30/share/jupyter
    /usr/local/share/jupyter
    /usr/share/jupyter
runtime:
    /home/username/Library/Jupyter/runtime

At your own risk: I just rm -r'ed every single directory listed by jupyter --paths, and that gave me a fresh "factory defaults" jupyter environment.




回答2:


Fixed!

I'm guessing there is a directed-ness to the Jupyter system (python, ipython, jupyter, a browser) where I have to reset parts in order.

I will take a guess and put these in a specific order. (Others can reorder if this turns out meaningful):

  1. Update python packages
  2. Created a new iPython profile: $ ipython profile create foo
  3. Rename profile_foo to profile_default
  4. Initialize a Jupyter profile: $ jupyter notebook --generate-config
  5. Clear the cache in your browser **:
    • Chrome (v52),
      • "Cookies and other site data"
      • "Cached images and files"
    • Firefox (v47),
      • "Offline web content and user data"
      • "Cached web content"

CAUTION: I'm assuming any existing iPython/Jupyter settings are not an issue, because the goal is to restore to factory, so to speak. And, I'm also assuming you're trying not to delete your saved passwords or bookmarks or history during a browser cache clearing step.

** I'm not clear which cache settings specifically include iPython/Jupyter data. These are only the settings I used and the problem was fixed.



来源:https://stackoverflow.com/questions/38948192/how-to-reset-ipython-jupyter-profile-after-upgrade-to-factory-defaults

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!