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

nbopen does not work, it simply flashes Python interpreter command prompt #69

Open
richlysakowski opened this issue Jan 15, 2020 · 21 comments

Comments

@richlysakowski
Copy link

I ran the nbopen installation and activation commands on Windows 10 . I am using a new installation of Anaconda Python distribution (new as of last week 1/10/2020).

python -m pip install nbopen
python -m nbopen.install_win

Then I double-click on a Jupyter notebook file, the interpreter Command Prompt flashes, but the Jupyter NB file never opens up. I saw this behavior about 11 months ago the first time I tried it.
What is the fix for this?

@Guillaume-Garrigos
Copy link

Same problem here, with the latest Anaconda distribution on W10.

@takluyver
Copy link
Owner

takluyver commented Jan 31, 2020 via email

@Guillaume-Garrigos
Copy link

In a command prompt i do nbopen file_name.ipynb

On my first try the command prompt says "Using existing server at D:" and Firefox opens an error tab with "Firefox can’t establish a connection to the server at localhost:8888."
From this I guess there is an issue with different hard drives C:\ D:\ , for instance my Anaconda/python/environments are in C:\ but my data (and notebooks) are in D:\

So, I move the notebook on C:\ and there nbopen works from the command prompt. But if I double click on the file, it keeps opening with my default text editor, even though I did python -m nbopen.install_win . Do I have to do something else to "force" the file association? Also, note that I used python and not python3 because the command is not recognized for me.

@takluyver
Copy link
Owner

takluyver commented Jan 31, 2020 via email

@matt-sharp
Copy link

Has anyone found a solution to this issue? I can launch Jupyter Notebook from the Anaconda prompt using nbopen but not when double clicking from file explorer.

@Guillaume-Garrigos
Copy link

Sorry, I completely missed @takluyver answer months ago.
For the record, my issue with D: was indeed because I had a server 8888 not shut down properly, so I had to delete a file somewhere (following this jupyter/notebook#2844 (comment))

So, back on our problem, I can use nbopen from the command prompt, it works well. Double-clicking doesn't.
I tried to go through "Right-Click>Open with>nbopen.exe" , in which case it doesn't work. But a prompt opens and close in a blink, and I have been able to catch it, see the attached screenshot. I hope it can help.

17-06-2020 17-46-12

@matt-sharp
Copy link

I just managed to fix mine by following some steps when you get the DLL load failed error, many thanks for the screenshot!
Make sure you have the following in your PATH variable:

c:\users\USERNAME\anaconda3
c:\users\USERNAME\anaconda3\scripts
c:\users\USERNAME\anaconda3\library\bin
c:\users\USERNAME\anaconda3\library\usr\bin
where c:\users\USERNAME\anaconda3 is the anaconda install location.

I was missing the 2 bin directory paths above.

@KamarajuKusumanchi
Copy link

@nekro9t2 Thanks. Adding the paths solved the issue for me.

@takluyver
Copy link
Owner

Sorry all, I don't know much about Windows. The error @Guillaume-Garrigos managed to capture looks like the French translation of the common DLL load failed: The specified module could not be found error, which unhelpfully omits to tell you which DLL couldn't be found. It makes sense that modifying the PATH environment variable helps, as @nekro9t2 found, because Windows uses that to look for DLLs (as well as commands, which is the primary purpose of it).

@nick-025 :

I always get a red error message.

Please do include the actual error message! Even if it's the same generic error as in @Guillaume-Garrigos's post, it's a useful hint whether you're facing a similar problem or a different one.

@Greedquest
Copy link

Greedquest commented Dec 28, 2020

A slightly neater alternative to what @matt-sharp suggests is to get conda to run* nbopen for you, so that you don't need to modify the PATH at all

The easiest way is to go to the registry with Regedit and change the key at Computer\HKEY_CURRENT_USER\SOFTWARE\Classes\Jupyter.nbopen\shell\open\command to

C:\Users\{USERNAME}\anaconda3\python.exe -m conda run -n base pythonw -m nbopen "%1"

... ofc swap C:\Users\{USERNAME}\anaconda3\python.exe ... for whichever python executable is currently referenced (i.e. change USERNAME)


Note:

  1. run -n base will run nbopen in the environment named base, but you may have installed it in a different environment so you can change that here.
  2. If, like me, your anaconda base installation is your default python version then you can replace the C:\Users\{USERNAME}\anaconda3\python.exe with py which should do the same thing using the windows python launcher (installed by default).
  3. A terminal window may flash but it's fine to close it if it stays open, I asked about a fix over on SO here.

*NB: conda run is a beta feature at time of writing so this approach may break if the api changes, but it seems to work fine for now

@nick-025
Copy link

So, after a very long time, I was trying to use nbopen with double click, and unfortunately, nothing has changed. I can use it perfectly though with command line. I had already checked a lot of comments and threads, but this error was still happening (as it happened to @Guillaume-Garrigos):

nbopen error 1

I then added the bin paths and the Anaconda installation folder to the System Path, as described by @matt-sharp. But that did not work at all. I get an empty command line window, and even after using python -m nbopen.install_win it says I am running that with nbopen.exe. I don't know how to proceed right now. I am not giving up on it, if anyone has an idea of what is going on, their help would be greatly appreciated!

image

@Greedquest
Copy link

Greedquest commented Jun 23, 2021

@nick-025 If it works through the anaconda prompt, then what I suggested should work too, as it basically runs the nbopen command in the anaconda environment behind the scenes. The method I suggest just overwrites one of the steps in nbopen.install_win

@nick-025
Copy link

I confess I was afraid of changing these deep configurations, since I am not an expert in this subject. But it works now. I just saw a python window and a node.js one, but that's not relevant for me at all. It is working now. Thank you so much for the instructions @Greedquest, you helped me a lot!!!

@Greedquest
Copy link

@nick-025 I understand. The registry can be used to configure some quite important things in the Operating System (and break them). However in this case it's being used more like a text file/dictionary just to store the command string on the computer somewhere so it can be accessed later.

PS. If the method worked then maybe thumbs up the original post so other people can see it works and use it themselves?

@nick-025
Copy link

Of course! Your contribution will help lots of people, it is important to recognize others effort!

@ejad9
Copy link

ejad9 commented Nov 30, 2021

Hi all,
I had the same issue and I've fixed it by :

  1. Uninstalling Anaconda
  2. Reinstalling Anaconda clicking "Add Anaconda to the PATH" when proposed
  3. Reinstalling nbopen : in the Anaconda Powershell Prompt :
  • pip install nbopen
  • python -m nbopen.install_win

I can now open .ipynb files by doucle-clicking on it
That feel so great ! :)

@JeranYang
Copy link

JeranYang commented Apr 14, 2022

Hi all, I had the same issue and I've fixed it by :

  1. Uninstalling Anaconda
  2. Reinstalling Anaconda clicking "Add Anaconda to the PATH" when proposed
  3. Reinstalling nbopen : in the Anaconda Powershell Prompt :
  • pip install nbopen
  • python -m nbopen.install_win

I can now open .ipynb files by doucle-clicking on it That feel so great ! :)

Same issue. Thank you, ejad9! It never comes to me that this issue dates all the way back to the installation of Anaconda. I remember Anaconda didn't recommend "Add Anaconda to the PATH"...

But I still have a problem that the notebook on my desktop cannot be opened. It returns the error "404 : Not Found". I think this issue is caused by a space key in my Windows user folder name. But changing the user folder name is another complex issue and may cause severe problems to the computer. So I decided to stop here.

@FruitPnchSamuraiG
Copy link

Has anyone found a solution to this issue? I can launch Jupyter Notebook from the Anaconda prompt using nbopen but not when double clicking from file explorer.

How did you manage to open it via cmd this is the error i keep getting
image

@FruitPnchSamuraiG
Copy link

Does using nbopen in a command prompt work? If so, it's really hard to debug this: there's an error message that vanishes before you can read it. Maybe try taking screenshots at just the right moment? Or a screen recording you can pause? I know that's a terrible way to debug, but it's all I can suggest.

On Fri, 31 Jan 2020, 11:46 Guillaume Garrigos, @.***> wrote: Same problem here, with the latest Anaconda distribution on W10. — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <#69?email_source=notifications&email_token=AACQB5J4MB6YGKKTHOWE6UDRAP6RZA5CNFSM4KG55HD2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKOIRNY#issuecomment-580683959>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACQB5IOEBHVJMN6IDXWH4DRAP6RZANCNFSM4KG55HDQ .

hey this is what it said while the cmd flashed
image

@takluyver
Copy link
Owner

The first error ('nbopen' is not recognized...) means that the location where nbopen was installed is not on your PATH. You could try replacing nbopen with python -m nbopen. If 'python' is also not recognised, you can figure out the location of python.exe and use that. I think adding Python to PATH is an option when you first install it on Windows.

The 'null' is not defined error looks like it's trying to run the notebook (JSON) file as Python code directly, without any Jupyter machinery. I don't understand why it would do that.

@takluyver
Copy link
Owner

Have a look in the registry and see what got set up associated with .ipynb files.

with winreg.CreateKey(winreg.HKEY_CURRENT_USER, "Software\Classes\Jupyter.nbopen") as k:
winreg.SetValue(k, "", SZ, "IPython notebook")
with winreg.CreateKey(k, "shell\open\command") as launchk:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants