dataframe_image
dataframe_image copied to clipboard
Latex is not rendered in the exported image
Hi, thank you for developing this package, however I am having some problems. This is my configuration:
Windows 11 MiKTeX installed and updated (as suggested in nbconvert's documentation) python 3.10.1 dataframe-image 0.1.2 jupyter-client 7.1.0 jupyter-contrib-core 0.3.3 jupyter-contrib-nbextensions 0.5.1 jupyter-core 4.9.1 jupyter-highlight-selected-word 0.2.0 jupyter-latex-envs 1.4.6 jupyter-nbextensions-configurator 0.4.1 jupyterlab-pygments 0.1.2 jupyterlab-widgets 1.1.0
Case 1
When I run this notebook on google chrome
the latex code in the exported image is not rendered
Case 2
I tried also by running it in the cmd, i.e.
but the result is the same.
Case 3
Finally, I tried also File -> Download as -> DataFrame as Image (PDF or Markdown) -> Tool used for Conversion to PDF -> LaTeX, but also in this case the latex code is not rendered
Am I doing something wrong?
Did you try exporting via chrome?
@tdpetrou do you mean to select “chrome” when it asks “Tool used for Conversion to PDF“?
Yes, the chrome browser option. Did that work for you?
@tdpetrou Unfortunately it doesn't work, but gives this error message
Failed to convert notebook
Returned error message below
UnicodeEncodeError: 'charmap' codec can't encode character '\ue6c6' in position 237537: character maps to
Traceback (most recent call last):
File "C:\Users\gtu\AppData\Local\Programs\Python\Python310\lib\site-packages\dataframe_image\_bundler.py", line 58, in convert
converter.convert()
File "C:\Users\gtu\AppData\Local\Programs\Python\Python310\lib\site-packages\dataframe_image\_convert.py", line 318, in convert
self.to_pdf_browser()
File "C:\Users\gtu\AppData\Local\Programs\Python\Python310\lib\site-packages\dataframe_image\_convert.py", line 287, in to_pdf_browser
pdf_data, self.resources = be.from_notebook_node(self.nb, self.resources)
File "C:\Users\gtu\AppData\Local\Programs\Python\Python310\lib\site-packages\dataframe_image\_browser_pdf.py", line 115, in from_notebook_node
f.write(html_data)
File "C:\Users\gtu\AppData\Local\Programs\Python\Python310\lib\encodings\cp1252.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\ue6c6' in position 237537: character maps to
@Rabelaiss I think it is a problem with Spanish, French, and German encoding, and I have post a small patch to deal with it.
Can you installed the develop version by command below and test it again?
pip install git+https://github.com/dexplo/dataframe_image
@PaleNeutron many thanks for help, should i uninstall the previous version?
@Rabelaiss , I think it will uninstall automatically, but manually uninstall may be better.
@tdpetrou I uninstalled the old version and installed the develop version, but for Case 1 (see the first message) still generates the same image, and for Case 3 now it gives this error
Failed to convert notebook
Returned error message below
TimeoutError:
Traceback (most recent call last):
File "C:\Users\gtu\AppData\Local\Programs\Python\Python310\lib\site-packages\aiohttp\client_ws.py", line 229, in receive
msg = await self._reader.read()
File "C:\Users\gtu\AppData\Local\Programs\Python\Python310\lib\site-packages\aiohttp\streams.py", line 657, in read
return await super().read()
File "C:\Users\gtu\AppData\Local\Programs\Python\Python310\lib\site-packages\aiohttp\streams.py", line 616, in read
await self._waiter
File "C:\Users\gtu\AppData\Local\Programs\Python\Python310\lib\asyncio\futures.py", line 284, in __await__
yield self # This tells Task to wait for completion.
File "C:\Users\gtu\AppData\Local\Programs\Python\Python310\lib\asyncio\tasks.py", line 304, in __wakeup
future.result()
File "C:\Users\gtu\AppData\Local\Programs\Python\Python310\lib\asyncio\futures.py", line 196, in result
raise exc
asyncio.exceptions.CancelledError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\gtu\AppData\Local\Programs\Python\Python310\lib\site-packages\dataframe_image\_bundler.py", line 58, in convert
converter.convert()
File "C:\Users\gtu\AppData\Local\Programs\Python\Python310\lib\site-packages\dataframe_image\_convert.py", line 318, in convert
self.to_pdf_browser()
File "C:\Users\gtu\AppData\Local\Programs\Python\Python310\lib\site-packages\dataframe_image\_convert.py", line 287, in to_pdf_browser
pdf_data, self.resources = be.from_notebook_node(self.nb, self.resources)
File "C:\Users\gtu\AppData\Local\Programs\Python\Python310\lib\site-packages\dataframe_image\_browser_pdf.py", line 118, in from_notebook_node
pdf_data = get_pdf_data(full_file_name, p)
File "C:\Users\gtu\AppData\Local\Programs\Python\Python310\lib\site-packages\dataframe_image\_browser_pdf.py", line 100, in get_pdf_data
return future.result()
File "C:\Users\gtu\AppData\Local\Programs\Python\Python310\lib\concurrent\futures\_base.py", line 438, in result
return self.__get_result()
File "C:\Users\gtu\AppData\Local\Programs\Python\Python310\lib\concurrent\futures\_base.py", line 390, in __get_result
raise self._exception
File "C:\Users\gtu\AppData\Local\Programs\Python\Python310\lib\concurrent\futures\thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "C:\Users\gtu\AppData\Local\Programs\Python\Python310\lib\site-packages\nest_asyncio.py", line 38, in run
return loop.run_until_complete(task)
File "C:\Users\gtu\AppData\Local\Programs\Python\Python310\lib\site-packages\nest_asyncio.py", line 81, in run_until_complete
return f.result()
File "C:\Users\gtu\AppData\Local\Programs\Python\Python310\lib\asyncio\futures.py", line 201, in result
raise self._exception
File "C:\Users\gtu\AppData\Local\Programs\Python\Python310\lib\asyncio\tasks.py", line 232, in __step
result = coro.send(None)
File "C:\Users\gtu\AppData\Local\Programs\Python\Python310\lib\site-packages\dataframe_image\_browser_pdf.py", line 50, in main
frameId = await handler(ws, data, "frameId")
File "C:\Users\gtu\AppData\Local\Programs\Python\Python310\lib\site-packages\dataframe_image\_browser_pdf.py", line 17, in handler
async for msg in ws:
File "C:\Users\gtu\AppData\Local\Programs\Python\Python310\lib\site-packages\aiohttp\client_ws.py", line 297, in __anext__
msg = await self.receive()
File "C:\Users\gtu\AppData\Local\Programs\Python\Python310\lib\site-packages\aiohttp\client_ws.py", line 228, in receive
async with async_timeout.timeout(timeout or self._receive_timeout):
File "C:\Users\gtu\AppData\Local\Programs\Python\Python310\lib\site-packages\async_timeout\__init__.py", line 129, in __aexit__
self._do_exit(exc_type)
File "C:\Users\gtu\AppData\Local\Programs\Python\Python310\lib\site-packages\async_timeout\__init__.py", line 212, in _do_exit
raise asyncio.TimeoutError
asyncio.exceptions.TimeoutError
Same problem here.
See https://github.com/dexplo/dataframe_image/blob/f595bf7b17b16156f27189d934a53a9f279f2770/tests/test_df_image.py#L58-L65 , LaTeX equation is currently supported.
NOTE: mathjax
is embeded using CDN, so you have be able to access Internet if you want to convert LaTeX equation.