Tag Archives: jupyter notebook

Change Jupyter Notebook Default Directory

Change Jupyter Notebook Default Directory

There are three way to change the default (i.e., start-up) directory of jupyter notebook.

Solution #1
1. Use command line (aka, cmd), run the following command: this will generate a config file (jupyter_notebook_config.py), in your working location (C:\Users[Your Username].jupyter).
jupyter notebook --generate-config
2. Goto that location (C:\Users[Your Username].jupyter) and edit file jupyter_notebook_config.py as follow.
Find line:

## The directory to use for notebooks and kernels.
#c.NotebookApp.notebook_dir = ''

3. Delete the “#” and type your default directory inside the ”. (Make sure the directory is exist, or it may causes some troubles)
For example:

## The directory to use for notebooks and kernels.
c.NotebookApp.notebook_dir = 'E:\Default Jupyter Dir\'

Solution #2
1. Find the Jupyter Notebook execute file.
2. Right click the file
3. Find “properties” tab and click it; this will lead you to the “Jupyter Notebook Properties”
4. Check the pop-up window, and you should see “Start in” property.
5. Change the directory to your default directory, e.g., ‘E:\Default Jupyter Dir\’
Solution #3

This solution is based on Anaconda, since Jupyter Notebook load the profile from Anaconda.

You may see the following information from properties window if you had gone through Solution #2.

"Target: D:\Anaconda3\python.exe d:\Anaconda3\cwp.py d:\Anaconda3 "d:/Anaconda3/python.exe" "d:/Anaconda3/Scripts/jupyter-notebook-script.py" %USERPROFILE%"

1. Goto the Anaconda installed location.
2. Find the ‘etc’ directory in Anaconda.
3. Open file ‘jupyter_notebook_config.json’
4. Add your default directory to the ‘notebook_dir’.

Anaconda Jupiter notebook kernel error solution

1. First list the available kernel list,
2. Delete the original kernel;
3. Check if there is a kernel in ipython of Anaconda.
4. Reinstall kernel.
The specific orders are as follows:

$ jupyter kernelspec list
Available kernels:
python3 /home/miracode2033/anaconda3/share/jupyter/kernels/python3
$ rm -r /home/miracode2033/anaconda3/share/jupyter/kernels/python3
$ jupyter kernelspec list
Available kernels:
python3 /home/miracode2033/anaconda3/lib/python3.6/site-packages/ipykernel/resources
$ python -m ipykernel install --user
Installed kernelspec python3 in /home/miracode2033/.local/share/jupyter/kernels/python3


[Fixed]Error executing Jupyter command ‘notebook’: [Errno ‘jupyter-notebook’ not found] 2

The problem
First install jupyter, command PIP install jupyter

(venv) D:\MLiA>pip install jupyter

Collecting jupyter
  Downloading https://files.pythonhosted.org/packages/83/df/0f5dd132200728a86190397e1ea87cd76244e42d39ec5e88efd25b2abd7e/jupyter-1.0.0-py2
Collecting ipywidgets (from jupyter)
  Downloading https://files.pythonhosted.org/packages/34/3a/5b258ea6d584f5a8527c2295d0ebf7ffb1654e3de38d37697f88bbef6621/ipywidgets-7.4.0-
py2.py3-none-any.whl (109kB)
    100% |████████████████████████████████| 112kB 728kB/s

Then, it started jupyter , but prompted an error

(venv) D:\MLiA>jupyter notebook

Error executing Jupyter command 'notebook': [Errno 'jupyter-notebook' not found] 2

The solution
Enter jupyter - notebook </ code>

(venv) D:\MLiA>jupyter-notebook

[I 15:33:17.594 NotebookApp] Writing notebook server cookie secret to C:\Users\AppData\Roaming\jupyter\runtime\notebook_cookie_secre
[W 15:33:18.032 NotebookApp] Terminals not available (error was No module named 'winpty.cywinpty')
[I 15:33:18.032 NotebookApp] Serving notebooks from local directory: D:\MLiA
[I 15:33:18.032 NotebookApp] The Jupyter Notebook is running at:
[I 15:33:18.032 NotebookApp] http://localhost:8888/?token=58d6cbb67aba487dc5f952ebdea19a8462f2ba551cd24a21
[I 15:33:18.032 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 15:33:18.063 NotebookApp]

Reference data: https://stackoverflow.com/questions/42648610/error-when-executing-jupyter-notebook-no-such-file-or-directory

Error kernel restart: restart failed was reported in the background of jupyter notebook

after successful installation by PIP install jupyter In the CMD window, run the jupyter notebook, and it was found that the left side of the code In [] changed to In [*], and the error was reported In the CMD window as follows:

KernelRestarter: restart failed. Kernel restart failed

solution: PIP install –upgrade ipykernel will upgrade it can run normally, although it will prompt you prompt toolkit version should be between 1.0 and 2.0, but it does not affect the operation of prompyter notebook. In the upgrade process, the main updated module is the prompt_toolkit, it seems that because the version of this module is too low, it leads to

How to Fix nbconvert failed: Pandoc wasn’t found. Please check that pandoc is installed:

when you want to convert your Jupyte Notebook to PDF, this can appear:


1 download pandoc library and install, download address: http://pandoc.org/installing.html#windows

ps: domestic didn’t over the wall of friends may not be able to download or slow download speed, CSDN download address: http://download.csdn.net/download/weixin_37029453/10161639

2 download and install MikTeX

3 in Jupyter to PDF operation, as shown in the picture:

after the system will pop up the interface to let you install some toolkits, continue to click the installation, installation is done!

> /strong>