Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specify notebook_dir when launching the lab #9633

Closed
potoo0 opened this issue Jan 18, 2021 · 5 comments
Closed

Specify notebook_dir when launching the lab #9633

potoo0 opened this issue Jan 18, 2021 · 5 comments
Labels
status:Needs Info status:resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion.

Comments

@potoo0
Copy link

potoo0 commented Jan 18, 2021

jlab 2.x support specify notebook_dir when launching the lab, such as jupyter lab ./,
but the following command not function in jlab 3.0.5, it is still keep the notebook_dir specified in the global config file.

jupyter lab ./
jupyter lab --notebook-dir=./
jupyter lab --ServerApp.root_dir=./
@jasongrout
Copy link
Contributor

jasongrout commented Jan 19, 2021

It seems you deleted the template that encourages you to go through the trouble-shooting guide (https://jupyterlab.readthedocs.io/en/stable/getting_started/issue.html) and asks for important information to try to understand what might be going on on your computer. Please fill out the template (including error messages, etc.): https://github.com/jupyterlab/jupyterlab/blob/master/.github/ISSUE_TEMPLATE/bug_report.md. It sounds like you may have extra config to let us know about too in order to reproduce the issue.

I just tried with a fresh install of JLab 3.0.5 in a clean conda environment on macOS Catalina, and jupyter lab /some/directory and jupyter lab --notebook-dir=/some/directory worked as we would expect, opening the filebrowser to that directory.

@potoo0
Copy link
Author

potoo0 commented Jan 20, 2021

In my case, arg --notebook-dir doesn't work, here is my env:

python:

  • os: windows 10 20H2
  • python: 3.8.5

jupyter:

% jupyter --version
jupyter core     : 4.6.3
jupyter-notebook : 6.2.0
qtconsole        : not installed
ipython          : 7.10.0
ipykernel        : 5.3.4
jupyter client   : 6.1.7
jupyter lab      : 3.0.7
nbconvert        : 6.0.2
ipywidgets       : 7.5.1
nbformat         : 5.0.7
traitlets        : 5.0.4

jupyterlab startup command:

cd E:\tmp
jupyter lab --notebook-dir=./

startup log:

[I 2021-01-20 09:23:26.989 ServerApp] jupyterlab | extension was successfully linked.
[I 2021-01-20 09:23:26.989 ServerApp] jupyterlab_code_formatter | extension was successfully linked.
[W 2021-01-20 09:23:26.993 NotebookApp] 'notebook_dir' has moved from NotebookApp to ServerApp. This config will be passed to ServerApp. Be sure to update your config before our next release.
[W 2021-01-20 09:23:26.998 ServerApp] notebook_dir is deprecated, use root_dir
[W 2021-01-20 09:23:27.004 ServerApp] The 'min_open_files_limit' trait of a ServerApp instance expected an int, not the NoneType None.
[I 2021-01-20 09:23:27.020 LabApp] JupyterLab extension loaded from d:\miniconda3\lib\site-packages\jupyterlab
[I 2021-01-20 09:23:27.020 LabApp] JupyterLab application directory is d:\miniconda3\share\jupyter\lab
[I 2021-01-20 09:23:27.023 ServerApp] jupyterlab | extension was successfully loaded.
[I 2021-01-20 09:23:27.024 ServerApp] jupyterlab_code_formatter | extension was successfully loaded.
[I 2021-01-20 09:23:27.202 ServerApp] nbclassic | extension was successfully loaded.
[I 2021-01-20 09:23:27.203 ServerApp] Serving notebooks from local directory: E:\Code\Python\2-advance_tutorial
[I 2021-01-20 09:23:27.203 ServerApp] Jupyter Server 1.2.2 is running at:
[I 2021-01-20 09:23:27.203 ServerApp] http://localhost:8888/lab?token=

As shown in the third-to-last line of the log, the notebook_dir is configured in the user config file, instead of the arg specified at startup.

@potoo0
Copy link
Author

potoo0 commented Feb 4, 2021

The problem is because the c.NotebookApp.notebook_dir in jupyter_notebook_config.py overwrites the notebook-dir or ServerApp.root_dir passed from the command line. If I comment the c.NotebookApp.notebook_dir in jupyter_notebook_config.py, the dir set by the command line parameter works as expected.
Maybe the notebook_dir/root_dir set via the command line should have the highest priority.

@jasongrout
Copy link
Contributor

Is this related? jupyter-server/jupyter_server#400

@potoo0
Copy link
Author

potoo0 commented Feb 18, 2021

Solved by upgrade jupyter_server from 1.2.2 to 1.3.0.

@potoo0 potoo0 closed this as completed Feb 18, 2021
@github-actions github-actions bot added the status:resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion. label Aug 18, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 18, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status:Needs Info status:resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion.
Projects
None yet
Development

No branches or pull requests

2 participants