Anyone faced the same issue? I have a python module Html2Image() that supposes to take a screenshot of a screen and save it in the particular location. All works well on the localhost but getting that error on render.
Can I install Chrome on my FREE acount? I need to run this code to be able to make a screenshoot of the html file.
from html2image import Html2Image
hti = Html2Image()
hti.output_path = 'files/static/data/'
hti.screenshot(html_file=path + '/plot.html', save_as='plot.png', size=(720, 800))
But I’m getting the error that the code can’t find chome executable file:
FileNotFoundError: Could not find a Chrome executable on this machine, please specify it yourself
I saw this post with a code to install the Chrome but not sure how to do it in FREE acount
Hi,
Chrome is not installed by default on Render Native Runtimes (installed tools & utilities).
You can either attempt to install it as part of your Build Command - there are plenty of examples on this forum, e.g.:
- https://community.render.com/t/cant-find-chrome-binary/9254
- https://community.render.com/t/installing-headless-chromium-w-o-docker/5185
Or, you can use Docker to set up your own environment to have complete control.
Alan
In the example, the build-script.sh is intended to encompass the entire Build Command, that’s why the gist notes:
# add your own build commands...
That’s likely not the issue, but will tidy up your Build Command.
Check your build logs, do they show any issues?
If you’re explicitly defining the path to the executable in your code, then you don’t need the PATH
declaration.
Your code snippet shows the executable line with a trailing /
which would mean it’s interpreted as a folder and not the chrome
binary.
Alan
I did change this line and removed “/“ at the end, still FileNotFoundError.
hti.browser_executable = '/opt/render/project/.render/chrome/opt/google/chrome'
Can someone from support check if Chrome is actually installed and send the exact location of the chrome binary?
I changed the installation location to this and still got a message “…Using Chrome from cache”
STORAGE_DIR=/opt/render/project/files
No, that won’t be the issue, this example snippet has been used successfully plenty of times.
You could add some more commands to the build script to verify the files are where you expect. Or check the build logs is there any unexpected output.
If you want more control over the environment you could consider Docker, so that you can install exactly the libraries/binaries required by your application.
Alan
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.