njpipeorgan / wolfram-language-notebook

Notebook support for Wolfram Language in VS Code
Apache License 2.0
162 stars 12 forks source link

Unable to display an image #7

Closed Florianismeandonlyme closed 2 years ago

Florianismeandonlyme commented 2 years ago

As the title suggests Everything is okay include display an equation, solve a differential equation. THE IMAGE JUST DONT SHOWN UP, even if there's no an error report

Expected behavior A clear and concise description of what you expected to happen.

Screenshots image

Environment (please complete the following information): Here is my configuration settings image

njpipeorgan commented 2 years ago

Which Wolfram Engine version, OS, VS Code version, and extension version are you using?

Florianismeandonlyme commented 2 years ago

Both my Mathematica and Wolfram Engine version is 12.3, the extension version is v0.06

P.S: Sometimes the wolfram engine would notice me to Launch a mathlink program image and when I run the codes again, there would be a 'rending failed' error: image

Which Wolfram Engine version, OS, VS Code version, and extension version are you using?

njpipeorgan commented 2 years ago

I was not able reproduce this problem with Engine 12.3. I suspect that the subkernel was not launched successfully.

You can try opening the output window (Ctrl+Shift+U) and select the Wolfram Language Notebook tab while connecting to the kernel, and see what the output is.

lyyc199586 commented 2 years ago

Same question here, I can generate 2D plots, but fail with 3D ones (generate a blank figure)

ContourPlot3D[
 x^3 + y^2 - z^2 == 0, {x, -2, 2}, {y, -2, 2}, {z, -2, 2}]

image

Plot[Sin[x],{x,-1,1}]

image

lyyc199586 commented 2 years ago

when changes to plain text, the output looks fine: image

so I doubt this is something wrong with the notebook render for 3D plots.

The info from output tab:

[Sat, 22 Jan 2022 01:17:57 GMT] kernelIsRemote = false, kernelPort = 58232
[Sat, 22 Jan 2022 01:17:57 GMT] kernelInitPath = /home/yang/.vscode-server/extensions/njpipeorgan.wolfram-language-notebook-0.0.8/resources/init-compressed.txt
[Sat, 22 Jan 2022 01:17:57 GMT] kernelRenderInitPath = /home/yang/.vscode-server/extensions/njpipeorgan.wolfram-language-notebook-0.0.8/resources/render-html.wl
[Sat, 22 Jan 2022 01:17:57 GMT] launchCommand = wolframscript
[Sat, 22 Jan 2022 01:17:57 GMT] launchArguments = -code,ToExpression["zmqPort=58232;"<>Uncompress["1:eJy9PA1X47ay96d4BYcTuApLdl/73gGSF5aPu9wCy5Jse0+9LphES1wcO7WdBRrSH/t+yZvRhy3Jdgh0W1qWxJJGo5nRfGnkV9fxRe//fvrHPxobzvb2uT+49W/Y9razsf55q/UGf3lDjw2yII7yh
[Sat, 22 Jan 2022 01:17:59 GMT] Received the following data from kernel:
[Sat, 22 Jan 2022 01:17:59 GMT] <INITIALIZATION STARTS>
[Sat, 22 Jan 2022 01:18:00 GMT] Received the following data from kernel:
[Sat, 22 Jan 2022 01:18:00 GMT] $CommandLine={/usr/local/Wolfram/WolframEngine/13.0/SystemFiles/Kernel/Binaries/Linux-x86-64/WolframKernel, -runfirst, Unprotect[$EvaluationEnvironment];$EvaluationEnvironment="Script";Protect[$EvaluationEnvironme
[Sat, 22 Jan 2022 01:18:00 GMT] Received the following data from kernel:
[Sat, 22 Jan 2022 01:18:00 GMT] $ScriptCommandLine={wolframscript, -code, ToExpression["zmqPort=58232;"<>Uncompress["1:eJy9PA1X47ay96d4BYcTuApLdl/73gGSF5aPu9wCy5Jse0+9LphES1wcO7WdBRrSH/t+yZvRhy3Jdgh0W1qWxJJGo5nRfGnkV9fxRe//fvrHPxobzvb2uT+49W/Y9razsf55
[Sat, 22 Jan 2022 01:18:00 GMT] Received the following data from kernel:
[Sat, 22 Jan 2022 01:18:00 GMT] Using the following command to launch the subkernel process:
[Sat, 22 Jan 2022 01:18:00 GMT] Received the following data from kernel:
[Sat, 22 Jan 2022 01:18:00 GMT] /usr/local/Wolfram/WolframEngine/13.0/SystemFiles/Kernel/Binaries/Linux-x86-64/WolframKernel -noicon -wstp -linkprotocol SharedMemory -linkmode connect -linkname 5128a689-2f8b-4450-8a4d-af543853cb37
[Sat, 22 Jan 2022 01:18:02 GMT] Received the following data from kernel:
[Sat, 22 Jan 2022 01:18:02 GMT] Subkernel launched; $preemptive=LinkObject[9f3044fa-1bec-4d5d-91a5-8e290dd53b81, 193, 3], $processID=252
[Sat, 22 Jan 2022 01:18:02 GMT] Received the following data from kernel:
[Sat, 22 Jan 2022 01:18:02 GMT] [address tcp://127.0.0.1:58232]

[Sat, 22 Jan 2022 01:18:02 GMT] Received the following data from kernel:
[Sat, 22 Jan 2022 01:18:02 GMT] <INITIALIZATION ENDS>
[Sat, 22 Jan 2022 01:18:02 GMT] Received the following test message from kernel:
[Sat, 22 Jan 2022 01:18:02 GMT] {"type":"test","text":"100405031","version":"13.0.0 for Linux x86 (64-bit) (December 10, 2021)"}

@njpipeorgan

njpipeorgan commented 2 years ago

Thanks for the feedback. I cannot reproduce this issue on Windows/Linux with Mathematica/Engine 13.0. As it was a blank image and Plot did work, I suspect that it may be a kernel-related problem. How about converting the graphics to an image manually, like Rasterize[ContourPlot3D[x^3 + y^2 - z^2 == 0, {x, -2, 2}, {y, -2, 2}, {z, -2, 2}]] ?

Maybe you can try disabling all other extensions or reinstalling the kernel.

lyyc199586 commented 2 years ago

Rasterize didn't help...

I am using wolframscirpt:

yang@SP8:/mnt/c/Users/liuya$ wolframscript
Wolfram Language 13.0.0 Engine for Linux x86 (64-bit)
Copyright 1988-2021 Wolfram Research, Inc.

In[1]:= $Version                                                                                                        
Out[1]= 13.0.0 for Linux x86 (64-bit) (December 10, 2021)

In[2]:=   
lyyc199586 commented 2 years ago

disabling all other exts doesn't help either

njpipeorgan commented 2 years ago

Rasterize didn't help...

I am using wolframscirpt:

yang@SP8:/mnt/c/Users/liuya$ wolframscript
Wolfram Language 13.0.0 Engine for Linux x86 (64-bit)
Copyright 1988-2021 Wolfram Research, Inc.

In[1]:= $Version                                                                                                        
Out[1]= 13.0.0 for Linux x86 (64-bit) (December 10, 2021)

In[2]:=   

Are you using the kernel over WSL?

lyyc199586 commented 2 years ago

Yes, WSL2 (ubuntu)

njpipeorgan commented 2 years ago

As far as I know, the kernel relies on X windows system to render some graphics, which can go wrong in WSL.

lyyc199586 commented 2 years ago

This is a little bit frastrating..

There is a similar work on using Jupyter notebook as a frontend for mma in browser, WolframLanguageForJupyter. But this didn't work for vscode.

Anyway, I think your extension is so far the best solution to use mma notebook in vscode. bravo!

What is your platform?

njpipeorgan commented 2 years ago

VSCode has native support for Jupyter, so I assume WolframLanguageForJupyter as a Jupyter kernel can work in VSCode. But I'm not sure whether that will solve this problem.

Thanks.

I've been testing the extension on Windows, Ubuntu, and MacOS.

lyyc199586 commented 2 years ago

WolframLanguageForJupyter didnt work in vscode, I have tried it when I found that repo... and there is an issue about that issue.

Only 3D plots don't work, that's very strange...

image

njpipeorgan commented 2 years ago

Thanks for the info. You can also test rasterizing 3D graphics in the kernel in WSL terminal directly, e.g.

img=ImageData[Rasterize[ContourPlot3D[x^3 + y^2 - z^2 == 0, {x, -2, 2}, {y, -2, 2}, {z, -2, 2}]]];
Dimensions[img]
Mean[Mean[img]]

and see if it is normal.

lyyc199586 commented 2 years ago

that looks fine

yang@SP8:/mnt/c/Users/liuya$ wolframscript
Wolfram Language 13.0.0 Engine for Linux x86 (64-bit)
Copyright 1988-2021 Wolfram Research, Inc.

In[1]:= img=ImageData[Rasterize[ContourPlot3D[x^3 + y^2 - z^2 == 0, {x, -2, 2}, {y, -2, 2}, {z, -2, 2}]]];

In[2]:= Dimensions[img]

Out[2]= {549, 481, 3}

In[3]:= Mean[Mean[img]]

Out[3]= {1., 1., 1.}

In[4]:=  
njpipeorgan commented 2 years ago

It actually did not look fine. Note that the average of the image was {1.,1.,1.}, which means it was a blank image.

lyyc199586 commented 2 years ago

yea... that's weird, let my check it in a jupyter noteboook in browser

lyyc199586 commented 2 years ago

I think that bug only occur on WoframEngine 13.0, because I remember that I could generate 3d plots when I was using 12.3, (or they removed this feature in 13.)

🤣

lyyc199586 commented 2 years ago

Finally I'm sure this is a bug only on WSL, I tried it on windows and it works fine.

njpipeorgan commented 2 years ago

Thanks for the information.