如何在Scilab Jupiter笔记本中绘图?

huangapple go评论49阅读模式
英文:

How to plot with Scilab Jupiter notebook?

问题

我想要在我的Scilab环境中使用Jupyter Notebook。除了已安装Python 3.11和Scilab 2023之外,我还使用以下命令添加了Scilab内核:

pip install scilab_kernel

然而,在Jupyter Notebook中创建图表时遇到了问题。值得注意的是,我没有管理员权限,但我通过以下方式找到了一种解决方法,即在Windows命令行中设置环境变量:

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

不幸的是,我仍然无法在Jupyter Notebook中生成图表,并且收到以下错误消息:

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

我的问题是:

  1. 我应该为SCILAB_EXECUTABLE变量设置哪个Scilab可执行文件?
  2. 如何设置像-nwin这样的选项?

此外,我已提供了图像和PowerShell的打印输出以供参考。

英文:

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.

答案1

得分: 1

我怀疑问题可能与我的计算机用户权限限制有关。如果我能确定根本原因,我一定会更新您。

有趣的是,以下步骤在我的家用计算机上完美运行:

  1. 使用 python-installer.exe 安装 Python。
  2. 使用 pip install scilab_kernel 安装 Scilab 内核。
  3. 使用 pip install jupyter 安装 Jupyter Notebook。
  4. SCILAB_EXECUTABLE 变量设置为 WScilex-cli.exe
  5. 使用以下命令将 Scilab 的二进制目录添加到系统的 PATH 变量中:
    set PATH=%PATH%;%PROGRAMFILES%\scilab-2023.1.0\bin\
    set PATH=%PATH%;SCILAB_EXECUTABLE
    

在我的家用计算机上,一切都按预期运行,但在当前计算机上,我仍然遇到问题。具体来说,SCILAB 内核状态仍然是“繁忙”,经过的时间不断计数。但 Python 内核运行正常。

这是一张供参考的图片:

如何在Scilab Jupiter笔记本中绘图?

我将继续调查这个问题,并随时向您更新。

英文:

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:

如何在Scilab Jupiter笔记本中绘图?

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

答案2

得分: 0

请使用 WScilex-cli.exe 替代 Scilex.exe

英文:

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

答案3

得分: 0

Python在Jupyter Notebook中无缝运行,而Scilab遇到了问题。评估过程似乎永远在进行中,这表现为持续存在的黑色圆圈光标。在Windows 10 x64命令窗口中未显示任何错误消息。

我通过命令行精确地按照安装说明进行了安装。有趣的是,我的同事没有遇到任何问题,而我无法使用Scilab内核在Jupyter中执行单元格评估。

我希望有人能提供帮助来解决这个问题。

以下是我进行安装的步骤顺序:

  1. 使用scilab-2023.1.0.bin.x64.exe安装了Scilab。
  2. 使用python-installer.exe安装了Python。
  3. 使用"pip install jupyter"安装了Jupyter。
  4. 使用"pip install scilab_kernel"为Jupyter安装了Scilab内核。
  5. 使用"setx SCILAB_EXECUTABLE WScilex-cli.exe"设置了SCILAB_EXECUTABLE。
  6. 使用以下命令将Scilab二进制目录追加到PATH中:
"setx PATH %PATH%;%PROGRAMFILES%\scilab-2023.1.0\bin"
"setx PATH %PATH%;SCILAB_EXECUTABLE"

已执行的故障排除步骤:

  1. 使用"python -m scilab_kernel.check"检查了Scilab内核。
  2. 使用"jupyter kernelspec list"验证了已安装内核的列表。

版本和输出:

  • Jupyter版本:1.0.0
  • Scilab内核版本:0.9.10
  • Python版本:3.10.11

"python -m scilab_kernel.check"的输出:

  • Scilab内核版本:0.9.10
  • Metakernel版本:0.29.5
  • Python版本:3.10.11(tags/v3.10.11:7d4cc5a,2023年4月5日,00:38:17)[MSC v.1929 64位(AMD64)]
  • Python路径:C:\Users\kwas\AppData\Local\Programs\Python\Python310\python.exe

建立与Scilab的连接...
与Scilab的连接已建立
Scilab版本:"2023.1.0.1684825887"
已安装的Scilab版本:scilab-2023.1.0

"pip show scilab_kernel"的输出:

  • 名称:scilab-kernel
  • 版本:0.9.10
  • 摘要:用于Scilab的Jupyter内核。
  • 主页:http://github.com/calsto/scilab_kernel
  • 许可证:MIT
  • 位置:c:\users\kwas\appdata\local\programs\python\python310\lib\site-packages
  • 需要:ipykernel,jupyter-client,metakernel
  • 依赖项:无

"jupyter kernelspec list"的输出:

可用内核:

  • 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
英文:

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

huangapple
  • 本文由 发表于 2023年7月31日 23:29:14
  • 转载请务必保留本文链接:https://go.coder-hub.com/76805076.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定