jupyter / notebook

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

It is impossible to navigate to a different Windows drive from the notebook file selection UI #1334

Open anntzer opened 8 years ago

anntzer commented 8 years ago

... unless I am mistaken. (notebook 4.1.0 from Anaconda, Windows (of course))

takluyver commented 8 years ago

We deliberately disallow navigation upwards from the current directory, as a simple way to limit what can be accessed through the notebook web server. On Unix, if you really want it to show everything, you can run it from root, but on Windows there is no single root. I guess you could make a custom content manager that makes a virtual root directory containing the drive letters.

anntzer commented 8 years ago

I guess this is for security reasons? Any chance you can provide a switch that would remove this restriction, which IMO doesn't make much sense for strictly local use?

takluyver commented 8 years ago

It is, sort of. Even running it locally, someone who can log in to your computer (e.g. over SSH), they can connect to your notebook server if you don't use a password. This is not that uncommon - the machine I'm using here at work has SSH running and several other user accounts. It's not a really good security measure, because someone who can connect to the notebook server can start a kernel and do anything, but it raises the barrier a bit.

As I described, there is a way to serve all folders, we just didn't consider Windows drive letters when designing that. I don't think any of the core developers use Windows as their main system, so that's not a big surprise. I gave what I think would be the easiest way to implement it within the current framework. It's probably not going to be high priority for the core devs, though.

anntzer commented 8 years ago

As you mentioned yourself, once one can access to your notebook server all bets are off (os.system("rm -rf /") anyone?), while not being able to move to all folders is a real annoyance.

I'm not familiar at all with the security model but wouldn't it be much more secure, for local usage only (one notebook process, one server) for jupyter notebook to default to generating a random password to only allow a single notebook process to connect to the server?

takluyver commented 8 years ago

Right, it's a security speedbump, not a wall. Again, there is a way to effectively disable it, it's just insufficient on Windows because of the way it handles the filesystem.

Yes, the random password would be more secure, and it's something I want to work on, but somehow I haven't got round to it... He typed at 7.20pm, trying to clear the steady flow of emails before going home ;-)

havnar commented 7 years ago

A pity this will not be fixed, mounting your desktop to another disk (hdd instead of ssd) means, no saving to desktop for this guy...

wgilpin commented 6 years ago

Seems crazy to require a Windows user to put everything in the C: drive. Security is weakened by this, not strnegthened

takluyver commented 6 years ago

We don't require you put everything there. You can start more than one notebook server in different folders.

wgilpin commented 6 years ago

You're right. This is an Anaconda config issue, not Jupyter

On Thu, 15 Mar 2018 at 15:32 Thomas Kluyver notifications@github.com wrote:

We don't require you put everything there. You can start more than one notebook server in different folders.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/jupyter/notebook/issues/1334#issuecomment-373418251, or mute the thread https://github.com/notifications/unsubscribe-auth/AHwExPRP7wl4aTsDeckc_n0dJ9qbibACks5teomcgaJpZM4IE1nl .

sndnshr commented 6 years ago

Can we change the current directory in Anaconda prompt to anything other than C: drive? Seems like it's not possible. Doesn't this sort of compels the user to put every script in C: ?

jasongrout commented 6 years ago

@sndnshr, that sounds like a great question for the anaconda folks on their support channel.

bigcatz commented 6 years ago

It really common nowadays on windows desktops to make c: an SSD and the bulk storage an HDD. The limitation is annoying. I'm passing on learning to use Jupyter for now. I have higher priorities and limited time to figure out cumbersome workarounds. Please change this.

GreyMS commented 6 years ago

There is a workaround: it is possible to create symlink to any location you want, including over drives. For example, type in cmd: "mklink /D D_Drive D:\sources". You can create such link in "My documents" or somewhere else in any accessible directory. For win7 & win8 should be done as administrator.

NTimmons commented 6 years ago

I am having to use this work around. Since this is so trivial can we please specify the drive to start on when starting a server instead?

PrakashGnan commented 5 years ago

Open Anaconda promt and you will be directed to C:\user.. something like this by default. Just type in the drive you want to be into like d: and that should do redirect you to D:/ Then type the command jupyter notebook and your notebook opens in that drive itself !! Now you will be able to create files there.

