How to plot with Scilab Jupiter notebook?

303 Views Asked by At

I would like to utilize Jupyter Notebook for my Scilab environment. In addition to having Python 3.11 and Scilab 2023 installed, I've also added the Scilab kernel using the following command:

pip install scilab_kernel

However, I'm encountering issues with creating plots within Jupyter Notebook. It's important to note that I do not have administrative rights, but I found a workaround by setting the environment variable using the Windows Command Line as shown below:

setx SCILAB_EXECUTABLE C:\Tools\scilab-2023.1.0\bin\Scilex.exe
setx PATH "%SCILAB_EXECUTABLE%;%PATH%"

Unfortunately, I'm still unable to generate plots in Jupyter Notebook, and I'm receiving the following error message:

Scilab 'plot2d' function disabled in -nogui or -nwni mode.

I've tried using "WScilex.exe" instead of "Scilex.exe," but this opens the Scilab application each time I execute a cell in Jupyter Notebook using the following command:

setx SCILAB_EXECUTABLE C:\Tools\scilab-2023.1.0\bin\WScilex.exe

My questions are:

  1. Which Scilab executable should I set for the SCILAB_EXECUTABLE variable?
  2. How can I set options like -nwin?

Additionally, I've provided images and a PowerShell printout for reference.

4

There are 4 best solutions below

0
Kwas Poser On BEST ANSWER

It may sound peculiar, but following the installation of PyCharm, everything is now functioning precisely as anticipated. Perhaps it automatically updated all the Python packages.

5
Stéphane Mottelet On

Use WScilex-cli.exe instead of Scilex.exe.

1
Kwas Poser On

I suspect that the issue might be related to limitations in my user rights on this PC. If I can identify the root cause, I will definitely update you.

Interestingly, the process worked flawlessly on my home PC with the following steps:

  1. Installed Python using python-installer.exe.
  2. Installed the Scilab kernel with pip install scilab_kernel.
  3. Installed Jupyter Notebook with pip install jupyter.
  4. Set the SCILAB_EXECUTABLE variable to WScilex-cli.exe.
  5. Added Scilab's binary directory to the system's PATH variable with these commands:
    set PATH=%PATH%;%PROGRAMFILES%\scilab-2023.1.0\bin\
    set PATH=%PATH%;SCILAB_EXECUTABLE
    

On my home PC, everything worked as expected, but on the current PC, I'm still encountering issues. Specifically, the SCILAB kernel status remains "Busy," and the elapsed time keeps counting endlessly. However, the Python kernel works perfectly fine.

Here's an image for reference:

enter image description here

I'll continue to investigate the issue and keep you updated on any developments.

0
Kwas Poser On

Python functions seamlessly in Jupyter Notebook, while Scilab encounters an issue. The evaluation process appears to be perpetually ongoing, as indicated by the persistent black circle cursor. No error messages are displayed in the Windows 10 x64 command window.

I followed the installation instructions meticulously through the command line. Interestingly, my colleague is not experiencing any problems, while I am unable to execute cell evaluations in Jupyter using the Scilab kernel.

I'm hopeful that someone can provide assistance in resolving this matter.

Here is the sequence of steps I undertook for installation:

Installed Scilab using scilab-2023.1.0.bin.x64.exe Installed Python using python-installer.exe Installed Jupyter using "pip install jupyter" Installed the Scilab kernel for Jupyter using "pip install scilab_kernel" Set the SCILAB_EXECUTABLE using "setx SCILAB_EXECUTABLE WScilex-cli.exe" Appended the Scilab binary directory to the PATH using the following commands:

"setx PATH %PATH%;%PROGRAMFILES%\scilab-2023.1.0\bin"
"setx PATH %PATH%;SCILAB_EXECUTABLE"

Troubleshooting steps undertaken:

Checked the Scilab kernel using "python -m scilab_kernel.check" Verified the list of installed kernels using "jupyter kernelspec list" Versions and outputs:

Jupyter version: 1.0.0
Scilab kernel version: 0.9.10
Python version: 3.10.11
Output of "python -m scilab_kernel.check":

Scilab kernel version: 0.9.10
Metakernel version: 0.29.5
Python version: 3.10.11 (tags/v3.10.11:7d4cc5a, Apr 5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)]
Python path: C:\Users\kwas\AppData\Local\Programs\Python\Python310\python.exe

Establishing a connection to Scilab... Connection with Scilab established Scilab version: "2023.1.0.1684825887" Installed Scilab version: scilab-2023.1.0

Output of "pip show scilab_kernel":

Name: scilab-kernel
Version: 0.9.10
Summary: A Jupyter kernel for Scilab.
Home-page: http://github.com/calsto/scilab_kernel
License: MIT
Location: c:\users\kwas\appdata\local\programs\python\python310\lib\site-packages
Requires: ipykernel, jupyter-client, metakernel
Required-by:

Output of "jupyter kernelspec list":

Available kernels:

python3: c:\users\kwas\appdata\local\programs\python\python310\share\jupyter\kernels\python3
scilab: c:\users\kwas\appdata\local\programs\python\python310\share\jupyter\kernels\scilab