SoFunction
Updated on 2024-11-21

jupyter flashback how to do?jupyter flashback problem solving

Description of the problem

This system is Win10, after installing Anaconda3, I can use jupyter notebook normally, but because of installing the plugin, when I start jupyter notebook again, it will flash back.

Later, it was found that the upgrade of the library and some other operations can also cause flashback phenomenon, of course, you can reinstall Anaconda to repair, but through the query and personal practice!

Verify that the following three methods restart jupyter notebook:

Problem solving

First: command line startup

Launching Anaconda Prompt

Enter the command jupyter notebook to access jupyter notebook;

Second: modify the target content of the jupyter notbook shortcut

Right-click Jupyter notebook under Anaconda in the Start menu.

More - To open the file location, right-click on the Jupyter notebook shortcut, select Properties, and change the destination to your Anaconda3 installation directory: . \Anaconda3\Scripts\ then apply.

Once closed, click on the jupyter notebook shortcut in the Start menu to launch it.

Note: My Anaconda3 is installed under C:\ProgramData\.

The original content of the target of the jupyter notebook shortcut under Anaconda3 is as follows:

C:\ProgramData\Anaconda3\ C:\ProgramData\Anaconda3\ C:\ProgramData\Anaconda3 C:\ProgramData\Anaconda3\ C:\ProgramData\Anaconda3\Scripts\ "%USERPROFILE%/"

Why is it flashing back?

It's because ""No more.

Open the directory "C:\ProgramData\Anaconda3\Scripts", there is no more " ", but there is a " ", directly double click! This item can also start jupyter notebook, so change the target of the jupyter notebook shortcut to this file.

Third: Repairing the document

I just said why it flashes back is that the file "" is missing, so regenerate it.

Start Anaconda Prompt and enter the command: jupyter notebook --generate-config.

Or copy the ready-made files to the Anaconda3 installation directory under Scripts, my installation directory "C:\ProgramData\Anaconda3\Scripts", that is, to supplement the complete path C:\ProgramData\Anaconda3\ Scripts\.

Additional notes: jupyter notebook --generate-config command is to generate the configuration file for jupyter notebook, modify the configuration file can also modify the default working path of JupyterNotebook in Anaconda

Specific modification of the configuration file method

  • Open Anaconda Prompt and type jupyter notebook --generate-config

The purpose of this command is to generate a configuration file for Jupyter notebook. If you are running it for the first time, it will generate the file directly. If you've run this command before, you'll be asked to overwrite the original file, as in the image below. Don't worry about that. Our main goal is just to find the path to the file.

  • Find the path to jupyter_notebook_config.py according to the first step and open this file.

Find the variable .notebook_dir, assign the path you want to this variable, and delete the "#" in front of this line. The modification will look like this:

Always make sure to remove the "#" to cancel the comment mode on this line.

This line of code cannot be preceded by a space.

The path must already exist, otherwise it will flash back. And the path should be enclosed in English single quotes.

  • Save the changes. When you enter Jupyter Notebook through Anaconda Navigator again, you will find that the default path has been changed.
  • However, if you enter directly through the Jupyter Notebook shortcut, the default directory is still the same. If you need to change it, you still need to do the following steps:
  • Find the shortcut, right click on it, open the properties, and delete "%USERPROFILE%" at the end of the "Target".

Encountering those potholes and speculating on why

It's not that these methods are wrong, it's just that they probably don't fit my own system and environment.

1. The Internet says to open "cmd" and run the command "jupyter notebook --generate-config"

This is probably because Jupyter Notebook is installed via Anaconda, so there are no environment variables configured outside of the Anaconda environment.

2. According to the path posted online directly look for "Jupyter_notebook_config.py" file, found that there is no such file.

Again, if you have never run the generate command, you will not have this configuration file.

3. It is said that modifying the jupyter_notebook_config.json file in the etc\jupyter folder in the Anaconda installation directory is also possible. However, my file opens empty. I don't know why.

4. It is said that you can only change the properties of the shortcut: "%USERPROFILE%" in the "target" is deleted, and the "start location" is changed to the path you want.

Changing just these two places without changing the jupyter_notebook_config.py file doesn't do anything. If you change jupyter_notebook_config.py and leave both places unchanged, entering Jupyter Notebook from this shortcut takes you to the default path, and launching with Anaconda Navigator takes you to the changed path. If you make changes to the "Target" field, then you can enter it from the shortcut, and it will take you to the changed path as well. It does not matter if you change the value in the "From" column or not.

summarize

The above is a personal experience, I hope it can give you a reference, and I hope you can support me more.