Hi,
I'm trying to get dataframe_image package to run on pythonanywhere (on jupyter notebook and python script) to convert pandas dataframe into an image, but it's not working and i'm not able to figure out what teaks to get it running. the code works perfectly fine on my laptop
my code:
import pandas as pd.
import dataframe_image as dfi.
d = pd.DataFrame({'one':[1,1,1,1], 'two':[2,2,2,2]}).
dfi.export(d, 'df_image.png', fontsize=32, max_rows=-1)
here is the error I get:
[1228/175855.081738:ERROR:platform_thread_posix.cc(135)] pthread_create: Resource temporarily unavailable (11)
[1228/175855.082516:FATAL:thread_pool_impl.cc(159)] Check failed: service_thread_.StartWithOptions(service_thread_options).
#0 0x55fcfd8ea6b9 (/usr/lib/chromium/chromium+0x5b4b6b8)
#1 0x55fcfd856923 (/usr/lib/chromium/chromium+0x5ab7922)
#2 0x55fcfd869f92 (/usr/lib/chromium/chromium+0x5acaf91)
#3 0x55fcfd86a9be (/usr/lib/chromium/chromium+0x5acb9bd)
#4 0x55fcfd8c491f (/usr/lib/chromium/chromium+0x5b2591e)
#5 0x55fcfbe9166a (/usr/lib/chromium/chromium+0x40f2669)
#6 0x55fcfd82fdb6 (/usr/lib/chromium/chromium+0x5a90db5)
#7 0x55fcfd82fc2c (/usr/lib/chromium/chromium+0x5a90c2b)
#8 0x55fcfd82d5c4 (/usr/lib/chromium/chromium+0x5a8e5c3)
#9 0x55fcfd82de9e (/usr/lib/chromium/chromium+0x5a8ee9d)
#10 0x55fcfd8501d4 (/usr/lib/chromium/chromium+0x5ab11d3)
#11 0x55fcfd84ff03 (/usr/lib/chromium/chromium+0x5ab0f02)
#12 0x55fcfac0018c ChromeMain
#13 0x7f54beee2083 __libc_start_main
#14 0x55fcfac0002a _start
Received signal 6
#0 0x55fcfd8ea6b9 (/usr/lib/chromium/chromium+0x5b4b6b8)
#1 0x55fcfd856923 (/usr/lib/chromium/chromium+0x5ab7922)
#2 0x55fcfd8ea241 (/usr/lib/chromium/chromium+0x5b4b240)
#3 0x7f54c364d420 (/usr/lib/x86_64-linux-gnu/libpthread-2.31.so+0x1441f)
#4 0x7f54bef0100b gsignal
#5 0x7f54beee0859 abort
#6 0x55fcfd8e90a5 (/usr/lib/chromium/chromium+0x5b4a0a4)
#7 0x55fcfd86a3a3 (/usr/lib/chromium/chromium+0x5acb3a2)
#8 0x55fcfd86a9be (/usr/lib/chromium/chromium+0x5acb9bd)
#9 0x55fcfd8c491f (/usr/lib/chromium/chromium+0x5b2591e)
#10 0x55fcfbe9166a (/usr/lib/chromium/chromium+0x40f2669)
#11 0x55fcfd82fdb6 (/usr/lib/chromium/chromium+0x5a90db5)
#12 0x55fcfd82fc2c (/usr/lib/chromium/chromium+0x5a90c2b)
#13 0x55fcfd82d5c4 (/usr/lib/chromium/chromium+0x5a8e5c3)
#14 0x55fcfd82de9e (/usr/lib/chromium/chromium+0x5a8ee9d)
#15 0x55fcfd8501d4 (/usr/lib/chromium/chromium+0x5ab11d3)
#16 0x55fcfd84ff03 (/usr/lib/chromium/chromium+0x5ab0f02)
#17 0x55fcfac0018c ChromeMain
#18 0x7f54beee2083 __libc_start_main
#19 0x55fcfac0002a _start
r8: 0000000000000000 r9: 00007ffd80a084d0 r10: 0000000000000008 r11: 0000000000000246
r12: 000055fd03843020 r13: 000055fd03843030 r14: 00007ffd80a08fa0 r15: 000000000000007c
di: 0000000000000002 si: 00007ffd80a084d0 bp: 00007ffd80a08720 bx: 00007f54b66b71c0
dx: 0000000000000000 ax: 0000000000000000 cx: 00007f54bef0100b sp: 00007ffd80a084d0
ip: 00007f54bef0100b efl: 0000000000000246 cgf: 002b000000000033 erf: 0000000000000000
trp: 0000000000000000 msk: 0000000000000000 cr2: 0000000000000000
[end of stack trace]
Calling _exit(1). Core file will not be generated.
Traceback (most recent call last):
File /usr/local/lib/python3.9/site-packages/IPython/core/interactiveshell.py:3397 in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
Input In [6] in <cell line: 5>
dfi.export(d, 'df_image.png', fontsize=32, max_rows=-1)
File ~/.local/lib/python3.9/site-packages/dataframe_image/_pandas_accessor.py:48 in export
return _export(
File ~/.local/lib/python3.9/site-packages/dataframe_image/_pandas_accessor.py:117 in _export
img_str = converter(html)
File ~/.local/lib/python3.9/site-packages/dataframe_image/_screenshot.py:188 in run
img = self.take_screenshot()
File ~/.local/lib/python3.9/site-packages/dataframe_image/_screenshot.py:140 in take_screenshot
img = mimage.imread(buffer)
File /usr/local/lib/python3.9/site-packages/matplotlib/image.py:1560 in imread
with img_open(fname) as image:
File /usr/local/lib/python3.9/site-packages/PIL/ImageFile.py:112 in __init__
self._open()
File /usr/local/lib/python3.9/site-packages/PIL/PngImagePlugin.py:676 in _open
raise SyntaxError("not a PNG file")
File <string>
SyntaxError: not a PNG file
I thought the problem was caused by not having a chromedriver path specified in the code, so I tried to add it to the code as follow:
import pandas as pd
import dataframe_image as dfi
d = pd.DataFrame({'one':[1,1,1,1], 'two':[2,2,2,2]})
dfi.export(d, 'df_image.png', fontsize=32, max_rows=-1, chrome_path='/usr/local/bin/chromedriver')
the output of the code would be:
Starting ChromeDriver 90.0.4430.24 (4c6d850f087da467d926e8eddb76550aed655991-refs/branch-heads/4430@{#429}) on port 9515
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
adding chromedriver path to the code made the code runs forever without getting any result.
Then I decided to download the latest version of chromedriver and use it, but I kept getting the same output where the code runs forever without getting any results.
Please help on this issue as I've sent multiple emails to the support team for the past 4 days and the replies I'm getting are not solving my issue.
Thanks, Ziyad