jupyter-xeus / xeus-octave

Jupyter kernel for GNU Octave
https://xeus-octave.readthedocs.io/
GNU General Public License v3.0
57 stars 10 forks source link

Add Octave packages to Binder #77

Closed AntoinePrv closed 1 year ago

AntoinePrv commented 1 year ago

Close #69

AntoinePrv commented 1 year ago

Surprising error on Binder. Same command works locally and in the Binder terminal.

error: 'pkg' undefined near line 1, column 1
gllmflndn commented 1 year ago

I think the 'pkg' undefined issue corresponds to the same one I came across last week: https://octave.discourse.group/t/towards-a-better-jupyter-kernel-and-integration-in-the-jupyterlite-ecosystem/3356/10 My guess is that the directories listed in the Octave path are incorrect and none of the core functions can be found.

AntoinePrv commented 1 year ago

Hi @gllmflndn, thanks for chipping in! In this case, I resolved it by putting some double quotation around the install instructions. Now I have that working but I'm still having issues making Octave inside Docker find the conda-forge compilers.

rapgenic commented 1 year ago

Try deactivating and then reactivating the conda environment. I used to close and reopen the shell to solve that problem, which occurred when I did conda install fortran-compiler and then run octave and pkg install -forge control.

Also I see that you wrote source .bsahrc instead of source .bashrc ....

gllmflndn commented 1 year ago

Hi @AntoinePrv and @rapgenic, could you give more details about how to deactivate and reactivate the conda environment within postBuild? I tried the following but that's definitely not right:

  conda init bash
  source ~/.bashrc
  conda activate notebook
AntoinePrv commented 1 year ago

@gllmflndn I'm still trying to figure this out :)

gllmflndn commented 1 year ago

Thank you @AntoinePrv ! Sorry for sounding impatient, I am very much looking forward to this and thank you for working on it. Unfortunately I don't know enough of conda/mamba to figure out the solution.

If "1+1" works in Octave but not "pkg install" that's because path() returns empty instead of all of the default paths to Octave functions. This is probably because the ones that Octave uses do not exist and path() only displays valid ones. The situation is equivalent to starting Octave with octave --no-init-path. The invalid paths I see when compiling within postBuild are:

/home/conda/feedstock_root/build_artifacts/octave_1663939771504/_build_env/bin/x86_64-conda-linux-gnu-cc
/home/conda/feedstock_root/build_artifacts/octave_1663939771504/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_plac/include
AntoinePrv commented 1 year ago

@gllmflndn I found a working solution with micromamba (already installed in the Binder image)

micromamba run -n notebook octave-cli --eval 'pkg install -forge symbolic control signal'

Provided the build/run dependencies (such as compilers) are properly given in ./binder/environment.yml.

gllmflndn commented 1 year ago

Thanks @AntoinePrv it seems to work for me! Paths during compilation are now starting with /srv/conda/envs/notebook/. I still notice some paths such as /home/conda/feedstock_root/build_artifacts/octave_1663939771504/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_plac/lib during linking but it seems to run anyway.

One minor issue (in my case) I notice is that I use the shell function in a Makefile, spawning a new shell, and the micromamba environment is not available there. Ideally, would there be a way to have everything in postBuild running implicitly in the notebook environment without having to explicitly prepend everything with micromamba run -n notebook?