jupyter / notebook

Jupyter Interactive Notebook
https://jupyter-notebook.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
11.7k stars 4.94k forks source link

Jupyter fails if started outside home directory #4229

Open blokeley opened 5 years ago

blokeley commented 5 years ago

I did a fresh install of Anaconda 3.7 and tried opening a Jupyter notebook by doing the following:

  1. Uninstalled Anaconda 3.6.
  2. Deleted all anaconda, jupyter and python keys in the registry.
  3. Deleted all anaconda, jupyter and python files and folders on the file system.
  4. Rebooted.
  5. Installed Anaconda 3.7 64-bit (on Windows 10 Pro 64-bit). I ticked the "add to path" option in the installer.
  6. Open PowerShell.
  7. cd to a directory that is not under my home directory.
  8. Start jupyter notebook using jupyter notebook command.
  9. Try opening a notebook by selecting it in the browser.

I get the following error:

Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

PS C:\Users\Tom Oakley> cd \code
PS C:\code> jupyter notebook
[I 09:57:26.662 NotebookApp] JupyterLab extension loaded from C:\Anaconda3.7\lib\site-packages\jupyterlab
[I 09:57:26.662 NotebookApp] JupyterLab application directory is C:\Anaconda3.7\share\jupyter\lab
[I 09:57:26.678 NotebookApp] Serving notebooks from local directory: C:\code
[I 09:57:26.678 NotebookApp] The Jupyter Notebook is running at:
[I 09:57:26.678 NotebookApp] http://localhost:8888/?token=5727bc46546f81bc6d795a7516f2758bfb01bdc764a47430
[I 09:57:26.678 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 09:57:26.725 NotebookApp]

    Copy/paste this URL into your browser when you connect for the first time,
    to login with a token:
        http://localhost:8888/?token=5727bc46546f81bc6d795a7516f2758bfb01bdc764a47430
[I 09:57:27.787 NotebookApp] Accepting one-time-token-authenticated connection from ::1
[W 09:57:38.081 NotebookApp] Notebook sandbox/parallel.ipynb is not trusted
[I 09:57:38.628 NotebookApp] Kernel started: 5296c75b-0bbe-45d9-897a-0d74a6a01dba
C:\code\sandbox
['.git', '.ipynb_checkpoints', '.mypy_cache', 'animation_example.py', 'parallel.ipynb', '__pycache__']
Traceback (most recent call last):
  File "C:\Anaconda3.7\lib\shutil.py", line 557, in move
    os.rename(src, real_dst)
FileNotFoundError: [WinError 2] The system cannot find the file specified: 'test.py' -> 'test_dir.py'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Anaconda3.7\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Anaconda3.7\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Anaconda3.7\lib\site-packages\ipykernel_launcher.py", line 15, in <module>
    from ipykernel import kernelapp as app
  File "C:\Anaconda3.7\lib\site-packages\ipykernel\__init__.py", line 2, in <module>
    from .connect import *
  File "C:\Anaconda3.7\lib\site-packages\ipykernel\connect.py", line 13, in <module>
    from IPython.core.profiledir import ProfileDir
  File "C:\Anaconda3.7\lib\site-packages\IPython\__init__.py", line 54, in <module>
    from .core.application import Application
  File "C:\Anaconda3.7\lib\site-packages\IPython\core\application.py", line 16, in <module>
    from copy import deepcopy
  File "C:\code\sandbox\copy.py", line 9, in <module>
    shutil.move('test.py', 'test_dir.py')
  File "C:\Anaconda3.7\lib\shutil.py", line 571, in move
    copy_function(src, real_dst)
  File "C:\Anaconda3.7\lib\shutil.py", line 257, in copy2
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File "C:\Anaconda3.7\lib\shutil.py", line 120, in copyfile
    with open(src, 'rb') as fsrc:
FileNotFoundError: [Errno 2] No such file or directory: 'test.py'
[I 09:57:41.612 NotebookApp] KernelRestarter: restarting kernel (1/5), new random ports
C:\code\sandbox
['.git', '.ipynb_checkpoints', '.mypy_cache', 'animation_example.py', 'parallel.ipynb',  '__pycache__']
Traceback (most recent call last):
  File "C:\Anaconda3.7\lib\shutil.py", line 557, in move
    os.rename(src, real_dst)
FileNotFoundError: [WinError 2] The system cannot find the file specified: 'test.py' -> 'test_dir.py'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Anaconda3.7\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Anaconda3.7\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Anaconda3.7\lib\site-packages\ipykernel_launcher.py", line 15, in <module>
    from ipykernel import kernelapp as app
  File "C:\Anaconda3.7\lib\site-packages\ipykernel\__init__.py", line 2, in <module>
    from .connect import *
  File "C:\Anaconda3.7\lib\site-packages\ipykernel\connect.py", line 13, in <module>
    from IPython.core.profiledir import ProfileDir
  File "C:\Anaconda3.7\lib\site-packages\IPython\__init__.py", line 54, in <module>
    from .core.application import Application
  File "C:\Anaconda3.7\lib\site-packages\IPython\core\application.py", line 16, in <module>
    from copy import deepcopy
  File "C:\code\sandbox\copy.py", line 9, in <module>
    shutil.move('test.py', 'test_dir.py')
  File "C:\Anaconda3.7\lib\shutil.py", line 571, in move
    copy_function(src, real_dst)
  File "C:\Anaconda3.7\lib\shutil.py", line 257, in copy2
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File "C:\Anaconda3.7\lib\shutil.py", line 120, in copyfile
    with open(src, 'rb') as fsrc:
FileNotFoundError: [Errno 2] No such file or directory: 'test.py'
[I 09:57:44.673 NotebookApp] KernelRestarter: restarting kernel (2/5), new random ports
C:\code\sandbox
['.git', '.ipynb_checkpoints', '.mypy_cache', 'animation_example.py', 'parallel.ipynb',  '__pycache__']
Traceback (most recent call last):
  File "C:\Anaconda3.7\lib\shutil.py", line 557, in move
    os.rename(src, real_dst)
FileNotFoundError: [WinError 2] The system cannot find the file specified: 'test.py' -> 'test_dir.py'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Anaconda3.7\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Anaconda3.7\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Anaconda3.7\lib\site-packages\ipykernel_launcher.py", line 15, in <module>
    from ipykernel import kernelapp as app
  File "C:\Anaconda3.7\lib\site-packages\ipykernel\__init__.py", line 2, in <module>
    from .connect import *
  File "C:\Anaconda3.7\lib\site-packages\ipykernel\connect.py", line 13, in <module>
    from IPython.core.profiledir import ProfileDir
  File "C:\Anaconda3.7\lib\site-packages\IPython\__init__.py", line 54, in <module>
    from .core.application import Application
  File "C:\Anaconda3.7\lib\site-packages\IPython\core\application.py", line 16, in <module>
    from copy import deepcopy
  File "C:\code\sandbox\copy.py", line 9, in <module>
    shutil.move('test.py', 'test_dir.py')
  File "C:\Anaconda3.7\lib\shutil.py", line 571, in move
    copy_function(src, real_dst)
  File "C:\Anaconda3.7\lib\shutil.py", line 257, in copy2
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File "C:\Anaconda3.7\lib\shutil.py", line 120, in copyfile
    with open(src, 'rb') as fsrc:
FileNotFoundError: [Errno 2] No such file or directory: 'test.py'

Updating the packages with conda update --all makes no difference.

Using jupyter lab gives the same error.

Versions

jupyter                   1.0.0                    py37_7
jupyter_client            5.2.3                    py37_0
jupyter_console           6.0.0                    py37_0
jupyter_core              4.4.0                    py37_0
jupyterlab                0.35.3                   py37_0
jupyterlab_launcher       0.13.1                   py37_0
jupyterlab_server         0.2.0                    py37_0

pandas.show_versions() gives:

INSTALLED VERSIONS
------------------
commit: None
python: 3.7.1.final.0
python-bits: 64
OS: Windows
OS-release: 10
machine: AMD64
processor: Intel64 Family 6 Model 94 Stepping 3, GenuineIntel
byteorder: little
LC_ALL: None
LANG: None
LOCALE: None.None

pandas: 0.23.4
pytest: 4.0.0
pip: 18.1
setuptools: 40.6.2
Cython: 0.29
numpy: 1.15.1
scipy: 1.1.0
pyarrow: None
xarray: None
IPython: 7.1.1
sphinx: 1.8.2
patsy: 0.5.0
dateutil: 2.7.5
pytz: 2018.7
blosc: None
bottleneck: 1.2.1
tables: 3.4.4
numexpr: 2.6.8
feather: None
matplotlib: 2.2.3
openpyxl: 2.5.9
xlrd: 1.1.0
xlwt: 1.3.0
xlsxwriter: 1.1.2
lxml: 4.2.5
bs4: 4.6.3
html5lib: 1.0.1
sqlalchemy: 1.2.14
pymysql: None
psycopg2: None
jinja2: 2.10
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None

Please let me know how to fix this!

blokeley commented 5 years ago

Update: jupyter notebook works if I start it in my home directory, but not anywhere else. It also raises the FileNotFoundError if I use jupyter notebook --notebook-dir=C:\code\sandbox

blokeley commented 5 years ago

I closed this issue in error. A completely fresh install of Anaconda for Python 3.7 on Windows 10 still cannot open jupyter notebook or jupyter lab unless the directory is a subdirectory of the home directory.

DoctorMG commented 3 years ago

What do I have to do to request a change for this? This is a mess for every user who has the OS on an small ssd and have endless space on NAS, harddisks etc. Such an type of code editor should never decide how files are organized. I know that here are differences between Linux and Windows - but at least under Windows it is common to organize work as described. I see dozens if questions like this on endless blogs that ask for any switches or directory entries. If you prefer you can make it a default - but there must be a way to change such a path. Otherwise this will reduce the overall usability of this great tool.