mmatera / iwolfram

A jupyter kernel for Wolfram Mathematica

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Kernel not available in MacOS

IsaacBreen opened this issue · comments

I've tried installing using pip install -e .. This seems to run happily: the last line is Successfully installed metakernel-0.27.5 wolfram-kernel with no obvious errors. But I cannot access iwolfram as a kernel in Jupyter Notebook or Lab. When I run jupyter notebook --kernel=wolfram_kernel and open Tests.ipynb, I get a popup box saying

Kernel not found
Could not find a kernel matching Wolfram Mathematica. Please select a kernel: [dropdown box with my kernels]

It also doesn't seem to be installed alongside my other kernels:

$ jupyter kernelspec list
Available kernels:
  javascript               /Users/[me]/Library/Jupyter/kernels/javascript
  juliapro_v1.5.3-1-1.5    /Users/[me]/Library/Jupyter/kernels/juliapro_v1.5.3-1-1.5
  py37                     /Users/[me]/Library/Jupyter/kernels/py37
  py38                     /Users/[me]/Library/Jupyter/kernels/py38
  pypy37                   /Users/[me]/Library/Jupyter/kernels/pypy37
  wolframlanguage12.2      /Users/[me]/Library/Jupyter/kernels/wolframlanguage12.2
  python3                  /opt/anaconda3/share/jupyter/kernels/python3

Some environment information in case it helps rule stuff out:

$ which pip jupyter
/opt/anaconda3/bin/pip
/opt/anaconda3/bin/jupyter
$ pip --version
pip 21.0.1 from /opt/anaconda3/lib/python3.7/site-packages/pip (python 3.7)

Happy to provide more details.

@IsaacBreen, thank you for the report.
This information is quite valuable, because I didn't have in clear where anaconda jupyter installs kernels in macOS. The first thing to check is if the installer finds your WM installation. Could you try to run setup.py by hand with the optioon
--mma-exec <path to your mathematica executable> and paste here the output?

Hi mmatera,

I don't have Mathematica installed, just Wolfram Engine and Wolfram Script, but I tested setup.py --mma-exec with a bunch of paths I found in Wolfram Player.app and Wolfram Engine.app:

$ which pip jupyter
/opt/anaconda3/bin/pip
/opt/anaconda3/bin/jupyter
$ pip --version
pip 21.0.1 from /opt/anaconda3/lib/python3.7/site-packages/pip (python 3.7)
$ python setup.py --mma-exec "/Applications/Wolfram Engine.app/Contents/MacOS/Wolfram Engine"
trying  /Applications/Wolfram Engine.app/Contents/MacOS/Wolfram Engine
    command valid. Trying /Applications/Wolfram Engine.app/Contents/MacOS/Wolfram Engine
kernel sending
trying with MathKernel
trying with wolframscript
    command valid. Trying /usr/local/bin/wolframscript
The product exited during an activation attempt because an error occurred.
    command valid. Trying /usr/local/bin/wolframscript
The product exited during an activation attempt because an error occurred.
trying with Mathics
Couldn't find a Mathics/Mathematica interpreter.
relaying in the operative system mathics installation
os.name= posix
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
   or: setup.py --help [cmd1 cmd2 ...]
   or: setup.py --help-commands
   or: setup.py cmd --help

error: no commands supplied
$ python setup.py --mma-exec "/Applications/Wolfram Engine.app/Contents/Resources/Wolfram Player.app"
trying  /Applications/Wolfram Engine.app/Contents/Resources/Wolfram Player.app
    command valid. Trying /Applications/Wolfram Engine.app/Contents/Resources/Wolfram Player.app
[Errno 13] Permission denied: '/Applications/Wolfram Engine.app/Contents/Resources/Wolfram Player.app'
kernel sending
trying with MathKernel
trying with wolframscript
    command valid. Trying /usr/local/bin/wolframscript
The product exited during an activation attempt because an error occurred.
    command valid. Trying /usr/local/bin/wolframscript
The product exited during an activation attempt because an error occurred.
trying with Mathics
Couldn't find a Mathics/Mathematica interpreter.
relaying in the operative system mathics installation
os.name= posix
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
   or: setup.py --help [cmd1 cmd2 ...]
   or: setup.py --help-commands
   or: setup.py cmd --help

error: no commands supplied
$ python setup.py --mma-exec "/Applications/Wolfram Engine.app/Contents/Resources/Wolfram Player.app/Contents/MacOS/WolframKernel"
trying  /Applications/Wolfram Engine.app/Contents/Resources/Wolfram Player.app/Contents/MacOS/WolframKernel
    command valid. Trying /Applications/Wolfram Engine.app/Contents/Resources/Wolfram Player.app/Contents/MacOS/WolframKernel
kernel sending Wolfram Language 12.2.0 Engine for Mac OS X x86 (64-bit)
Copyright 1988-2021 Wolfram Research, Inc.

