Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot import data as PNG format #119

Closed
FlyingSamson opened this issue Dec 5, 2021 · 5 comments
Closed

Cannot import data as PNG format #119

FlyingSamson opened this issue Dec 5, 2021 · 5 comments
Labels
wolfram engine bug This is an issue with the Wolfram Engine, not with this project or Jupyter

Comments

@FlyingSamson
Copy link

What I observe

When I run, e.g.,

Solve[x==1]

in the Wolfram Language kernel I get no output and the following error messages in the jupyter log:

Import::fmterr: Cannot import data as PNG format.


Import::fmterr: Cannot import data as PNG format.


Import::fmterr: Cannot import data as PNG format.


General::stop: Further output of Import::fmterr

     will be suppressed during this calculation.


StringJoin::string: 

   String expected at position 2 in 

    <img alt="Output" src="data:image/png;base64,<>failedinBase64<>">.


StringJoin::string: 

   String expected at position 2 in 

    <div><img alt="Output" src="data:image/png;base64,<>failedinBase64<>"></div>.


Export::jsonstrictencoding: Expression StringJoin cannot be exported as JSON.

What I expect:

To see the formula as embedded picture.

What I already tried/figured out:

The latter one

StringJoin::string: 

   String expected at position 2 in 

    <img alt="Output" src="data:image/png;base64,<>failedinBase64<>">.

is due to a typo at this line where it should read failedInBase64 (capital "I").

The other ones

Import::fmterr: Cannot import data as PNG format.

are produces at this call to ExportByteArray, but I was unable to figure out what the problem was. If I run above code in wolfram within the command line of the same docker container (in fact I used a terminal provided by the very same JupyterLab instance) I get the expected result

In[1]:= Solve[x==1]                                                                                                                                                                                                                                                     

Out[1]= {{x -> 1}}

Moreover all inputs resulting in plaintext output like Print["Hello"] or 1+1 do work as expected in the notebook displaying "Hello" and "2", respectively, so apparently something goes wrong with results that are returned as images.

How can I debug this issue? For a start how can I print/log what is actually passed to the ExportByteArray call? Is there some logging functionality build into the kernel that would allow to append messages to the jupyter log?

My environment:

  • $Version gives 12.2.0 for Linux ARM (32-bit) (April 7, 2021)
  • jupyter version gives
     IPython          : 7.30.0
     ipykernel        : 6.6.0
     ipywidgets       : 7.6.5
     jupyter_client   : 7.1.0
     jupyter_core     : 4.9.1
     jupyter_server   : 1.12.1
     jupyterlab       : 3.2.4
     nbclient         : 0.5.9
     nbconvert        : 6.3.0
     nbformat         : 5.1.3
     notebook         : 6.4.6
     qtconsole        : not installed
     traitlets        : 5.1.1
    
  • uname -a gives Linux aafe17fa30e2 5.4.0-1046-raspi #50-Ubuntu SMP PREEMPT Thu Oct 28 05:32:10 UTC 2021 aarch64 GNU/Linux
@FlyingSamson
Copy link
Author

FlyingSamson commented Dec 5, 2021

So I just tried replacing the export formats with "JPEG" instead of "PNG" and this works. I presume this is an indicator that there is some problem with my installation of the wolfram engine and/or its dependencies rather than with the Wolfram Language Kernel For Jupyter?

@benfre
Copy link

benfre commented Dec 25, 2021

I also find this problem on raspberry os, $Version -> "12.2.0 for Linux arm (32-bit)"

To anyone want to know the "JPG" fix, it's changing Format from "PNG" to "JPG" in call to ExportByteArray[] in function toImageData[] "Resources/OutputHandlingUtilities.wl".

@FlyingSamson
Copy link
Author

FlyingSamson commented Feb 6, 2022

I just posted this as a question to the wolfram community.
@benfre: Is your jupyter notebook running on the raspberry os itself, or also within a docker container (as in my case). If it is running on raspberry os itself, can you confirm that this is happening inside the wolfram console also, i.e., when you execute wolfram in terminal and run the command I mentioned in the linked post

Export["test.png", Plot[x, {x, 0, 1}]]

do you get the same error message?

@okofish
Copy link
Member

okofish commented Feb 7, 2022

@FlyingSamson @benfre Thanks for identifying this issue. I'm told that it's been reproduced and is under investigation.

@cc-wr cc-wr added the wolfram engine bug This is an issue with the Wolfram Engine, not with this project or Jupyter label Feb 7, 2022
@FlyingSamson
Copy link
Author

This is now fixed with the latest update to Mathematica 13.0.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wolfram engine bug This is an issue with the Wolfram Engine, not with this project or Jupyter
Projects
None yet
Development

No branches or pull requests

4 participants