Jupiter notebook как изменить начальную директорию

I tried following the instructions given on the Jupyter Notebook documentation. Unfortunately, I haven't been able to figure it out. Where exactly is this "start in" field? I've a windows 7 (64 b...

Jupyter Notebook and JupyterLab < 3.0

For old Jupyter Notebook interface installed with notebook package and run as jupyter notebook (see the next section for the identical interface installed with nbclassic and run with jupyter nbclassic, and for JupyterLab):

  1. Open cmd (or Anaconda Prompt) and run jupyter notebook --generate-config.

  2. This writes a file to C:Usersusername.jupyterjupyter_notebook_config.py.

  3. Browse to the file location and open it in an Editor

  4. Search for the following line in the file:
    #c.NotebookApp.notebook_dir = ''

  5. Replace by c.NotebookApp.notebook_dir = '/the/path/to/home/folder/'

    Make sure you use forward slashes in your path and use /home/user/ instead of ~/ for your home directory, backslashes could be used if placed in double quotes even if folder name contains spaces as such :
    "D:yourUserNameAny FolderMore Folders"

  6. Remove the # at the beginning of the line to allow the line to execute

JupyterLab >= 3, Jupyter Notebook Classic, and RetroLab

For recent nbclassic and JupyterLab >= 3 use c.ServerApp.root_dir instead of c.NotebookApp.notebook_dir (and jupyter server --generate-config instead of jupyter notebook --generate-config).

For context see migration guide and this question on differences between server and notebook.

krassowski's user avatar

krassowski

12.4k4 gold badges52 silver badges86 bronze badges

answered Nov 9, 2016 at 19:51

marneylc's user avatar

marneylcmarneylc

6,9502 gold badges12 silver badges8 bronze badges

24

cd into the directory or a parent directory (with the intended directory you will work nested in it).

Note it must be a folder (E:> — This will not work)

Then just run the command jupyter notebook

answered Sep 12, 2016 at 15:28

Victor O's user avatar

Victor OVictor O

2,4511 gold badge9 silver badges2 bronze badges

14

I am on Windows 10 but same version of Anaconda.

  1. Click on the Start Menu, then All Programs (just Programs for Win10)
  2. Click on the Anaconda3 folder; mine is Anaconda3 (64-bit)
  3. In there you should see Jupyter Notebook. If you have a virtual environment installed, it will be followed by the environment name like this: Jupyter Notebook (env)
  4. Right-click Jupyter Notebook entry and navigate to More => Open File Location
  5. Right-click the correct Jupyter Notebook entry, then click on Properties
  6. Enter a path in the Start in: box; if the path has spaces in it, you must enclose it in double quotes
  7. Delete «%USERPROFILE%» at the end of the executable path

User navigating to Anaconda3 folder (in Windows ; in AppData), editing properties of "Jupyter Notebook" shortcut, to change its "Start in" command to point to a directory where you want Jupyter to start

Adam12344's user avatar

Adam12344

1,02316 silver badges31 bronze badges

answered Apr 5, 2016 at 17:41

cb4's user avatar

cb4cb4

5,5395 gold badges43 silver badges54 bronze badges

13

First try to run

jupyter notebook --notebook-dir="C:/Your/Desired/Start/Directory/"

in a command line (cmd) to see if the Jupyter notebook opens at the desired location.

If yes, then you can make it a shortcut by:

  1. In a Windows File Explorer or on the desktop, Right click > New > Shortcut

  2. Enter the following location and click next:

jupyter notebook --notebook-dir="C:/Your/Desired/Start/Directory/"

  1. Enter a name for your shortcut and finish

Now you have a shortcut to start Jupyter at the location you want. This works on Windows 7, macOS, and Linux.
For windows best to enclose the path in double quotes " as single quotes ' will not work if there is a space in the pathname

Note if you found the error saying the path is not valid, try using common slash / instead of backslash in the path like
jupyter notebook --notebook-dir="D:/"

answered Aug 4, 2017 at 20:35

Louis Yang's user avatar

Louis YangLouis Yang

3,3921 gold badge25 silver badges24 bronze badges

4

I just had the same problem and tested the methods mentioned above. After several trials, I realized that they are partially correct and are not the complete solution. I tested the below in Windows 10 and Anaconda 4.4.0 with python 3.6.

There are two ways to do even though they have only very small difference.
Follow the way marneylc suggested above: i.e.

1) Open «Anaconda Prompt» and type jupyter notebook --generate-config

2) You find the file in C:Usersusername.jupyterjupyter_notebook_config.py

3) Change the line of #c.NotebookApp.notebook_dir = ''
to c.NotebookApp.notebook_dir = 'c:testyour_root'

4) Then, go to the shortcut of Jupyter Notebook located in C:UsersUser_nameAppDataRoamingMicrosoftWindowsStart MenuProgramsAnaconda3 (64-bit)

5) Do the right click and go to the Properties

6) In the Target field, remove %USERPROFILE% as stenlytw suggested above.

7) Then, In the field of Start in, type the same directory of c:testyour_root in jupyter_notebook_config.py

8) Done!

As the simpler way, after step 3, go to C:UsersUser_nameAnaconda3Scripts

4-2) You can see the file of jupyter-notebook.exe and click it.

5-2) Then, the Jupyter start the folder you specified in jupyter_notebook_config.py. So make the shortcut of this file.

6-2) Done.

answered Jun 9, 2017 at 17:32

Yul's user avatar

YulYul

3,1482 gold badges16 silver badges13 bronze badges

6

So the answers above helped, but please allow me to make it clear so other people who aren’t very familiar with MS-Windows can work it out in the same way:

This issue happens when Windows 10 installs Anaconda with Python, Ipython, and Jupyter Notebook.

First open the Anaconda Prompt and type the following into the prompt:

jupyter notebook --generate-config

You will get something like this:
enter image description here

You don’t have to do anything on the prompt anymore. I didn’t snapshot my full address because of privacy, but it shows something like:

C:Usersname.jupyter

Find this folder on your C: drive, and in this folder, find the python file jupyter_notebook_config.py. Drag the file into a Notepad ++ to edit it.
When editing, look around line 214, for the string that looks like:

#c.NotebookApp.notebook_dir = ''

Uncomment it, i.e., delete the «#» in the first column. Now add our target folder address into the ‘ ‘ like this:

c.NotebookApp.notebook_dir = 'C:\Users\name\Desktop\foldername'

Then save the file. Then open anaconda prompt again, type jupyter notebook. This should launch Jupyter Notebook in the browser in the folder with the above address. Here, the key point is to UNCOMMENT (which means to delete) the # at front of the line, and then, USE \ double slashes (for the path separator) between folders. If you use only single slashes , it won’t work.

That’s all.

Rich Lysakowski PhD's user avatar

answered Jul 16, 2018 at 14:13

ACuriousCat's user avatar

ACuriousCatACuriousCat

9731 gold badge7 silver badges19 bronze badges

6

You can change the configuration from conda command line:

  • run anaconda command prompt
  • run jupyter notebook --generate-config
  • a directory .jupyter/ should have created in your home with a file jupyter_notebook_config.py
  • uncomment and edit the field c.NotebookApp.notebook_dir

credit to Clement https://groups.google.com/a/continuum.io/forum/#!topic/anaconda/gqRwT_SxGBw

Kenny Evitt's user avatar

Kenny Evitt

9,0635 gold badges66 silver badges90 bronze badges

answered Dec 25, 2016 at 13:38

shahar_m's user avatar

shahar_mshahar_m

3,3545 gold badges40 silver badges60 bronze badges

3

I’m using windows 7 (64 bit) with Anaconda2. In the start menu, right click Jupyter Notebook -> Properties. In the Target field, change %USERPROFILE% to your new "D:path".

                         jupyter

answered May 22, 2017 at 4:35

stenlytw's user avatar

stenlytwstenlytw

92813 silver badges18 bronze badges

2

For Windows 10:

  1. Look for Jupiter notebook shortcut (in Start menu>Anaconda).
  2. Right click and Properties.
  3. Add the path that you would like (but use / not for path) as showed on the screenshot:

enter image description here

answered Dec 17, 2019 at 19:47

vasili111's user avatar

vasili111vasili111

5,61410 gold badges47 silver badges77 bronze badges

2

The easiest and the simple way to open Jupyter Notebook from the desired location is to open Anaconda Prompt(possible only if you installed Python using Anaconda Distribution).

Open the desired location in Windows File Explorer, copy the desired location from the address bar of Windows File Explorer. Alt + D goes to the address bar and Ctrl + C copies the location.

Windows File Explorer

Now open the Anaconda Prompt and type the following command:

cd D:desired location

Somehow, the Anaconda Prompt returns to the original location. Enter ‘d:’ and the prompt will reach your desired location(as shown in the image below). Note that you must enter the drive letter of your desired location(C: for C: drive-the primary partition).
Anaconda Prompt

Afterward, type ‘jupyter notebook’ and the Jupyter Notebook will be opened.
Anaconda Prompt

Note that the Jupyter Notebook’s home page does not list anything as the folder is empty.
Jupyter Notebook

Once a Python3 notebook is created, the home page will list the files.
Jupyter Notebook

This way you can open Jupyter Notebook from any location, without having to deal with all the complexities of going to the installed location and making the necessary tweaks.

answered Sep 11, 2020 at 7:23

Bipin's user avatar

BipinBipin

4437 silver badges12 bronze badges

1

This question is quite old and the problem seems to have been solved, but if only to remind myself next time I am facing this problem, here is another solution (tested only on Windows 10, though).

The shortcut for the jupyter notebook (be it from the start menu, a desktop shortcut or pinned to the taskbar) calls a number of Scripts (presumably to initialize the jupyter notebook etc.), which are written in the Target text field from the shortcut’s Properties window.
Appending

--notebook-dir='C:/Your/Desired/Start/Directory/'

should start the notebook in the specified directory (as @Victor O pointed out, it cannot be a drive, but has to be a folder).
If that doesn’t do the trick, it can’t hurt to also add the same directory to the Start in field.

Note: I used forward-slashes in the Target field and back-slashes in the Start in field. Feel free to change that up, if you are curious which combinations are working.

Also, this was not my idea, but I forgot where it came from (I checked the shortcut from my previous installation, because I was sure not to have tried anything from this page, but the proposed way from the link the OP provided.). If anyone wants to supply the link, please do so.

Sorry if I can’t add any fundamental research to this, but the solution worked for me on four separate systems and is fairly simple to implement.

answered Jan 1, 2017 at 15:39

niak's user avatar

niakniak

3203 silver badges10 bronze badges

0

agree to most answers except that in jupyter_notebook_config.py, you have to put

#c.NotebookApp.notebook_dir='c:\test\your_root'

double \ is the key answer

Machavity's user avatar

Machavity

30.5k27 gold badges90 silver badges100 bronze badges

answered Jul 9, 2017 at 13:25

LeonTan's user avatar

LeonTanLeonTan

4311 gold badge6 silver badges6 bronze badges

1

This method may not be relevant to your problem but to me it is quite useful.

Just type «cmd» in the address bar to open the Command Prompt, and then «jupyter notebook».

Via this method, you can quickly open Anaconda jupyter from any path you currently staying on Windows system.

enter image description here
enter image description here

answered Jul 17, 2018 at 12:21

OChicken's user avatar

OChickenOChicken

611 silver badge2 bronze badges

1

If your goal is to permanently change the start-up location. You can do so by changing the shortcut for the notebook. Assuming you are on Windows 10

  1. Press start and find Jupter Notebook in the Anaconda Folder
  2. Right click -> More -> Open File location
  3. Right click the Jupyter Notebook short cute -> Properties
  4. Now in target: you will see something at the end that looks like: «%USERPROFILE%/». Replace the contents of %USERPROFILE%/ with your desired DIRECTORY. e.g. «D:GoogleDrive»

Good Luck

answered Jul 21, 2019 at 10:16

MWw's user avatar

Open Anaconda Prompt and write to open a notebook folder in G drive jupyter notebook --notebook-dir 'G:' there is no «=»

answered Feb 12, 2020 at 7:00

Caner Erden's user avatar

Caner ErdenCaner Erden

5266 silver badges7 bronze badges

1

A nice tip is to just navigate to your desired start folder in Windows Explorer:

  • click File
  • click Open command prompt
  • then just type «jupyter notebook» and press enter

a web browser should pop up shortly with the correct start folder.

answered Apr 4, 2017 at 17:15

DRozen's user avatar

DRozenDRozen

3671 gold badge2 silver badges9 bronze badges

3

For Windows users, here is a snippet to let you right click folders and open Jupyter Lab there.

enter image description here

def add_jupyter_to_context_menu(self):
    import winreg

    key = winreg.HKEY_CURRENT_USER
    command_value = rf'cmd.exe /k jupyter lab --notebook-dir="%V"'

    handle = winreg.CreateKeyEx(key, "SoftwareClassesdirectoryBackgroundshellOpen with JupyterLabcommand", 0,
                                winreg.KEY_SET_VALUE)
    winreg.SetValueEx(handle, "", 0, winreg.REG_SZ, command_value)

    # You need to download the icon yourself, or leave this part out for no icon
    icon_value = fr"C:some_folderjupyter_icon.ico"
    handle = winreg.CreateKeyEx(key, "SoftwareClassesdirectoryBackgroundshellOpen with JupyterLab", 0,
                                winreg.KEY_SET_VALUE)
    winreg.SetValueEx(handle, "icon", 0, winreg.REG_SZ, icon_value)

def remove_jupyter_from_context_menu(self):
    import winreg
    key = winreg.HKEY_CURRENT_USER
    winreg.DeleteKey(key, "SoftwareClassesdirectoryBackgroundshellOpen with JupyterLabcommand")
    winreg.DeleteKey(key, "SoftwareClassesdirectoryBackgroundshellOpen with JupyterLab")

answered Jun 23, 2021 at 1:52

pyjamas's user avatar

pyjamaspyjamas

4,1915 gold badges35 silver badges65 bronze badges

You can make windows bat file like this.

D: (your dexired drive)
cd YourDesiredStartDerectory
Jupyter notebook

Save it as ‘JupyterNB.bat’ (or whatever you like), and double click it.

answered May 21, 2017 at 0:24

Tetsuya's user avatar

Below is how the same issue I faced got resolved. Most of the steps I took to solve the issues are already described in the solutions provided earlier by others.

There are two ways to start Jupyter Notebook application

  1. From Anaconda Navigator
  2. Using the shortcut (name: Jupyter Notebook) to Jupyter Notebook application. In Windows OS it is normally available in the folder:
    «C:Users\AppDataRoamingMicrosoftWindowsStart MenuProgramsAnaconda3 (64-bit)»

There are different ways to configure Jupyter Notebook application to save the notebooks in a folder other than the default.

If using Anaconda Navigator to launch notebook

In case of using the Anaconda navigator to launch Jupyter notebook application, the way to configure is to un-comment the «c.NotebookApp.notebook_dir» field in «jupyter_notebook_config.py» and add the path. After updating the field looks like:
c.NotebookApp.notebook_dir = <Enter the absolute path here>

In case of Windows and when Anaconda is installed for a particular user, this file is located in C:Users<USERNAME>.jupyter.

If you don;t find «.jupyter» folder then do the below steps to create it

  1. Run anaconda command prompt
  2. At the command prompt run «jupyter notebook —generate-config»

If using the shortcut (name: Jupyter Notebook) to Jupyter Notebook application to launch it

If you examine the command in the target box of this shortcut, you will notice that Notebook app is started by executing the file «C:Users<USERNAME>Anaconda3Scripts jupyter-notebook-script.py» which accepts a path parameter.

The basic approach to define the location where the notebook files will be saved is —> to provide the path of the required folder when starting the Jupyter Notebook application. This can be done in two ways:

  1. Create an environment variable to point to the required folder and use it as parameter
  2. Define the absolute path in the shortcut itself

Follow the below steps: (Note: Replace the text in angle brackets with the actual text)

  1. Locate the shortcut «Jupyter Notebook». When Anaconda was installed for a particular user (during installation the choice selected was for the user only) the shortcut (Name: «Jupyter Notebook», Type: Shortcut) resided in «C:Users<USERNAME>AppDataRoamingMicrosoftWindowsStart MenuProgramsAnaconda3 (64-bit)»
  2. Right click on the shortcut and select «Properties»
  3. In the «Target» box locate C:Users<USERNAME>Anaconda3Scriptsjupyter-notebook-script.py %USERPROFILE%
  4. Replace «%USERPROFILE%» with

    a. Either: the environment variable created to point to the folder where you want to store the notebook files. The command will look like: C:Users<USERNAME>Anaconda3Scriptsjupyter-notebook-script.py %<ENVIRONMENTVARIABLE>%

    b. OR: the absolute path to the work folder you want the notebook files to be stored in. The command will look like: C:Users<USERNAME>Anaconda3Scriptsjupyter-notebook-script.py <F://folder//subfolder>

  5. Replace the text (path) in «Start In» box with:

    a. Either: the environment variable created to point to the folder where you want to store the notebook files. The text in «Start In» box will look like: %<ENVIRONMENTVARIABLE>%

    b. OR: the absolute path to the work folder you want the notebook files to be stored in. The text in «Start In» box will look like: <F://folder//subfolder>

Note 1: If there are spaces in the path then the whole path should be enclosed in double quotes.

Note 2: The paths in this solution apply to the situation when Anaconda 3 (and Jupyter 3) is installed on Windows for a particular user (not for all users).

I personally preferred to define environment variable rather than hard coding the path in the shortcut.

answered Jul 8, 2018 at 17:18

Yeshwant's user avatar

This is the solution I found for Windows 10 Anaconda Navigator.

step 1: Search for Jupyter Notebook and navigate to the file location. It is something like below

file location

Step 2: Right click on Jupyter Notebook and go to Properties. Add your directory to Target. Mine was «D:EducationMachine Learning»

Properties setting

Step 3: Do not launch Jupyter Notebook from Anaconda Navigator. Use the above shortcut instead.

answered Oct 8, 2020 at 20:30

Pushpa Kumara's user avatar

0

I’ve just installed Anaconda on Windows 10 and have been trying to configure Jupyter to open in my specified directory, including updating the Jupyter config file as suggested above. This didn’t work. After viewing other threads, I stumbled on file «notebook.bat» in the .anacondascripts folder. This launches Jupyter. I took a copy of the .bat file into the folder I want to work in, ran it, and voila — Jupyter launches in that folder and I no longer see every folder on my PC, just the one I want. One desktop shortcut later and I’m a happy ‘non-techy’. I hope this helps.

answered Mar 22, 2017 at 18:54

phil_l's user avatar

After many tries I have done it. I have mentioned the easiest steps below:

  1. Right click on the jupyter launcher icon from start menu or desktop or anaconda navigator

  2. Now you need to change 2 things on the screen: Add your path to both target and start in the properties window

    Caveats:

    a. Your path needs to be in the same drive as the drive in which jupyter is installed. Since mine was in C drive, I used the following path «C:/JupyterWorkLibrary»

    b. For target, at the end of the existing path, i.e, after sript.py», add this after a space. Some people have mentioned removing %USERPROFILE% from target. I did not come across this.
    Image for jupyter properties

    c. For start in, add the same path. I have used a path without spaces to avoid issues. I would also suggest stick to using path in double quotes anyways
    d.I have also used forward slashes in the path

  3. Now just launch the notebook. It should open into the right folder.

Hope this helps.

PS: I am sure there are other ways, this worked for me. I am not even sure of the constraints mentioned. It’s just that with these steps I could get my job done.

answered Nov 4, 2017 at 10:47

Neethu Merlin Rajan's user avatar

answered Jul 14, 2018 at 18:57

Mohsin Mahmood's user avatar

Mohsin MahmoodMohsin Mahmood

2,9723 gold badges20 silver badges25 bronze badges

jupyter notebook --notebook-dir=%WORKING_DIR%,

where %WORKING_DIR% (H:dataML) — directory where you’re going to work

It is the simplest one-line command way, IMHO

answered Dec 16, 2019 at 9:30

AlexPes's user avatar

AlexPesAlexPes

98312 silver badges19 bronze badges

If you are working with jupyter lab and want to modify the configure file, the parameter need to be updated is :

c.ServerApp.root_dir = /path/to/directory/you/want

answered Apr 27, 2021 at 4:12

carolynzy's user avatar

I noticed that Jupyter will always launch the folder that is native to the command prompt (I am sure the same applies to terminal). Simply cd to your desired folder and then launch Jupyter.

answered Jul 29, 2022 at 11:48

Shaji's user avatar

ShajiShaji

7212 gold badges8 silver badges22 bronze badges

You can use a program called FileMenuTools from Lopesoft for your command prompt and just type ‘jupyter notebook’.

Alternatively, you can also use it to create a dedicated shortcut using program C:/windows/System32/cmd.exe and arguments /k jupyter notebook —notebook-dir=»%FOLDERPATH%» but this opens the notebook in the parent folder so you have to click down.

answered Nov 5, 2018 at 15:23

moonbase3's user avatar

In case you are using WinPython and not anaconda then you need to navigate to the directory where you installed the WinPython for e.g. C:WPy-3670settings.jupyterjupyter_notebook_config.py

You need to edit this file and find the line
#c.NotebookApp.notebook_dir = '' change it to for e.g.
c.NotebookApp.notebook_dir = 'D:/your_own_folder/containing/jupyter_notes'

You also need to change backslash to forward slashes /. also make sure to uncomment the line by removing #

answered Nov 9, 2018 at 6:02

Dhirendra Khanka's user avatar

This is what I do for Jupyter/Anaconda on Windows. This method
also passes jupyter a python configuration script. I use this to add a path to my project parent folder:

1 Create jnote.bat somewhere:

@echo off
call activate %1
call jupyter notebook "%CD%" %2 %3
pause

In the same folder create a windows shortcut jupyter-notebook

        TARGET: D:utiljnote.bat py3-jupyter --config=jupyter_notebook_config.py
        START IN: %CD%

jupyter-notebook shortcut

Add the jupyter icon to the shortcut.

2 In your jupyter projects folders(s) do the following:

Create jupyter_notebook_config.py, put what you like in here:

import os
import sys
import inspect

# Add parent folder to sys path

currentdir = os.path.dirname(os.path.abspath(
    inspect.getfile(inspect.currentframe())))

parentdir = os.path.dirname(currentdir)

os.environ['PYTHONPATH'] = parentdir

Then paste the jupyter-notebook shortcut. Double-click the
shortcut and your jupyter should light up and the packages in
the parent folder will be available.

answered Jan 27, 2019 at 9:20

Steve Jones's user avatar

1 — Type jupyer notebook in start menu

1

2 — Make shortcut on desktop of jupyter notebook ( Right click mouse!)

2

3 — Only drag and drop your favorite folder in the shortcut

answered Apr 14, 2020 at 18:37

majid Hakimi's user avatar

1

When I first started using notebooks, one of the letdowns was that I wasn’t able to navigate upwards out of the installation folder. I save all my projects on an extra internal hard disk drive, both for safety and portability. It’s also never a bad idea to have an additional backup (besides GitHub). Accessing these projects through my (Anaconda) Jupyter Notebooks seemed to be impossible. However, several solutions have been proposed on StackOverflow and other boards. Here’s a quick overview.

Throughout this blog post I’ll be using D:/python/foo as project folder. My Anaconda environment is data_science.

Solution 1: navigate to the folder and run Jupyter

The first solution is straightforward. You simply activate your environment, you browse to your project folder in the Anaconda Prompt, and you run Jupyter notebooks. It’s not a one-time solution. Every time you want to work on your project, you’ll have to retake these steps.

activate data_science
d:
cd python/foo
jupyter notebook

Solution 2: set the notebook-dir parameter

A faster solution (just one line of code) is to set the notebook-dir parameter when starting Jupyter notebook.

jupyter notebook --notebook-dir=D:/python/foo

Solution 3: edit the configuration file

A more permanent solution is editing the Jupyter configuration file. By running the following command in your Anaconda prompt, a file will be created (jupyter_notebook_config.py in your Jupyter installation folder).

jupyter notebook --generate-config

In this file, you’ll find c.NotebookApp.notebook_dir after a hash. Uncomment the line by removing the hash and set the value to the directory of your projects.

c.NotebookApp.notebook_dir = 'D:python'

Now run Jupyter Notebook from the Anaconda prompt (or the Navigator), and you’ll start from your preferred directory. Keep in mind that you’ve changed the directory for every environment.

Another nuisance solved!

Say thanks, ask questions or give feedback

Technologies get updated, syntax changes and honestly… I make mistakes too. If something is incorrect, incomplete or doesn’t work, let me know in the comments below and help thousands of visitors.

I have installed anaconda on C:UsersMy_nameAppDataLocalContinuumAnaconda2, the issue is that whenever I launch jupyternotebook or any other from the anaconda navigator the starting directory is a external network location Z:. I want jupyter to be installed and run on C: how do I solve it?

Here is a copy of the anaconda command prompt so you better understand what I mean.

This is a copy of the anaconda command prompt so you better understand what I mean

I have already reinstalled anaconda making sure that I select the C: directory, even installing offline so the computer has no acces to Z:, but the result is the same. Any ideas on how to solve it?

asked Sep 13, 2017 at 12:43

h3h325's user avatar

I defined a new windows PATH variable to ~Anaconda2Scripts. Then I can start jupyter notebook anywhere just by tiping «jupyter notebook» on the command line.

answered Sep 21, 2017 at 8:13

h3h325's user avatar

h3h325h3h325

7111 gold badge9 silver badges19 bronze badges

For MacOS, edit this file:

/Users/{your user name}/anaconda/bin/jupyter_mac.command

Original was:

DIR=$(dirname $0)<br/>
$DIR/jupyter-notebook

I added a line:

DIR=$(dirname $0)<br/>
cd /Users/{your user name}/{whatever folder you want}/<br/>
$DIR/jupyter-notebook

This way, Jupyter notebook starts directory you want. Be careful about folder names with space. Use before the space. For example, the Google Drive folder shoule be:

cd /Users/{your user name}/Google Drive/

Markus's user avatar

Markus

2,0614 gold badges22 silver badges44 bronze badges

answered Jan 13, 2018 at 19:21

Haydar's user avatar

I have installed anaconda on C:UsersMy_nameAppDataLocalContinuumAnaconda2, the issue is that whenever I launch jupyternotebook or any other from the anaconda navigator the starting directory is a external network location Z:. I want jupyter to be installed and run on C: how do I solve it?

Here is a copy of the anaconda command prompt so you better understand what I mean.

This is a copy of the anaconda command prompt so you better understand what I mean

I have already reinstalled anaconda making sure that I select the C: directory, even installing offline so the computer has no acces to Z:, but the result is the same. Any ideas on how to solve it?

asked Sep 13, 2017 at 12:43

h3h325's user avatar

I defined a new windows PATH variable to ~Anaconda2Scripts. Then I can start jupyter notebook anywhere just by tiping «jupyter notebook» on the command line.

answered Sep 21, 2017 at 8:13

h3h325's user avatar

h3h325h3h325

7111 gold badge9 silver badges19 bronze badges

For MacOS, edit this file:

/Users/{your user name}/anaconda/bin/jupyter_mac.command

Original was:

DIR=$(dirname $0)<br/>
$DIR/jupyter-notebook

I added a line:

DIR=$(dirname $0)<br/>
cd /Users/{your user name}/{whatever folder you want}/<br/>
$DIR/jupyter-notebook

This way, Jupyter notebook starts directory you want. Be careful about folder names with space. Use before the space. For example, the Google Drive folder shoule be:

cd /Users/{your user name}/Google Drive/

Markus's user avatar

Markus

2,0614 gold badges22 silver badges44 bronze badges

answered Jan 13, 2018 at 19:21

Haydar's user avatar

Русские Блоги

Четыре способа изменить рабочий путь Jupyter Notebook по умолчанию в Anaconda

Описание: Три способа изменить рабочий путь по умолчанию для Jupyter Notebook в Anaconda

Способ 1.

## The directory to use for notebooks and kernels.
#c.NotebookApp.notebook_dir = »
измените его на
## The directory to use for notebooks and kernels.
c.NotebookApp.notebook_dir = ‘E:Jupyter’
где E: Jupyter — мое рабочее пространство, вы можете изменить его на свое,
Примечание:

1. #c.NotebookApp.notebook_dir = » # В # должен быть удален без пробелов.
2.E: Jupyter, папка Jupyter должна быть создана заранее. Если она не будет создана, Jupyter Notebook не сможет найти этот файл и произойдет сбой.

Способ 2

Найдите ярлык, созданный Анакондой

  • Щелкните правой кнопкой мыши свойство, чтобы ввести и изменить начальный адрес на E: Jupyter, и тогда приложение выполнится успешно.

Способ 3

Пожалуйста, нажмите на полный текстовый адрес: https://blog.csdn.net/u014552678/article/details/62046638?utm_source=copy

Четвертый метод — тот, который я видел раньше. Я не могу вспомнить источник. Я подведу итоги еще раз:

Способ 4.

Этот метод подходит для установки Python с использованием anaconda. Введите cmd в поле поиска на панели задач Windows, а затем нажмите Anaconda Prompt в результатах поиска, чтобы открыть командную строку anaconda.

Сначала введите букву диска, у меня E:, затем нажмите Enter, чтобы переключиться на указанный диск, а затем перейдите в рабочий каталог, например, E: / Jupyter, а затем введите jupyter-notebook. Различные команды запуска jupyter могут отличаться Нужно подтвердить

Это мой рабочий каталог

Открой Anaconda Prompt

После запуска jupyter, Home автоматически открывается в браузере, и вы видите, что рабочий каталог переключен на мой рабочий каталог.

How to change the working directory of Jupyter and Jupyter Lab on Windows environment

Make sure you use forward slashes in your path , backslashes could be used if placed in double quotes even if folder name contains spaces as such : «D:yourUserNameAny FolderMore Folders»

6. Remove the # at the beginning of the line to allow the line to execute. Save the file.

7. Open cmd (or Anaconda Prompt) and run jupyter lab . You will see your home directory being set to the new path.

PROИТ

Office 365, AD, Active Directory, Sharepoint, C#, Powershell. Технические статьи и заметки.

Jupyter Notebook Как изменить стартовую директорию в Windows 10

Задача : необходимо, чтобы при запуске Jupyter Notebook открывалась определенная директория (в которой например располагаются ваши рабочие нотбуки).

1. Запустить консоль ( CMD ) из навигатора Анаконды ( Anaconda . Navigator ). См. скриншот ниже.

2. Выполнить следующую команду:

jupyter notebook —generate-config

3. В данном файле необходимо указать следующий параметр:

c.NotebookApp.notebook_dir = ‘путь к нужной директории’

Примечание: если путь содержит пробелы, то обрамить в двойные кавычки или изменить на путь без пробелов.

@manojs123

Hello,

I’m new to python and Jupyter. I have Installed jupyterhub (Linux), and when I try to use the Jupyter Notebook (UI) it is loading the default working directory as my HOME directory, but I want to change it to something like /path/to/dir/. I tried to do the following in jupyterhub_config.py, but it still loads the default home directory but not the one I want.

c.Spawner.notebook_dir = ‘/path/to/dir/’

Thank you for your help.

Thanks,
Manoj

@GeorgianaElena

Hi @manojs123 🍀
Are you using JupyterHub to spawn a Jupyter Notebook or are you starting directly the notebook with jupyter notebook?
Also, it would be really useful if you could share the logs you get when running with --debug option.

@manojs123

Hello Elena,

Thank you for your response. As said I have installed JupyterHub on the Linux machine. To allow multiple users to sign in to the Hub Server, I started jupyterhub as a privileged user, such as root then I visit https://localhost:8000 in my browser, and sign in with my credentials to start using Jupyter Notebook.