Thanks

NTimmons commented 5 years ago

What if you want to open two notebooks one on C:\ and one on D:\ with the same instance? Seems like an arbitrary thing, especially with so many workarounds for it to me

GeoffNordling commented 5 years ago

Open Anaconda promt and you will be directed to C:\user.. something like this by default. Just type in the drive you want to be into like d: and that should do redirect you to D:/ Then type the command jupyter notebook and your notebook opens in that drive itself !! Now you will be able to create files there.

Thanks

This saved me, thanks!

rahit commented 5 years ago

Multiple solutions: https://stackoverflow.com/questions/35254852/how-to-change-the-jupyter-start-up-folder

I generally do this:

  1. Right-click Jupyter Notebook executable shortcut (If you install jupyter through Anaconda, generally it is available in Start Menu > Programs). Select properties.
  2. You will see %USERPROFILE% at the end of the Target. Change it to your desired location.
  3. DONE

image

fingoldo commented 5 years ago

To summarize: guys this is cumbersome and silly limitation you have introduced. Please remove it and allow for selection of arbitrary drive. Do not assume that you know better than users of your product. Otherwise, why don't you go a step further with that logic, and not limit everything to just a single folder? Or a single filename? Many people are telling you this is a stupid limitation, but you refuse to listen. I'm wondering why? Thank you.

jkmgeo commented 5 years ago

There is a workaround: it is possible to create symlink to any location you want, including over drives. For example, type in cmd: mklink /D "D_Drive" "D:\sources"

I reinvented the wheel and figured out this solution on my own - this would've saved a lot of time! However, I ran mine as mklink /J "C:\Desired\Path" "E:\Current\GoogleDriveFileStream\Path" to make a directory junction (/J) instead of a symbolic link (/D)... Any insight as to which might be better and why?

janheindejong commented 5 years ago

I agree that it is quite annoying that navigating up is not possible.

I'm trying to get my organization from using MatCad, Excel, MatLab, and a few Python scripts here and there to more and more Jupyter Lab work. However, we have a lot of common files on separate network drives. Not being able to access these is a big restriction, that I'm afraid will in the end prevent people from switching to Jupyter Lab.

Hope it will be changed in the future. Great fan of Jupyter!

radascuta commented 5 years ago

This is the kind of minor problem that developers can easily solve, but for some strange reason keep resisting. This makes it very hard to promote your software and packages, even as they are top notch. For people who have been developers and now have decision-making responsibility, this is very sad. Developers are basically disempowering and keeping themselves hidden in a corner, while only a small effort, such as letting one choose which available drive is being written to, could make your work considerably more valuable.

Mostafa-M-Rezaee commented 5 years ago

My solution: I have installed Google Drive on my laptop (C:/Users/(user name)/Google Drive). As you can see, it is on the C drive. Then I moved all cloned repositories to my Google Drive (Here is completely safe). Now, I can call all of my codes through GitLab at the same time.

However: I did it because I had to. This restriction is frustrating. I hope it will be changed.

JianghuiDu commented 4 years ago

Totally agree!

dothiejr1992 commented 4 years ago

Open Anaconda promt and you will be directed to C:\user.. something like this by default. Just type in the drive you want to be into like d: and that should do redirect you to D:/ Then type the command jupyter notebook and your notebook opens in that drive itself !! Now you will be able to create files there.

Thanks

hi do i need to restart my computer to see this changes operated i have tryied and no changes in my jupyter notebokk the drive still stayed the C: one

JianghuiDu commented 4 years ago

Open Anaconda promt and you will be directed to C:\user.. something like this by default. Just type in the drive you want to be into like d: and that should do redirect you to D:/ Then type the command jupyter notebook and your notebook opens in that drive itself !! Now you will be able to create files there. Thanks

hi do i need to restart my computer to see this changes operated i have tryied and no changes in my jupyter notebokk the drive still stayed the C: one

You don't need to restart. You just need to navigate to another drive, for example type d: if you want to go to d drive and then type jupyter-notebook to open it in d drive.

erikblue commented 4 years ago

I'm running into this too. I'm consulting for a company that uses Google Drive File Stream, which installs to G: by default. Now I can't easily share my work because I can't navigate to G:, let alone C:

If I start digging I think the magic happens in this bash file: C:\Users\erik\AppData\Local\SageMath 9.0\runtime\opt\sagemath-9.0\sage

I think that's where it determines the root directory is going to be. But I'm not a bash wizard, so I'm done digging...

Ah ok, symlink works as discussed above in previous replys. Still, I'm going to need to "teach" the rest of my team this workaround so we can all share. But SageMath is awesome and I will do this for now!

originalbleak commented 4 years ago

Open Anaconda promt and you will be directed to C:\user.. something like this by default. Just type in the drive you want to be into like d: and that should do redirect you to D:/ Then type the command jupyter notebook and your notebook opens in that drive itself !! Now you will be able to create files there.

Thanks

Yes. What I've been searching for. I have a Linux directory mapped to a drive letter in Windows 10. It works perfectly. Awesome !!!

alik604 commented 4 years ago

you can run it from root

I just spent 30 minutes figuring out SSH port tunnelling over multiple computers, to access my university's high end GPU machine.... We can't use sudo

YueWangpl commented 4 years ago

Open Anaconda promt and you will be directed to C:\user.. something like this by default. Just type in the drive you want to be into like d: and that should do redirect you to D:/ Then type the command jupyter notebook and your notebook opens in that drive itself !! Now you will be able to create files there.

Thanks

Thanks a lot!!! I was frustrated the whole day.

jasimahmedkhan commented 3 years ago

Well, there is a workaround for that: Follow the steps:

JohnOmernik commented 3 years ago

Well, there is a workaround for that: Follow the steps:

  • Open up the Anaconda command prompt: You can do this either inside the Anaconda navigator or just running the Anaconda Prompt desktop App. To open the Anaconda command prompt through Anaconda navigator: Go to Environments > Click on the triangular button arrow of the target environment (default is: base(root)) Then select “Open Terminal” from the popup menu
  • In the terminal window Type **jupyter notebook --generate-config**. This command will create the “jupyter_notebook_config.py” config file in the .jupyter folder in the default user directory (i.e. C:\Users)
  • Close the Anaconda Navigator
  • Open the jupyter_notebook_config.py file in any suitable text editor and modify the “c.NotebookApp.notebook_dir” entry to point to the desired working directory. You will have to modify the “\” to“\\” in your windows file path. Make sure to uncomment the line by removing the “#”. An example would be **F:\\Dev\\**
  • Save the file and Open the Anaconda Navigator and Jupyter Lab. :) Enjoy

This is not a work around, it still lets you only use one Windows Drive per instance of JupyterLab. IF this allowed us to specify multiple instances, than it would be a work around. Some of us don't have the ability to make mklinks or or what not... yet we have a legit reason to be able to have one jupyterlab instance access multiple locations we are authorized to access. The Security reasoning behind this is NOT a valid security reason... A valid use case is to have a non-privileged user with access to their local drive and access to shared drives and want to be able to open an instance that allows interaction with both.

Ideally, Jupyter lab could create it's own version of a shortcut file that would allow it to follow links regardless of the platform. A file that can have a destination in multiple OSes. This would allow teams to create and distribute links that Jupyter can follow and can would allow for easy notebook sharing.

BradMyrick commented 3 years ago

why after 5 years is this still an issue. embarrassing.

Zsailer commented 3 years ago

There's a project in the works at J.P. Morgan Chase that allows for opening notebooks from multiple drives. That extension can be used and configured to address the issues raised here. Caveat, it only works with JupyterLab.

Check it out: https://github.com/jpmorganchase/jupyter-fs

There are both historical and technical reasons why this won't be fixed in the classic notebook server. There has been some talk about integrating the necessary server-side changes from jupyter-fs in jupyter_server.

Because of this, I'm going to lock and close this issue here.

While I understand there are often frustrations around open-source projects like Jupyter Notebook, please be aware that these projects are maintained by a very small team of people, contributing in their free time, often outside of their day job. We ask that you remain respectful of their time and effort. Thank you.