gap-packages / JupyterKernel

Native Jupyter kernel for GAP
https://gap-packages.github.io/JupyterKernel/
BSD 3-Clause "New" or "Revised" License
19 stars 12 forks source link

JUPYTER_KernelStart_GAP #113

Closed johnbamberg closed 3 years ago

johnbamberg commented 4 years ago

I have the error:

Error, Variable: 'JUPYTER_KernelStart_GAP' must have a value

Jupyter works fine, all packages load in my GAP installation, and the paths are correct. I am using MAC OSX (Catalina). What should be "configfile" in the argument to this function?

I have the same error when I run the jupyter-kernel-gap script:

% jupyter-kernel-gap GAP Jupyter Kernel Starting using gap fail Error, Variable: 'JUPYTER_KernelStart_GAP' must have a value not in any function at stdin:2

johnbamberg commented 4 years ago

If it helps, this is my kernel.json: {"argv": ["jupyter-kernel-gap", "{connection_file}"], "display_name": "GAP 4", "language": "gap", "codemirror_mode": "gap", "env": {"PS1": "$"}, "interrupt_mode": "message" }

olexandr-konovalov commented 4 years ago

@johnbamberg first, what happens when you call

LoadPackage("JupyterKernel");

in GAP? It should return true. It will not start any Jupyter notebooks, but if it fails to load this way, then it indicates a problem.

johnbamberg commented 4 years ago

@alex-konovalov It returns true.

olexandr-konovalov commented 4 years ago

@johnbamberg could you also check https://github.com/gap-packages/JupyterKernel/issues/74, in particular steps 6-7?

johnbamberg commented 4 years ago

Thanks: I did this already, because it is a wonderful post you've made. Steps 6-7 are fine ... my paths are correct.

olexandr-konovalov commented 4 years ago

Ok, that definitely differs from my machine:

$ jupyter-kernel-gap 
GAP Jupyter Kernel Starting using gap
true
Error, no method found! For debugging hints type ?Recovery from NoMethodFound
Error, no 1st choice method found for `ReadByte' on 1 arguments
The 1st argument is 'fail' which might point to an earlier problem

You know that you are not supposed to use this script yourself though - the way is to start Jupyter and then you should be able to see GAP when you create a new notebook. That will ensure that JUPYTER_KernelStart_GAP is called with te right argument.

What jupyter kernelspec list says? See example at https://gap-packages.github.io/JupyterKernel/doc/chap1.html#X7CA9D73583D1D456.

olexandr-konovalov commented 4 years ago

Another idea - I think that's a lead. What is the output of

echo $JUPYTER_GAP_EXECUTABLE

This is the content of jupyter-kernel-gap:

#!/bin/sh

if [ -n "$JUPYTER_GAP_EXECUTABLE" ] ; then
  GAP=$JUPYTER_GAP_EXECUTABLE
elif [ -z "$GAP" ] ; then
  GAP=gap
fi

echo "GAP Jupyter Kernel Starting using $GAP"
exec $GAP -q -T --alwaystrace <<EOF
   LoadPackage("JupyterKernel");
   JUPYTER_KernelStart_GAP("$1");
   QUIT_GAP(0);
EOF

The line echo "GAP Jupyter Kernel Starting using $GAP" outputs $GAP, and in your case it shows just gap so it seems to ignore $JUPYTER_GAP_EXECUTABLE that you define.

olexandr-konovalov commented 4 years ago

P.S. just in case, you have to source ~/.zshrc after you made changes for them to take effect in the same terminal session.

johnbamberg commented 4 years ago

Thanks @alex-konovalov . Here's the output of each command:

jupyter kernelspec list

Available kernels:
  python3    /Users/00044445/Library/Python/3.7/lib/python/site-packages/ipykernel/resources
  gap-4      /Users/00044445/Library/Jupyter/kernels/gap-4
echo $JUPYTER_GAP_EXECUTABLE

gap -l ".;/Users/00044445/"
olexandr-konovalov commented 4 years ago

@johnbamberg so if you do

gap -l ".;/Users/00044445/"

then GAP just starts?

johnbamberg commented 4 years ago

Yes indeed.

olexandr-konovalov commented 3 years ago

@johnbamberg how are you - did you manage to use Jupyter GAP notebooks after all?

johnbamberg commented 3 years ago

Yes, thanks Alex. I started from scratch and it resolved the issue.