In[1]:=
Using Wolfram Script
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
   or: setup.py --help [cmd1 cmd2 ...]
   or: setup.py --help-commands
   or: setup.py cmd --help

error: no commands supplied
$ python setup.py --mma-exec "/Applications/WolframScript.app"
trying  /Applications/WolframScript.app
    command valid. Trying /Applications/WolframScript.app
[Errno 13] Permission denied: '/Applications/WolframScript.app'
kernel sending
trying with MathKernel
trying with wolframscript
    command valid. Trying /usr/local/bin/wolframscript
The product exited during an activation attempt because an error occurred.
    command valid. Trying /usr/local/bin/wolframscript
The product exited during an activation attempt because an error occurred.
trying with Mathics
Couldn't find a Mathics/Mathematica interpreter.
relaying in the operative system mathics installation
os.name= posix
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
   or: setup.py --help [cmd1 cmd2 ...]
   or: setup.py --help-commands
   or: setup.py cmd --help

error: no commands supplied
$ python setup.py --mma-exec "/Applications/WolframScript.app/Contents/MacOS/wolframscript"
trying  /Applications/WolframScript.app/Contents/MacOS/wolframscript
    command valid. Trying /Applications/WolframScript.app/Contents/MacOS/wolframscript
The product exited during an activation attempt because an error occurred.
kernel sending
trying with MathKernel
trying with wolframscript
    command valid. Trying /usr/local/bin/wolframscript
The product exited during an activation attempt because an error occurred.
    command valid. Trying /usr/local/bin/wolframscript
The product exited during an activation attempt because an error occurred.
trying with Mathics
Couldn't find a Mathics/Mathematica interpreter.
relaying in the operative system mathics installation
os.name= posix
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
   or: setup.py --help [cmd1 cmd2 ...]
   or: setup.py --help-commands
   or: setup.py cmd --help

error: no commands supplied
$ python setup.py --mma-exec "/Applications/WolframScript.app/Contents/MacOS/launcher"
trying  /Applications/WolframScript.app/Contents/MacOS/launcher
    command valid. Trying /Applications/WolframScript.app/Contents/MacOS/launcher
kernel sending
trying with MathKernel
trying with wolframscript
    command valid. Trying /usr/local/bin/wolframscript
The product exited during an activation attempt because an error occurred.
    command valid. Trying /usr/local/bin/wolframscript
The product exited during an activation attempt because an error occurred.
trying with Mathics
Couldn't find a Mathics/Mathematica interpreter.
relaying in the operative system mathics installation
os.name= posix
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
   or: setup.py --help [cmd1 cmd2 ...]
   or: setup.py --help-commands
   or: setup.py cmd --help

error: no commands supplied

I see that after trying with wolframscript, this message is sent: The product exited during an activation attempt because an error occurred..
Could be possible that you are running the installer as root, but you didn't have activated Wolfram for that user?

BTW: I also use WolframEngine on my laptop (over Ubuntu), and it works. If I can make the time, over the weekend I will try to write a tutorial to install iwolfram by hand.

Apologies for the late reply.

Good idea, but I don't think I was running as root user. Here's the output when I do run as root (it's same output as before).

$ sudo python setup.py --mma-exec "/Applications/Wolfram Engine.app/Contents/MacOS/Wolfram Engine"
Password:
trying  /Applications/Wolfram Engine.app/Contents/MacOS/Wolfram Engine
    command valid. Trying /Applications/Wolfram Engine.app/Contents/MacOS/Wolfram Engine
kernel sending
trying with MathKernel
trying with wolframscript
    command valid. Trying /usr/local/bin/wolframscript
The product exited during an activation attempt because an error occurred.
    command valid. Trying /usr/local/bin/wolframscript
The product exited during an activation attempt because an error occurred.
trying with Mathics
trying with  /opt/anaconda3/bin/mathics
    command valid. Trying /opt/anaconda3/bin/mathics
Mathics version found at /opt/anaconda3/bin/mathics
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
   or: setup.py --help [cmd1 cmd2 ...]
   or: setup.py --help-commands
   or: setup.py cmd --help

error: no commands supplied

I should also add that the first and last commands I listed above both open a terminal window with the Wolfram REPL that looks like this

Wolfram Language 12.2.0 Engine for Mac OS X x86 (64-bit)
Copyright 1988-2021 Wolfram Research, Inc.

In[1]:=                                                                         

To be clear, those commands above I'm referring to are:

$ python setup.py --mma-exec "/Applications/Wolfram Engine.app/Contents/MacOS/Wolfram Engine"

and

$ python setup.py --mma-exec "/Applications/WolframScript.app/Contents/MacOS/launcher"

None of the other commands above do so.

Also, wolframscript seems to work without issue on my base user (non-root)

$ wolframscript
Wolfram Language 12.2.0 Engine for Mac OS X x86 (64-bit)
Copyright 1988-2021 Wolfram Research, Inc.

In[1]:=

but (as expected) not root

$ sudo wolframscript
Password:
The product exited during an activation attempt because an error occurred.