cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Choose Language Hide Translation Bar
waltp
Level I

Running Jupyter Notebook from JSL

I'd like to run a Jupyter notebook from a JSL script.  I tried the following but without success:

 

//================================================================
// Open Jupyter notebook
//
RunProgram(
Executable( "C:/Users/Owner/Anaconda3/Scripts/jupyter.exe " ),
Options(
{"notebook", "C:/temp/meteorites.ipynb"}
),
Read Function( "text" ),
);
//================================================================

 

If I run this from a command like, the notebook opens as expected:

 

 

C:/Users/Owner/Anaconda3/Scripts/jupyter.exe notebook C:\temp\meteorites.ipynb

 

I'm using JMP 14 on a Windows laptop.  Any suggestions?

 

Thanks,

 

Walt Paczkowski

 

 

 

5 REPLIES 5
gzmorgan0
Super User (Alumni)

Re: Running Jupyter Notebook from JSL

@waltp ,

I noticed your CMD line prompt uses back slashes (\) for the file name and forward slashe (/) for the JMP option.  You might want to make the JMP option consistent and give it a try.

 

Also, I vaguely recall someone had a security set on their PC that wouldn't allow something like a script calling an executable. Sorry, I don't recall the details.

 

Good luck. Let the blog know if you get it to work.

waltp
Level I

Re: Running Jupyter Notebook from JSL

HI,

 

Thanks for the reply.  I made sure the slashes are the same in the JMP script -- still doesn't work.  The error message in the log is:

 

//
// Open Jupyter notebook

//
RunProgram(
Executable( "C:/Users/Owner/Anaconda3/Scripts/jupyter.exe " ),
Options(
{"notebook", "C:/temp/meteorites.ipynb"}
),
Read Function( "text" ),
);
/*:
"Error executing Jupyter command 'notebook': [Errno 'jupyter-notebook' not found] 2
"

 

 

I know that I can open a notebook from a command prompt; it works.  But it does't work from a script.

 

Walt

Craige_Hales
Super User

Re: Running Jupyter Notebook from JSL

Maybe a PATH issue. Maybe a VirtualEnv issue. I've barely looked at Jupyter, on Linux, so take with grain of salt...

 

One or two of the scripting index examples use CMD.EXE to run commands. That might get the environment set up the way you need it, or allow you to run a PATH or virtualenv command before starting the notebook.

 

 

Craige
Craige_Hales
Super User

Re: Running Jupyter Notebook from JSL

re-reading...and searching a bit more...

It looks like the .exe is probably jupyter-notebook.exe and that may not be on the path when JMP launches RunProgram.

Craige
Craige_Hales
Super User

Re: Running Jupyter Notebook from JSL

Good point about the slashes. The command line options probably have to be the normal windows \ ; JMP won't be looking at that value and Jupyter might or might not try to fix it up. (Many of JMP's internal filename operations do some normalization of the \ and / characters for MAC and WIN, but only when JMP knows it is a file name.) 

Craige