-
Notifications
You must be signed in to change notification settings - Fork 43
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
Static Image Export Fails If Kaleido is Installed in a virtualenv with Spaces in the Path #78
Comments
Thanks for the report |
I am having the same issues with the same package versions, except I am using Windows, with Anaconda. My conda environment is located in a spot with spaces ('C:\Path\with spaces") and the error I receive is: "C:\Path\with" is not recognized as an internal or external command, operable program or batch file. |
i have similar issue. i've already installed package kaleido using "pip install -U kaleido" my code error msg
ver. plotly: 4.12.0 |
@huni1023, I had the same issue running kaleido on Google Colab. I ran I solved it by running
Kernel restart, ver. Plotly: 5.5.0 |
Thanks for this useful conversation guys, @dgoppenheimer solution worked for me as well. It seems getting Kaleido installed through conda rather than pip helped resolve my issue, too. |
I have what seems to be the same problem, which I may have tagged onto a less-relevant Issue here: #131 (comment) I am using a virtual environment through "pipenv", and a recent update in homebrew pipenv and python 3.9 (3.9.10 -> 3.9.12) seems to have surfaced this bug for me. When I move the project to a location with no spaces in the dir, it works just fine, but I cannot recreate @dgoppenheimer's fix in my pipenv virtual environment (using either pipenv or pip to uninstall/install). Downgrading versions of plotly (5.6.0 -> 5.5.0) and kaleido ( 0.2.1 --> 0.2.0) did not improve things. Has anyone else run into this and/or found a fix? kaleido==0.2.1 Output of "python3 -m pip show kaleido": |
You can install the Kaleido globally and use the package without any
virtual env.
…On Wed, Mar 30, 2022 at 14:55 Drew Hill ***@***.***> wrote:
I have what seems to be the same problem, which I may have tagged onto a
less-relevant Issue here: #131 (comment)
<#131 (comment)>
I am using a virtual environment through "pipenv", and a recent update in
homebrew pipenv and python 3.9 (3.9.10 -> 3.9.12) seems to have surfaced
this bug for me. When I move the project to a location with no spaces in
the dir, it works just fine, but I cannot recreate @dgoppenheimer
<https://github.com/dgoppenheimer>'s fix in my pipenv virtual environment
(using either pipenv or pip to uninstall/install). Downgrading versions of
plotly (5.6.0 -> 5.5.0) and kaleido ( 0.2.1 --> 0.2.0) did not improve
things.
Has anyone else run into this and/or found a fix?
—
Reply to this email directly, view it on GitHub
<#78 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AF3F6DBPAYVFSRGULF263HLVCP3FFANCNFSM4YTNC5IQ>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Thanks @ZacksAmber. Unfortunately, I am working on a project that currently requires a virtual environment. On the other hand, you did inspire me to confirm that this bug is indeed only in the virtual environment space -- running in my user environment works just fine. |
You’re welcome.
Actually, I was trying to run Kaleido inside an virtual env many hours and
failed. If you do need the special plot formats that can only be generated
by Kaleido such as SVG, you can keep read the following solutions; If you
can accept traditional image formats such as PNG, you don’t really need
Kaleido — just output the image by Plotly directly.
Here is my website http://zacks.cloud and
http://www.zacks.cloud/projects/disaster_response_pipelines/
For section SKILL LEVELS on http://zacks.cloud
1. I pre-generated the SVG by a global Python interpreter with Kaleido
since those images are rarely changed — I don’t need a real time plot here.
For section OVERVIEW OF TRAINING DATASET on
http://www.zacks.cloud/projects/disaster_response_pipelines/
1. I used Python Plotly low level API (import plotly.graph_objects as go)
to output plot into JSON, which was encapsulated into a docket image.
Unfortunately plotly.express here cannot work since it cannot output JSON.
2. Then built an API to return the JSON generated by step 1.
3. Finally, the Flask app (my website that is in another docker image)
calls the API from step 2. Then the Plotly JavaScript render the
interactive plot based on the JSON.
In conclusion:
- If you need a web app, consider the second solution. In this case, you
don’t need Kaleido since you only use the interactive plots instead of a
static images;
- If you do need static images, consider the first solution and you can
make a improvement. Build a Docker image with minimum required Python
packages such as Plotly, Kaleido, and API packages into a global Python
env. This docker image running as an API that returns SVGs. Then your main
project gets the SVG from that API.
Hope my experience can help you.
…On Wed, Mar 30, 2022 at 23:52 Drew Hill ***@***.***> wrote:
Thanks @ZacksAmber <https://github.com/ZacksAmber>. Unfortunately, I am
working on a project that currently requires a virtual environment.
On the other hand, you did inspire me to confirm that this bug is indeed
only in the virtual environment space -- running in my user environment
works just fine.
—
Reply to this email directly, view it on GitHub
<#78 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AF3F6DGT2USJH2T6PVL73ATVCR2E3ANCNFSM4YTNC5IQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
I just wanted to add myself to this problem. I'm having the same Issue. "name": "ValueError", Im going to stop using a virtual enviroment for now. |
Hi all, any news on this thread? Actually I got the same error after more than 2 years from @dtoniolo report! |
happening to me too still. |
I also ran into this issue, and for me the solution was in the title of this issue. I was using a virtual environment with poetry inside a folder with spaces (like "My folder/.venv"). The error was fixed by simply removing spaces in the folder path to something like "My_folder/.venv". Maybe it is obvious, but for me this solution is a lot better than installing plotly and kaleido in your global environment. Running on Ubuntu with: |
An easy in-place fix is to quote the paths in the kaleido script in #!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
export LD_LIBRARY_PATH="$DIR/lib:$LD_LIBRARY_PATH"
export FONTCONFIG_PATH="$DIR/etc/fonts"
export XDG_DATA_HOME="$DIR/xdg"
unset LD_PRELOAD
cd "$DIR"
./bin/kaleido "$@" |
Versions
Platform: macOS Catalina 10.15.7
Python: 3.8.5
Plotly: 4.14.3
Kaleido: 0.2.0
Description of the Problem
If
kaleido
is installed in a virtual environment with spaces in aitspath, an error will be generated. Here's a minimal reproducible example:Running this will produce the following error trace:
The text was updated successfully, but these errors were encountered: