- I create a virtual environment using
python3 -m venv venv
- Activate
source venv/bin/activate
- Install Plotly package
pip install plotly
- Try to run the following script
dft.py
#!./venv/bin/python3
from math import pi
from plotly.graph_objects import Figure, Scatter
from plotly.io import full_figure_for_development as ffdf
dr: int = 1000
dv: list[float] = [2.0*pi*i/dr for i in range(dr + 1)]
# plot the result
fig = Figure()
fig.add_trace(Scatter(x=dv, y=dv))
# save the figure
ffdf(fig, warn=False)
fig.write_image('a.pdf', engine="kaleido")
- An error appears
Traceback (most recent call last):
File "/home/r/ma/fa/./dft.py", line 20, in <module>
ffdf(fig, warn=False)
File "/home/r/ma/fa/venv/lib/python3.12/site-packages/plotly/io/_kaleido.py", line 327, in full_figure_for_development
raise ValueError(
ValueError:
Full figure generation requires the kaleido package,
which can be installed using pip:
$ pip install -U kaleido
- Install kaleido
pip install -U kaleido
- When I am trying to execute the script I get the following error
Traceback (most recent call last):
File "/home/r/ma/fa/./dft.py", line 6, in <module>
from plotly.io import full_figure_for_development as ffdf
File "<frozen importlib._bootstrap>", line 1412, in _handle_fromlist
File "/home/r/ma/fa/venv/lib/python3.12/site-packages/_plotly_utils/importers.py", line 36, in __getattr__
class_module = importlib.import_module(rel_module, parent_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/importlib/__init__.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/r/ma/fa/venv/lib/python3.12/site-packages/plotly/io/_kaleido.py", line 10, in <module>
scope = PlotlyScope()
^^^^^^^^^^^^^
File "/home/r/ma/fa/venv/lib/python3.12/site-packages/kaleido/scopes/plotly.py", line 63, in __init__
raise RuntimeError("Kaleido now requires that chrome/chromium is installed separately. Kaleido will try to detect it automatically, but the environmental error \"BROWSER_PATH\" can also be set")
RuntimeError: Kaleido now requires that chrome/chromium is installed separately. Kaleido will try to detect it automatically, but the environmental error "BROWSER_PATH" can also be set
I was using this scheme to draw charts many times in last years, everything was fine. According to the release history of the Kaleido package pypi, Kaleido has been upgraded yesterday to version 0.4.2.
What is chrome/chromium? There is no such package on PyPi. Do anyone has an idea how to fix the error?
- I create a virtual environment using
python3 -m venv venv
- Activate
source venv/bin/activate
- Install Plotly package
pip install plotly
- Try to run the following script
dft.py
#!./venv/bin/python3
from math import pi
from plotly.graph_objects import Figure, Scatter
from plotly.io import full_figure_for_development as ffdf
dr: int = 1000
dv: list[float] = [2.0*pi*i/dr for i in range(dr + 1)]
# plot the result
fig = Figure()
fig.add_trace(Scatter(x=dv, y=dv))
# save the figure
ffdf(fig, warn=False)
fig.write_image('a.pdf', engine="kaleido")
- An error appears
Traceback (most recent call last):
File "/home/r/ma/fa/./dft.py", line 20, in <module>
ffdf(fig, warn=False)
File "/home/r/ma/fa/venv/lib/python3.12/site-packages/plotly/io/_kaleido.py", line 327, in full_figure_for_development
raise ValueError(
ValueError:
Full figure generation requires the kaleido package,
which can be installed using pip:
$ pip install -U kaleido
- Install kaleido
pip install -U kaleido
- When I am trying to execute the script I get the following error
Traceback (most recent call last):
File "/home/r/ma/fa/./dft.py", line 6, in <module>
from plotly.io import full_figure_for_development as ffdf
File "<frozen importlib._bootstrap>", line 1412, in _handle_fromlist
File "/home/r/ma/fa/venv/lib/python3.12/site-packages/_plotly_utils/importers.py", line 36, in __getattr__
class_module = importlib.import_module(rel_module, parent_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/importlib/__init__.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/r/ma/fa/venv/lib/python3.12/site-packages/plotly/io/_kaleido.py", line 10, in <module>
scope = PlotlyScope()
^^^^^^^^^^^^^
File "/home/r/ma/fa/venv/lib/python3.12/site-packages/kaleido/scopes/plotly.py", line 63, in __init__
raise RuntimeError("Kaleido now requires that chrome/chromium is installed separately. Kaleido will try to detect it automatically, but the environmental error \"BROWSER_PATH\" can also be set")
RuntimeError: Kaleido now requires that chrome/chromium is installed separately. Kaleido will try to detect it automatically, but the environmental error "BROWSER_PATH" can also be set
I was using this scheme to draw charts many times in last years, everything was fine. According to the release history of the Kaleido package pypi., Kaleido has been upgraded yesterday to version 0.4.2.
What is chrome/chromium? There is no such package on PyPi. Do anyone has an idea how to fix the error?
Share Improve this question asked Nov 19, 2024 at 17:22 ResistorSmokerResistorSmoker 598 bronze badges 4 |2 Answers
Reset to default 1chrome/chromium is the Google Chrome internet browser. However, instead of installing it, I would recommend just downgrading to an older version of Kaleido, and avoid these issues. You can run the following command to downgrade Kaleido to a version that does not require that chrome/chromium be installed:
pip install --upgrade "kaleido==0.1.*"
For reference: pip install --upgrade
allows you to change the version of a package, you can supply it with a version number which is lower than the one you have installed, and it will 'upgrade' it to the older version.
I had the same error as you suggested, I forced the previous version.
In the Release history [https://pypi./project/kaleido/#history][1] you can see the they YANKED the release for too many breaking changes.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742410310a4438678.html
pip install 'kaleido==0.2.1' --force-reinstall
and everything works fine, however the problem remains open – ResistorSmoker Commented Nov 19, 2024 at 23:15