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
Make it possible to delete a nonempty folders #835
Comments
Yeah, I think you are probably right - I find this really annoying. However, we may want to think carefully about this and add an undo action, but that would require cooperation from the server. |
This works fine for me now on master, at least, on macOS. |
it looks like this may still be blocked when running JupyterLab on Windows |
Can someone test to see if this is still a problem in Windows on master? |
What version of the notebook server are you using? This error may come from the notebook server. I know there was some work sometime on windows and sending files to trash. |
This was on
I just tried updating, and get the same error with
|
Is this still on someone's radar? |
I'm seeing this issue on Jupyter lab 1.0.4 running on Jupyterhub for kubernetes. Not entirely sure if it's a Jupyterhub or Jupyter Lab issue, but this is a very annoying bug for my use case (education). |
@albertmichaelj A work-around for us is to just open a terminal and from there do the removal (rm -r foldername). |
@lbiemans I agree that works well for me personally when I use Jupyter Lab because I am a sophisticated user (and a very heavy user of the command line no matter the OS), but I teach very unsophisticated users using a Jupyterhub deployment. They would be very put off by the idea of using the terminal (particularly because there is no way to open the terminal to the current folder in the sidebar so they have to first navigate to the parent folder and then run |
@albertmichaelj sounds familiar, yeah you are following a programming course but are unable to do some commanline things. Another work-around from inside a notebook is: Maybe this work-around is usable? |
@lbiemans Thanks for your suggestions. However, my primary concern with contributing to this github issue is to encourage Jupyter Lab to fix the issue that is preventing deleting non-empty folders in certain conditions. This seems to be a bug because on some platforms (Mac OS, for example), folder delete works perfectly fine even when the folder is non-empty. However, on other platforms (including in the latest While I understand that there are lots of workarounds that my students could use, they are all much worse than just fixing this bug so that delete behaves consistently on all platforms. I do not think that any command line workarounds (or ipython magic commands) are a good reason not to devote resources to fixing basic usability bugs. I would encourage any maintainer watching this issue to make this a priority. I would also encourage testing against the official jupyter docker container images, since they demonstrate this bug, and it seems to be inconsistent by platform. |
JupyterLab here is most likely just the messenger, conveying the error from the notebook server. My guess is that the notebook server (the To test this hypothesis - can you delete the same directory from the classic notebook? Launch the classic notebook from the JLab Help menu, click the checkbox next to the directory, then the red trash icon at the top to delete it. If you are still getting an error, the problem is in the |
I am pretty sure this is in the notebook server side of things. It was a
decision we made very early on because there is no way of recovering from
that if you make a mistake. Open to new ideas, but that is the background.
…On Fri, Sep 27, 2019 at 7:56 AM Jason Grout ***@***.***> wrote:
JupyterLab here is most likely just the messenger, conveying the error
from the notebook server. My guess is that the notebook server (the
notebook package) is the one having the error here, since that is what is
actually trying to delete the directory.
To test this hypothesis - can you delete the same directory from the
classic notebook? Launch the classic notebook from the JLab Help menu, the
click the checkbox next to the directory, then the red trash icon at the
top to delete it. If you are still getting an error, the problem is in the
notebook package and should be filed in the
https://github.com/jupyter/notebook/ repo.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#835?email_source=notifications&email_token=AAAGXUFRGEARVDBTVBS5XHDQLYNKBA5CNFSM4CON2NTKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD7ZFHKI#issuecomment-535974825>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAAGXUBFBJE5YI6A5H5MHCDQLYNKBANCNFSM4CON2NTA>
.
--
Brian E. Granger
Principal Technical Program Manager, AWS AI Platform (brgrange@amazon.com)
On Leave - Professor of Physics and Data Science, Cal Poly
@ellisonbg on GitHub
|
Yeah, the error does show up on the jupyter notebook as well when I use the If the current design is intentional, one of the problems with it is when you have hidden files. For example, it's common to clone a git repo in various projects. All of the .git directory is hidden, and so you can never delete the repo without resorting to the command line. If this is a deliberate decision, I would encourage at least a config parameter in order to allow for the deletion of non-empty folders. However, given that it is a server problem, should this issue be moved or referenced there? It's been here forever. |
Indeed, here is the code in the notebook project that explicitly checks if a directory is empty: That appears to be an intentional design decision, and should be discussed in a https://github.com/jupyter/notebook/ repo issue. |
Please open a new issue there. Sorry, we should have moved it to the server repo from the beginning, where the real issue is. We do have diagnosis guidelines now at https://jupyterlab.readthedocs.io/en/stable/getting_started/issue.html, and step 3 of those guidelines would have guided someone to post to the notebook server repo. |
Ok, I just opened an issue with them. One suggestion I made would be to have a confirmation dialogue. Is this something that would have to interact between the frontend and the server? I suspect it would be. Would that be a solution that jupyterlab maintainers would be open to? |
Yes. The way JLab can delete a directory is to call that server function, so there would need to be some way for jlab to instruct the server to delete the directory anyway. |
Has it been already solved?? |
@hemangjoshi37a I had this issue and only solved by patching the filemanager.py (delete send2trash and other Mac/Windows related stuff, if you run notebooks only on linux, and it'll work. the send2trash in my case was not working with either True/False settings), works well now, though i know it's ugly solution.. just couldn't waste any more time for this 😅 |
Just for the sake of people who land here from google search like I did, and who needs a quick and ugly solution for their K8s/docker/linux only setup. The snippet to use in filemanager.py, the delete_file function looks like this in my case [works because just goes straight to deletion when confirmed in the UI. The standard UI dialog box about "do you want to delete this folder" is really more than enough.. no need in any additional confirmations when the folder is non-empty, because in >90% of cases it'll not be empty anyway]:
but be careful, it disables the 'send to recycle bin' on wondows/mac |
oops wrong thread, wanted to post the snippet into this one where the discussion was jupyter/notebook#4916 |
@Dmitry1987 Yep, what you're talking about is code owned by https://github.com/jupyter/notebook |
Yup , thank god for this work-around. |
Is there some extension solving this issue? For notebooks there is |
+1 for this issue. Not sure why deleting non-empty folders is blocked if user receive a notification that folder is not empty and still want to proceed. This issue, coupled with #2049 means user will not be able to delete any git checkout since the Being able to dele non-empty folders is a must. |
As noted above, this is a problem in the server: jupyter/notebook#4916 In JupyterLab 3, we have switched to https://github.com/jupyter-server/jupyter_server (derived from the repo above, so likely has the same bug). https://github.com/jupyter-server/jupyter_server would be where a fix needs to happen for JupyterLab 3 or more. Closing since this is not a problem with JupyterLab. If you would like to help, please contribute to fixing jupyter/notebook#4916 or filing an issue with https://github.com/jupyter-server/jupyter_server and contribute to fixing that. Thanks! |
Currently deleting folders which contains other files fails with a dialog:
IMHO it should be possible to delete a nonempty folder after warning the user about.
The text was updated successfully, but these errors were encountered: