Skip to Content
Menu
This question has been flagged
2477 Views

My config:

Server Ubuntu 20.04
Odoo 14 community
Set up in virtual environment
Plotly installed installed on server

I am running a method in odoo that generate plot and create static image used to incorporate in a qweb report.

My code line to generate the static image is as follow.


import pandas as pd
import plotly
import plotly.io as pio
import plotly.express as px

df = pd.DataFrame(dict(
x=[1, 3, 2, 4],
y=[1, 2, 3, 4]
))
fig = px.line(df, x="x", y="y", title="Unsorted Input")
test = pio.to_image(fig, format='png')
print('img generated')



On the server, when I run the code in a .py file on the virtual environment, the static image is generated properly.

When I run the same code  inside an odoo function, the image is not generated.
After 30 seconds, odoo gives me an error message without content.


Below are the process details on Kaleido:


WORKING

WHEN CALLING THE TEST.PY FILE DIRECTLY IN THE VIRTUAL ENVIRONMENT USING:

Python3 tesy.py


Last login: Sat Feb 26 15:23:48 2022 from 50.93.107.87

rd@odoo-new:~$ watch 'ps aux | grep kaleido'


Every 2.0s: ps aux | grep kaleido                                                                                                                                                                                                                                                                                                                                   odoo-new: Sat Feb 26 16:18:34 2022


ylessard   76915  0.2  0.0   9400  4612 pts/1    S+   16:17   0:00 watch ps aux | grep kaleido

ylessard   77387  0.0  0.0   8616  3088 pts/0    S+   16:18   0:00 /bin/bash /home/ylessard/.local/lib/python3.8/site-packages/kaleido/executable/kaleido plotly --plotlyjs='/usr/local/lib/python3.8/dist-packages/plotly/package_data/plotly.min.js' --disable-gpu --allow-file-access-from-files --disable-breakpad --disable-dev-shm-usage --no-sandbox

ylessard   77391  0.0  0.0 293376 63400 pts/0    Rl+  16:18   0:00 /home/ylessard/.local/lib/python3.8/site-packages/kaleido/executable/bin/kaleido --plotlyjs='/usr/local/lib/python3.8/dist-packages/plotly/package_data/plotly.min.js' --disable-gpu --allow-file-access-from-files --disable-breakpad --disable-dev-shm-usage --no-sandbox plotly

ylessard   77393  0.0  0.0 162960 27768 pts/0    S+   16:18   0:00 /home/ylessard/.local/lib/python3.8/site-packages/kaleido/executable/bin/kaleido --type=zygote --no-zygote-sandbox --no-sandbox --headless --headless

ylessard   77394  0.0  0.0 162960 27608 pts/0    S+   16:18   0:00 /home/ylessard/.local/lib/python3.8/site-packages/kaleido/executable/bin/kaleido --type=zygote --no-sandbox --headless --headless

ylessard   77406  0.0  0.0 213592 46472 pts/0    Sl+  16:18   0:00 /home/ylessard/.local/lib/python3.8/site-packages/kaleido/executable/bin/kaleido --type=gpu-process --field-trial-handle=6944511918208838858,13017558829691272471,131072 --no-sandbox --disable-dev-shm-usage --disable-breakpad --headless --ozone-platform=headless --headless --gpu-preferences=QAAAAAAAAAAgAAAwAAAAAAAAAAAAAAAA

ylessard   77407  0.0  0.0 228652 33560 pts/0    Sl+  16:18   0:00 /home/ylessard/.local/lib/python3.8/site-packages/kaleido/executable/bin/kaleido --type=utility --utility-sub-type=network.mojom.NetworkService --field-trial-handle=6944511918208838858,13017558829691272471,131072 --lang=en-US@posix --service-sandbox-type=network --no-sandbox --disable-dev-shm-usage --use-gl=swiftshader-we

ylessard   77408  0.0  0.1 4473284 70416 pts/0   Sl+  16:18   0:00 /home/ylessard/.local/lib/python3.8/site-packages/kaleido/executable/bin/kaleido --type=renderer --no-sandbox --disable-dev-shm-usage --disable-breakpad --allow-pre-commit-input --ozone-platform=headless --field-trial-handle=6944511918208838858,13017558829691272471,131072 --disable-databases --disable-gpu-compositing --la

ylessard   77435  0.0  0.0   9400  2528 pts/1    S+   16:18   0:00 watch ps aux | grep kaleido

ylessard   77436  0.0  0.0   2608   612 pts/1    S+   16:18   0:00 sh -c ps aux | grep kaleido

ylessard   77438  0.0  0.0   8160  2596 pts/1    S+   16:18   0:00 grep kaleido



NOT WORKING

When I call the function inside Odoo, the process stalls on the following line:

test = pio.to_image(fig, format='png', engine='kaleido')



Last login: Sat Feb 26 15:23:48 2022 from 50.93.107.87

ylessard@odoo-new:~$ watch 'ps aux | grep kaleido'



Every 2.0s: ps aux | grep kaleido                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           odoo-new: Sat Feb 26 16:37:25 2022


ylessard   76915  0.0  0.0  10148  5268 pts/1    S+   16:17   0:00 watch ps aux | grep kaleido

ylessard   83086  0.0  0.0   8616  3076 pts/3    S+   16:35   0:00 /bin/bash /opt/odoo14/odoo-venv/lib/python3.8/site-packages/kaleido/executable/kaleido plotly --plotlyjs='/opt/odoo14/odoo-venv/lib/python3.8/site-packages/plotly/package_data/plotly.min.js' --disable-gpu --allow-file-access-from-files --disable-breakpad --disable-dev-shm-usage --no-sandbox

ylessard   83090  0.1  0.0 270756 49568 pts/3    Sl+  16:35   0:00 /opt/odoo14/odoo-venv/lib/python3.8/site-packages/kaleido/executable/bin/kaleido --plotlyjs='/opt/odoo14/odoo-venv/lib/python3.8/site-packages/plotly/package_data/plotly.min.js' --disable-gpu --allow-file-access-from-files --disable-breakpad --disable-dev-shm-usage --no-sandbox plotly

ylessard   83100  0.0  0.0 162960 27344 pts/3    S+   16:35   0:00 /opt/odoo14/odoo-venv/lib/python3.8/site-packages/kaleido/executable/bin/kaleido --type=zygote --no-zygote-sandbox --no-sandbox --headless --headless

ylessard   83101  0.0  0.0 162960 27460 pts/3    S+   16:35   0:00 /opt/odoo14/odoo-venv/lib/python3.8/site-packages/kaleido/executable/bin/kaleido --type=zygote --no-sandbox --headless --headless

ylessard   83113  0.0  0.0 213592 46060 pts/3    Sl+  16:35   0:00 /opt/odoo14/odoo-venv/lib/python3.8/site-packages/kaleido/executable/bin/kaleido --type=gpu-process --field-trial-handle=7367901302065659043,12836565871931846414,131072 --no-sandbox --disable-dev-shm-usage --disable-breakpad --headless --ozone-platform=headless --headless --gpu-preferences=QAAAAAAAAAAgAAAwAAAAAAAAAAAAAAAAAABgAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAA --use-gl=swiftshader-webgl --override-use-software-gl-for-tests --shared-files

ylessard   83114  0.0  0.0 220456 34192 pts/3    Sl+  16:35   0:00 /opt/odoo14/odoo-venv/lib/python3.8/site-packages/kaleido/executable/bin/kaleido --type=utility --utility-sub-type=network.mojom.NetworkService --field-trial-handle=7367901302065659043,12836565871931846414,131072 --lang=en-US@posix --service-sandbox-type=network --no-sandbox --disable-dev-shm-usage --use-gl=swiftshader-webgl --headless --shared-files

ylessard   83846  0.0  0.0  10148  3184 pts/1    S+   16:37   0:00 watch ps aux | grep kaleido

ylessard   83847  0.0  0.0   2608   608 pts/1    S+   16:37   0:00 sh -c ps aux | grep kaleido

ylessard   83849  0.0  0.0   8160  2564 pts/1    S+   16:37   0:00 grep kaleido


Avatar
Discard
Related Posts Replies Views Activity
1
Mar 15
4517
2
Mar 15
5714
4
Dec 23
20734
2
Aug 23
1823
4
May 23
33234