Peter Estiven
Peter Estiven

Reputation: 424

Python path and Juptyter notebook on Windows

I've installed Python and Jupyter in a folder. And then, I moved this folder. Python was in E:\Python and Jupyter in E:\Python\Scripts. Now, Python is in E:\Projects\Tests\Python and Jupyter is in E:\Projects\Tests\Python\Scripts.

When I try to start Jupyter notebook with command Line (jupyter notebook) from E:\Projects\Tests\Python\Scripts, I have the error :

Fatal error in launcher: Unable to create process using
'"E:\Python\python.exe" "E:\Projects\Tests\Python\Scripts\jupyter.exe" notebook'

Jupyter kept the old Python path.

How can I specify the new path? Is there a command line like

start "E:\Projects\Tests\Python\python.exe" "E:\Projects\Tests\Python\Scripts\jupyter.exe" notebook'

(this doesn't work)

Upvotes: 1

Views: 6227

Answers (2)

gehbiszumeis
gehbiszumeis

Reputation: 3711

It seems that jupyter doesn't find the new directory in the %path% variable.

Do you find your new directories in the %path% variable when you type

echo %path%

in a command window? If no, try to add it by typing in the command line

setx path "%path%;E:\Projects\Tests\Python\python.exe;E:\Projects\Tests\Python\Scripts\jupyter.exe"

EDIT: Changing the windows %path% is not desired.

Preferred is a change of the ipython_config.py file

In that case, open a command window and type

ipython profile create

and

ipython locate

This will output you the path of your .ipython folder, which contains now a default ipython_config.py. Go to this line

## lines of code to run at IPython startup.
#c.InteractiveShellApp.exec_lines = []

and replace the second line by

c.InteractiveShellApp.exec_lines = ['import sys; 
                                     sys.path.append("E:\Projects\Tests\Python\"); 
                                     sys.path.append("E:\Projects\Tests\Python\Scripts\")']

This will append your new paths TEMPORARY to the path variable every time jupyter notebook starts iPython. So every time you move your folders you would have to adjust these lines in the ipython_config.py.

Upvotes: 2

knuspertante
knuspertante

Reputation: 68

Try to reinstall jupyter.

pip install --upgrade --no-deps --force-reinstall jupyter

Upvotes: 0

Related Questions