Elena, I’m very new to Python and Jupyter, can you please let me know what logs you want ? Do you want me to run JupyterHub from Command line and send you the logs ?

Thanks,
Manoj

@GeorgianaElena

@manojs123, setting c.Spawner.notebook_dir should be enough for changing the notebook directory for the single-user server, so we have to see what’s going on and why it’s not working for you.

Can you please share your jupyterhub_config.py (with any sensitive info redacted)?

Also, try adding c.Spawner.debug = True in your config and share the output you get when running jupyterhub -f <path_to_your_jupyterhuh_config.py>

@manojs123

Hello Elena,

Yeah! But, we have installed jupyterHub so that multiple users will be using Jupyter (parallelly). Can you please share me your email (if you can), I will send you the config/log files to your email.

Thanks,
Manoj

@GeorgianaElena

@manojs123, if you hide the sensitive info it’s ok to share the logs here.

@manojs123

@GeorgianaElena Thank you for the help. I figured out the issue and could fix it. Sorry for the delayed response.

Thanks,
Manoj

@GeorgianaElena

Awesome @manojs123 🍀. I’m very happy you found the solution.
(It would be really helpful for people that might encounter a similar situation if you could share how you fixed the issue.)

@MikhailSam

I faced the same problem.
For someone who got the same one and interesting in solution:
really adding for two options in jupyterhub_config.py helped:

c.Spawner.default_url = '/data/jupyterhub/jupyterhub_notebooks'
c.Spawner.notebook_dir = '/data/jupyterhub/jupyterhub_notebooks'

@shahinur-17

Its very simple for Windows 10 OS if you running Jupyter notebook on Anaconda. To change your current working directory to a new directory:

  1. Just open you Ananconda prompt first
  2. Secondly type on Anaconda prompt: jupyter notebook —notebook-dir ‘your desired directory
    such as D:’ , to be clear: jupyter notebook —notebook-dir ‘D:’
  3. Now the jupyter notebook will be directed to ‘D:’
  4. Done

@shahinur-17

To change the working directory in Jupyter notebook, you need to follow 5 easy steps:

  1. From start menu on your desktop if Anaconda is installed, just click on Anaconda folder to navigate Jupyter notebook icon.
  2. Then right-click on Jupyter notebook to find the option «more» , and then click on open file location.
  3. You will get again another Jupyter notebook icon with Anaconda navigator and prompt. After tha, right-click on Jupyter notebook and try to find Jupter notebook properties on Shortcut popup bar.
    Then, on Target text box, remove %USERPROFILE% at the end of path, with your desired path. It looks like: riptsjupyter-notebook-script.py » D:SABRE dete. Here D:SABRE dete is my desired path.
  4. In the Start in box, you need to put your desired path also. It looks like: Start in «D:SABRE detector compatibilityUV-Vis as compatibility». Then apply the changes in the Jupyter properties..
  5. Then restart your computer and run your Jupyter notebook from Anaconda navigator. That’s all.

@SongpengYan

@GeorgianaElena Thank you for the help. I figured out the issue and could fix it. Sorry for the delayed response.

Thanks,
Manoj

Hi Manoj, I also installed jupyterhub for muti-users and I want to change the default workspace /home/{user} to /data/{user}, may I know your solutions? Thanks

@stellaYi

@GeorgianaElena Thank you for the help. I figured out the issue and could fix it. Sorry for the delayed response.

Thanks,
Manoj

@manojs123 can you share how you solve the issue in RHEL server? thanks. I encountered the same issue.

@k-nayak

Can someone help me with a similar issue i believe: I am able to open .ipynb files in Jupyter Notebook using «sudo jupyter notebook —allow-root»
But i was able to run it with just «jupyter notebook» and now i am getting 500: internal server error without root while trying to open or create any ipynb files. Same problem with Jupyterhub as well which i installed in Linux for multi user access as intended by @manojs123.
the logs give an error: PermissionError: [Errno 13] Permission denied: ‘/usr/local/share/jupyter/nbconvert/templates/html/conf.json’

I am assuming it has something to do with root and user permissions but i am not much experienced with linux and would appreciate any help.

@GeorgianaElena if you are aware of such error, it would mean a lot if there is any advice that you can give me. Thanks in advance.

Понравилась статья? Поделить с друзьями:

Читайте также:

  • Juiced как изменить управление
  • Jtag communication error
  • Json exception parse error 101 parse error
  • Irecommend как изменить имя
  • Ippon smart winner 3000 btop ошибка

  • 0 0 голоса
    Рейтинг статьи
    Подписаться
    Уведомить о
    guest

    0 комментариев
    Старые
    Новые Популярные
    Межтекстовые Отзывы
    Посмотреть все комментарии