Jupyterlab hangs and does not display the results of evaluation when I try to run any graphical vpython code, eg...
当我尝试运行任何图形vpython代码时,Jupyterlab挂起并且没有显示计算结果,例如...
from vpython import *
canvas()
box(vector-(0,0,0))
I have tried this in both colab notebooks and in my local jupyter setup built using anaconda. The plots work fine when working in spyder.
我已经在CoLab笔记本和我本地的用蟒蛇构建的jupyter设置中尝试了这一点。在Spyder中工作时,这些情节运行得很好。
I tried running the notebook in chromium, firefox, and librewolf without any change. In the environment I am running python=3.8, jupyterlab=4.0.5, and notebook=7.0.3 using on a machine running archlinux.
我试着在chromium、firefox和librewolf中运行notebook,没有做任何改变。在我运行python=3.8,jupyterlab=4.0.5和notebook=7.0.3的环境中,在运行archlinux的机器上使用。
更多回答
Which example is your code based on? Have you tried running exactly what you provided in that code block yourself? You say Spyder works for you; however, did you try that example with Spyder? When I run it, I see TypeError: unsupported operand type(s) for -: 'type' and 'tuple'
in regards to the line box(vector-(0,0,0))
. So it seems like a bad example to expect to work. There are .ipynb
example files here.
您的代码基于哪个示例?您自己试过运行您在代码块中提供的内容了吗?你说Spyder为你工作;然而,你有没有尝试过Spyder的例子?当我运行它时,我看到关于行框(向量-(0,0,0))的-:‘type’和‘tuple’的类型错误:不支持的操作数类型(S)。因此,期望奏效似乎是一个糟糕的例子。这里有.ipynb示例文件。
By the way if you need an example in Jupyter where this works, go here and click 'launch binder
at the bottom of that section. (Now be aware this is a little convoluted of a way to activate things and it still doesn't result in it working in JupyterLab, but it at least allows it to work in the older version of Jupyter Notebook served via MyBinder.) When the session starts up, click the 'Plot3D' example about 2/3 down the list of available notebooks. Then right-click on the Jupyter logo in the upper left and copy the link. ...
顺便说一句,如果你需要一个在Jupyter上运行的例子,点击这里,点击该部分底部的启动活页夹。(现在要知道,这是一种有点复杂的激活方式,它仍然不能在JupyterLab上运行,但它至少允许它在通过MyBinder提供的较旧版本的Jupyter Notebook上运行。)当会议开始时,在可用笔记本列表中大约三分之二的位置点击‘Plot3D’例子。然后右击左上角的Jupyter徽标并复制链接。..。
<continued> Close the Plot3D browser window for now. Paste that link you copied in a new browser window and then JupyterLab will open. When that shows JupyterLab, double click on the 'Demos' directory in the file browser list on the left. Next, right click on Plot3D.ipynb
in the file browser list on the left and shut down the kernel. Then Double-click on Plot3D.ipynb
in the list and then run the top cell there when the file opens. Give it a minute or two to try to render things. (It will make some space below the first cell but in my experience it didn't show the output expected there.)...
暂时关闭Plot3D浏览器窗口。将您复制的链接粘贴到新的浏览器窗口中,然后将打开MysterLab。当显示“DemyterLab”时,双击左侧文件浏览器列表中的“Demos”目录。接下来,右键单击左侧文件浏览器列表中的Plot3D.ipynb并关闭内核。然后双击列表中的Plot3D.ipynb,然后在文件打开时运行顶部的单元格。给它一两分钟的时间来尝试渲染东西。(It将在第一个单元格下面留出一些空间,但根据我的经验,它没有显示预期的输出。
<continued> Then close the Plot3D.ipynb
file, discarding your changes, and even close the browser window where JupyterLab is open. Now go back to the Jupyter Notebook window that first opened after you launched the session. And remove the notebooks/index.ipynb
at the end of the URL and replace it with tree
. That will open the Jupyter Notebook Jupyter Dashboard. Double click to go into the 'Demos' directory in the classic Jupyter Notebook interface. Click on the square to the left of the green Plot3D.ipynb
in the list and then go up and press the 'ShutDown' button at the top of the ...
然后关闭Plot3D.ipynb文件,放弃您的更改,甚至关闭打开JupyterLab的浏览器窗口。现在返回到启动会话后首次打开的Jupyter Notebook窗口。并删除URL末尾的Notebook/index.ipynb,并将其替换为tree。这将打开Jupyter笔记本Jupyter Dashboard。在经典的Jupyter Notebook界面中,双击进入“Demos”目录。点击列表中绿色Plot3D.ipynb左边的方块,然后向上按下顶部的‘Shutdown’按钮。
<continued> listing. Then scroll down, give it a moment to fully shutdown that kernel, and then double click Plot3D.ipynb
in the list so that it opens in the classic interface and then run the top cell in the notebook that just opened. It should hang and not show the plot still in my experience just now. Go up to the menu above the notebook and from under 'Kernel', click 'Restart & Run All'. Be patient and give it about a minute. It may indeed now show the plot and you should be able to click on other notebooks back in the Dashboard ...
在上市然后向下滚动,给它一点时间来完全关闭该内核,然后双击列表中的Plot3D.ipynb,以便它在经典界面中打开,然后运行刚刚打开的笔记本中的顶部单元格。它应该挂起来,而不是显示情节仍然在我的经验刚才。转到笔记本上面的菜单,从“内核”下,单击“重新启动并全部运行”。耐心一点,等一分钟。它现在确实可以显示绘图,您应该能够在仪表板中单击其他笔记本.
我是一名优秀的程序员,十分优秀!