An image built off of jupyter/base-notebook that includes the free Wolfram Engine for developers.
docker build -t jupyter-mathematica .
docker run -p 8888:8888 jupyter-mathematica
Then inside the container, run wolframscript
and login with your Wolfram username and password or get a free license here. You can easily do this from within a shell in Jupyter. After you are logged in, run
$PasswordFile // FilePrint
in the wolframscript session to get your license key. Create an empty directory somewhere on your host system named license
. Copy and paste the output from the wolframscript command into a file named mathpass
within that directory. We will mount this directory into the container when starting it from now on. Example:
docker run -p 8888:8888 \
-v /home/$USER/jm-files/license:/usr/local/Wolfram/WolframEngine/12.1/Configuration/Licensing \
jupyter-mathematica
Now, we need to tell Jupyter about mathematica. Run the following commands in the container.
cd /home/jovyan/wolfram/WolframLanguageForJupyter
./configure-jupyter.wls add
jupyter-kernelspec list
The command jupyter-kernelspec list
should tell you which kernels are available, make sure you see the kernel we just added in the output.
Now, you should be able to start a Wolfram Language notebook. Keep in mind that any notebooks you create will be stored in temporary docker volumes. Consider bind mounting some local directory like this:
docker run -p 8888:8888 -v /home/$USER/jm-files/work:/home/jovyan/work jupyter-mathematica
Full example mounting license file and work directory:
docker run -p 8888:8888 -v /home/$USER/jm-files/work:/home/jovyan/work \
-v /home/$USER/jm-files/license:/usr/local/Wolfram/WolframEngine/12.1/Configuration/Licensing \
jupyter-mathematica
If the WolframLanguage Kernel doesn't appear, you may have to re-run configure-jupyter.wls add
and then jupyter-kernelspec list
. I have experienced this behavior periodically and when restarting the container. After running this command, wait a few secodns and the kernel should appear.