mirror of
https://github.com/WolframResearch/WolframLanguageForJupyter.git
synced 2025-04-14 10:46:05 +00:00
updates
This commit is contained in:
parent
087af5d51f
commit
90eaba9e77
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
.paclet
|
110
README.md
110
README.md
@ -4,59 +4,115 @@ Jupyter provides a protocol (ZMQ) to connect their notebooks to various language
|
||||
|
||||
# Prerequisites
|
||||
|
||||
*
|
||||
On your machine, you will need:
|
||||
|
||||
* Jupyter
|
||||
* Wolfram Engine
|
||||
* Optional, but recommended: `wolframscript`
|
||||
|
||||
# Installation
|
||||
|
||||
The below adds the Wolfram Language kernel to Jupyter's "database of kernels" and allow you to select "Wolfram Language" from the Jupyter notebook interface.
|
||||
There are **two** ways to make the Wolfram Language available in Jupyter:
|
||||
|
||||
Run the following command in a terminal from the project root directory.
|
||||
* Using the `wolframscript` command line script interpreter
|
||||
* Using Wolfram Language commands from the `WolframLanguageForJupyter` paclet.
|
||||
|
||||
## Method 1: Using `wolframscript`
|
||||
|
||||
Run the following command to make the Wolfram Language engine available to Jupyter:
|
||||
|
||||
wolframscript -file install.wls add
|
||||
configure-jupyter.wls add
|
||||
|
||||
Then, run the following.
|
||||
**Notes:**
|
||||
|
||||
* If the location of the Wolfram Engine changes, you will have to run `configure-jupyter.wls` again.
|
||||
|
||||
* `configure-jupyter.wls` gives an error if the Wolfram Engine could not be added.
|
||||
|
||||
For more configuration options run:
|
||||
|
||||
configure-jupyter.wls help
|
||||
|
||||
## Method 2: Using Wolfram Language
|
||||
|
||||
You can download the latest version of the paclet here:
|
||||
|
||||
https://github.com/WolframResearch/WolframLanguageForJupyter/releases
|
||||
|
||||
To install the paclet, run the following command (replaceing x,y, and z with the correct values):
|
||||
|
||||
PacletInstall["WolframLanguageForJupyter-x.y.z.paclet"]
|
||||
|
||||
To load the paclet, run:
|
||||
|
||||
Needs["WolframLanguageForJupyter`"]
|
||||
|
||||
To add the Wolfram Language to Jupyter, run:
|
||||
|
||||
ConfigureJupyter["Add"]
|
||||
|
||||
To specify a specific Jupyter binary, run:
|
||||
|
||||
ConfigureJupyter["Add", "JupyterBinary" -> "..."]
|
||||
|
||||
To specify a specific Wolfram Engine binary, run:
|
||||
|
||||
ConfigureJupyter["Add", "WolframEngineBinary" -> "..." ]
|
||||
|
||||
|
||||
# Testing your installation
|
||||
|
||||
The following command should now list the Wolfram Engine:
|
||||
|
||||
jupyter kernelspec list
|
||||
|
||||
The output should include a line like this:
|
||||
|
||||
wolframlanguage-11.3.0 C:\ProgramData\jupyter\kernels\wolframlanguage-11.3.0
|
||||
|
||||
To test your installation, run the following command:
|
||||
|
||||
jupyter notebook
|
||||
|
||||
**NOTE: If the location of Mathematica changes, you will have to re-run `install.wls`.**
|
||||
Then select Wolfram Language from the drop down menu:
|
||||
|
||||
**NOTE: `install.wls` automatically checks Jupyter's database of kernels to see if the Wolfram Language kernel was added, and gives an error if it was not.**
|
||||

|
||||
|
||||
**NOTE: Run the below for more configuration options for `install.wls`.**
|
||||
After the In[] prompt you can now type a Wolfram Language command (use shift-enter to evaluate):
|
||||
|
||||
wolframscript -file install.wls help
|
||||

|
||||
|
||||
# Building
|
||||
Outputs are either strings, for simple textual results, or images, for graphics and typeset results:
|
||||
|
||||
The below creates a paclet that, when installed within Mathematica, creates a Mathematica symbol that allows the user to add the Wolfram Language kernel to Jupyter's database of kernels and select "Wolfram Language" from the Jupyter notebook interface.
|
||||

|
||||
|
||||
Run the following command in a terminal from the project root directory.
|
||||
Any messages that occur during evaluation are displayed:
|
||||
|
||||
wolframscript -file build.wls
|
||||

|
||||
|
||||
## Steps in Mathematica
|
||||
# Building the WolframLanguageForJupyter paclet
|
||||
|
||||
To install the paclet, run the following (in Mathematica).
|
||||
To build the WolframLanguageForJupyter paclet file yourself, run:
|
||||
|
||||
PacletInstall["<location of paclet>"]
|
||||
configure-jupyter.wls build
|
||||
|
||||
After the paclet has been installed, all that needs to be done is the following, once every kernel session.
|
||||
This creates the `WolframLanguageForJupyter-x.y.z.paclet` file (use the `PacletInfo.m` to increment the version).
|
||||
|
||||
<<WolframLanguageForJupyter`
|
||||
# Removing your installation
|
||||
|
||||
Then, run the below in Mathematica to see how to evaluate the new command.
|
||||
## Method 1: Using `wolframscript`
|
||||
|
||||
?AddKernelToJupyter
|
||||
?RemoveKernelFromJupyter
|
||||
Run the following command to remove the Wolfram Language engine from Jupyter:
|
||||
|
||||
# Usage
|
||||
configure-jupyter.wls remove
|
||||
|
||||
Once the "Wolfram Language" has been selected, and the wrapper has finished starting up, you should see an empty In[]: cell. Just type your input into that cell, as you would for the normal Mathematica Front End, and press Shift-Enter.
|
||||
## Method 2: Using Wolfram Language
|
||||
|
||||
If the wrapper can determine for sure that the output can be properly represented as text, it will do so. If not, the output will be in the form of an image.
|
||||
Run the following command:
|
||||
|
||||
Any errors that occur during the evaluation of the input will be displayed.
|
||||
ConfigureJupyter["Remove"]
|
||||
|
||||
Wrap your input with Interact[] to upload the output to the cloud, and embed that cloud object in the Jupyter Notebook.
|
||||
# Links
|
||||
|
||||
**NOTE: This requires that you are signed in to the cloud within the Wolfram Kernel.**
|
||||
* https://github.com/WolframResearch/WolframLanguageForJupyter
|
||||
* https://jupyter.readthedocs.io/en/latest/projects/content-projects.html
|
||||
|
BIN
WolframLanguageForJupyter-0.0.1.paclet
Normal file
BIN
WolframLanguageForJupyter-0.0.1.paclet
Normal file
Binary file not shown.
BIN
images/in-out-01.png
Normal file
BIN
images/in-out-01.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.6 KiB |
BIN
images/in-out-02.png
Normal file
BIN
images/in-out-02.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 80 KiB |
BIN
images/in-out-03.png
Normal file
BIN
images/in-out-03.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.1 KiB |
BIN
images/menu-01.png
Normal file
BIN
images/menu-01.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.1 KiB |
@ -280,7 +280,8 @@ addKernelToJupyter[jupyterPath_String, mathB_String] :=
|
||||
"install",
|
||||
"--user",
|
||||
tempDir
|
||||
}, "ExitCode", ProcessEnvironment -> processEnvironment];
|
||||
}, All, ProcessEnvironment -> processEnvironment];
|
||||
Print["MESSAGE: ", exitCode]
|
||||
|
||||
(* DeleteDirectory[tempDir, DeleteContents -> True]; *)
|
||||
DeleteDirectory[DirectoryName[tempDir], DeleteContents -> True];
|
||||
|
Loading…
x
Reference in New Issue
Block a user