Skip to content
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

Trying to install version 0.1.0.post1 but not available on Azure App Service #234

Open
Jasonnicholas-ZEN opened this issue Dec 6, 2024 · 12 comments

Comments

@Jasonnicholas-ZEN
Copy link

Jasonnicholas-ZEN commented Dec 6, 2024

Hi,

I am using kaleido==0.1.0.post1 (which works on local) in my python plotly dash web app and deploying this on Azure App Service with the configuration of the app service as:

python: 3.12.6
pip: 24.2

And I am getting this error when deploying on Azure, which seems like it can't find this version:

ERROR: No matching distribution found for kaleido==0.1.0.post1
ERROR: Could not find a version that satisfies the requirement kaleido==0.1.0.post1 (from versions: 0.0.1rc3, 0.0.1rc4, 0.0.1rc5, 0.0.1rc6, 0.0.1rc8, 0.0.1rc9, 0.0.1, 0.0.2, 0.0.3, 0.0.3.post1, 0.1.0a2, 0.1.0a3, 0.1.0, 0.2.0rc1, 0.2.0, 0.2.1, 0.4.0rc1, 0.4.0rc2, 0.4.0rc3, 0.4.0rc4, 0.4.0rc5, 1.0.0rc0)

Out of all these version I have tried 0.2.0, 0.2.1 and both of these are leading to hang state. I have also tried 0.1.0 and this gives me an error of:

ValueError:
The kaleido executable is required by the kaleido Python library, but it was not included
in the Python package and it could not be found on the system PATH.

Searched for included kaleido executable at:
    C:\Code\python.pptx.tester\.venv\Lib\site-packages\kaleido\executable\kaleido

And as I have opted to use version 1.0.0rc0 in the meantime, I am getting this when using the deployed web app:

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.

What can I do to fix this issue (above)?

Is there any fix that I can do to deploy my app and use kaleido for static image rendering in the meantime until Kaleido2 is out? This would be very helpful, thanks!

My requirements.txt:

dash==2.17.0
numpy==1.26.4
pandas==2.1.4
dash-mantine-components==0.14.4
dash-ag-grid==31.2.0
python-dotenv==1.0.1
dash-iconify==0.1.2
dash-bootstrap-components==1.6.0
pyspark==3.5.1
pytz==2024.1
scipy==1.14.0
azure-monitor-opentelemetry==1.6.4
opentelemetry-api==1.28.1
opentelemetry-sdk==1.28.1
msal==1.30.0
python-pptx==1.0.2
# kaleido==0.1.0.post1
kaleido==1.0.0rc0

Lastly, code snippet:

import plotly.graph_objects as go
import pandas as pd
from base64 import b64encode
import plotly

def plotting_function():
    fig = go.Figure()

    # Some scatter plotting etc.

    if save:
        img_bytes = fig.to_image(format="jpeg")
        encoding = b64encode(img_bytes).decode()
        img_b64 = "data:image/jpeg;base64," + encoding
        return img_b64
    else:
        return fig
@Jasonnicholas-ZEN Jasonnicholas-ZEN changed the title Trying to install version 0.1.0.post1 but not available Trying to install version 0.1.0.post1 but not available on Azure App Service Dec 6, 2024
@ayjayt
Copy link
Collaborator

ayjayt commented Dec 6, 2024

Hi! is Azure App System running on windows? 0.1.0.post1 was a windows fix. https://pypi.org/project/kaleido/0.1.0.post1/#files

You can see the two wheels available are for win_amd64 and win32.

kaleido 0.2.1.post1 was the latest linux release.

My understanding is that AAS supports both- but I'm not sure which system you're running.

Either you can do something like this: https://stackoverflow.com/questions/29222269/is-there-a-way-to-have-a-conditional-requirements-txt-file-for-my-python-applica to specify version for specific systems, or just install kaleido normally.

We've yanked all second generation versions or put them behind rc tags which don't get automatically downloaded, all second generation versions will be published shortly under kaleido2!

Kaleido2 will still require you to install chrome separately, although we have instructions for that as well (and is very fast) :-)

@Jasonnicholas-ZEN
Copy link
Author

Hi @ayjayt , no the azure app system is running on a Linux system (OS). thanks for the exciting news of Kaleido2, eager to use that soon! Regarding that Kaleido2 needs chrome installed separately, can I still use this Kaleido2 in my Azure web application that is built with plotly dash, and have a python run stack?

@Jasonnicholas-ZEN
Copy link
Author

Hi @ayjayt , does Kaleido version 0.1.0.post1 uses chromium for export? If it does not, can we just have that version in Linux OS as well? It is working perfectly in my local. But when deployed to Azure, the issue is just that the version does not exist. Thanks

@ayjayt
Copy link
Collaborator

ayjayt commented Dec 9, 2024

Hi!

So, Kaleido2 will have a way to download chrome/ium from within python. All kaleido uses chromium one way or another, on versions <0.4.0 it is internal, above that it is external. That is true on mac, windows, and linux.

Version 0.1.0.post1 is windows only. If you specify version 0.1.0.post1 exactly on any other platform is will not work. If you are deploying to linux, you likely shouldn't be specifying any version at all as pip will find the last known good version.

If for whatever reason you need to specify an exact version, version 0.1.0 (not post) is available for linux, as is version 0.2.1.

Its hard to imagine retroactive release of version 0.1.0 software.

@Jasonnicholas-ZEN
Copy link
Author

Hi @ayjayt , thanks for the suggestions. I have tried using both versions 0.1.0 and 0.2.1, and these were having issues as well such that 0.1.0 is giving the error of :

The kaleido executable is required by the kaleido Python library, but it was not included
in the Python package and it could not be found on the system PATH.

And with version 0.2.1 it is going into hang state when trying to render the image.

Can I know around when Kaleido2 will be released?

Thank you!

@ayjayt
Copy link
Collaborator

ayjayt commented Dec 9, 2024

For the above issue, take a look at this:

#175 (comment)

Was actually meant to get kaleido2 out last week but I think it'll be <10 days given current pacing.

@Jasonnicholas-ZEN
Copy link
Author

Jasonnicholas-ZEN commented Dec 10, 2024

@ayjayt Thanks for that. Looking forward to the new Kaleido2. As per the thread you mentioned, I have tried using the pre-release of Kaleido2 which is version 1.0.0rc0 but it requires chromium/chrome to be installed, but as I am deploying my app not using docker, I can't install chromium with the deployment of the python web app. Just to re-iterate, for the new upcoming Kaleido2, this would not be the case as Kaleido2 will have a way to download chrome/chromium from within python, is that correct?

Otherwise do you reckon this is possible? https://stackoverflow.com/questions/76324009/how-can-i-deploy-python-playwright-chromium-to-an-azure-app-function-using-githu

By doing the following? Image

Cheers!

@ayjayt
Copy link
Collaborator

ayjayt commented Dec 11, 2024

this would not be the case as Kaleido2 will have a way to download chrome/chromium from within python, is that correct?

yes, this is true. There will be a .get_chromium(path=__file__) type command that will download chromium automatically to the python path.

For the second part, that looks like a good way to change an environmental variable, which in our case would be BROWSER_PATH.

Here is some bash script that I'm not sure if you can use to download chromium:

wget $(curl -s https://googlechromelabs.github.io/chrome-for-testing/known-good-versions-with-downloads.json |

jq -r '.versions.[-1].downloads.chrome.[] | select(.platform == "linux64").url')

You need jq, wget, and curl. Some systems have a problem with the shortened jq syntax, so you need to do something like

wget $(curl -s https://googlechromelabs.github.io/chrome-for-testing/known-good-versions-with-downloads.json |

jq -r '.versions | .[-1] | .downloads.chrome | .[] | select(.platform == "linux64").url')

@Jasonnicholas-ZEN
Copy link
Author

Hi @ayjayt , just a quick follow up, can I know if Kaleido 2 will still be released sometime soon? Thanks and cheers

@ayjayt
Copy link
Collaborator

ayjayt commented Jan 20, 2025

Yeah, 100% dev right now is testing and debugging. I went to deep on a reorg (which is done) to meet my original deadline but I did solve a bunch of issues so that'll hopefully make rollout smoother. Barring no personal issues it should be this week if not tomorrow. Thanks for the patience!

@Jasonnicholas-ZEN
Copy link
Author

Thanks for the update @ayjayt , looking forward to using the new Kaleido 2!

@ayjayt
Copy link
Collaborator

ayjayt commented Jan 29, 2025

Hey, so I ended up with a fever last week, but yes, @Jasonnicholas-ZEN, we're finally moving through publishing :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants