Thought I should start a new topic since I wasn’t getting any response after my first problem was fixed here: Getting Chrome in PATH
My web service was able to find Chrome, but now I’m getting the error: Message: unknown error: cannot find Chrome binary
I tried fixing it by adding the line: chrome_options.binary_location = "/opt/render/project/.render/chrome/opt/google/chrome/"
before the service variable, but that just gave me the error: unknown error: no chrome binary at /opt/render/project/.render/chrome/opt/google/chrome/
I’ve searched all over the internet, but all the solutions I’ve found either don’t work, or are meant for local hosting. Any help appreciated!
Essentially, you need to install Chrome at build time to a path that is carried over from build to the running instance (somewhere in /opt/render/project/)
The second link you posted is the one I followed to get me this far. I was able to get chrome in PATH (the error I was getting before was “Chrome not in PATH”) using the export command at build time, but now it’s telling me it can’t find the chrome binary. I’m not sure I’m uploading the right files either. I only uploaded chromedriver.exe into my root program folder.
service = Service(ChromeDriverManager().install()) driver = webdriver.Chrome(executable_path="opt/render/project/chromedriver", desired_capabilities=capabilities,options=chrome_options,service=service)
and this is error that occurs between the service and driver variables: Feb 14 11:28:32 AM Message: unknown error: Chrome failed to start: exited abnormally. Feb 14 11:28:32 AM (unknown error: DevToolsActivePort file doesn't exist) Feb 14 11:28:32 AM (The process started from chrome location /opt/render/project/ is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
Let’s take a step back: Are you installing the Chrome & Chromedriver binaries explicitly as part of your Build Command?
We’re going to need some details here, what you’re trying, what you’re installing, and what output you’re getting.
If you don’t want to share these details on the community forum, please feel free to raise a ticket from the “Contact Support” link at the bottom of the Dashboard.
I am not installing Chrome & Chromedriver binaries as part of my Build command. I was told when I was getting the error that Chrome wasn’t in PATH that this code: service = Service(ChromeDriverManager().install()) driver = webdriver.Chrome(executable_path="opt/render/project/chromedriver", desired_capabilities=capabilities,options=chrome_options,service=service)
took care of that. I’m not sure though. I would rather install them as part of the Build Command, so that they aren’t wasting time installing every time I start the service, but I’m not sure how to do that. Chromedriver.exe and Chrome.exe are in the root directory, but I’m not sure how to install binaries.
Render Native Environments don’t have Chrome installed by default, so you’ll need to install it yourself. I linked to a post with an example of that in my first reply.
Your .exe files are probably for Windows. Render environments are Linux.
If you’re using something like pyppeteer, then that can also install Chrome, if you look at the pyppeteer docs, you could try to install manually at the build step, maybe something like:
You would also need to refer to their docs to ensure it’s installed an a path that is taken from build to runtime, as per puppeteer, which I also linekd to a post in my first reply.
My case is that basically if I run the same set of script in my local device, the function is working well normally. However, this problem comes up when trying to run it after having deployed on render successfully.
service = Service(ChromeDriverManager().install())
Although I have used Chromedriver manager in the built already, I’d like to ask two questions.
Will render automatically detect the path from chromedriver manager installation and use it when scripts running? Or I need to tell render the path in the script? If so, what path I can use
As I can run the script smoothly in local, does Chrome binary imply I need to install Chrome browser additionally on render cloud web service? I try to add chrome linux file in my root directory, but it seems not working yet.
Appreciate if you could share some thoughts if things are doable.
The questions you’ve raised have been covered above.
There will always be differences between environments development mode/Local, production mode/Render, etc. These differences need to be considered and configured as required for your own app in each environment. Every app is different, their purpose, style & implementation can vary wildly so we’re unable to provide general debugging help as you’re the one that will know your app best.
In summary:
Chrome is not available by default on Render Native Environments. You’ll either need to install it as part of the Build Command, or create your own environment with the packages you need in Docker.
If installing it on a Native Environment, you can use whichever means you want.
A basic example build script gist is linked in one of the posts linked above.
Some packages have Chrome installers built in, like Puppeteer on Node and Pyppeteer on Python, also referenced above.
You’ll want to configure Chrome to be installed somewhere within the /opt/render/project path at Build time, so that it’s available at runtime. You’ll also need to configure whichever packages require Chrome to the install path you choose.
I’m still getting the error that the chrome-binary cannot be found.
This is my build command (most of it copied from the gist you shared):
#!/usr/bin/env bash # exit on error set -o errexit
STORAGE_DIR=/opt/render/project/.render
if [[ ! -d $STORAGE_DIR/chrome ]]; then echo "...Downloading Chrome" mkdir -p $STORAGE_DIR/chrome cd $STORAGE_DIR/chrome wget -P ./ https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb apt-get install -y libglib2.0-0=2.50.3-2 \ libnss3=2:3.26.2-1.1+deb9u1 \ libgconf-2-4=3.2.6-4+b1 \ libfontconfig1=2.11.0-6.7+b1 \ chromium-browser sudo dpkg -x ./google-chrome-stable_current_amd64.deb $STORAGE_DIR/chrome rm ./google-chrome-stable_current_amd64.deb cd $HOME/project/src # Make sure we return to where we were else echo "...Using Chrome from cache" fi
I removed the apt-get and sudo commands (I only put them in because I came across a stackoverflow post that suggested if the chrome binary couldn’t be found I might need to add some files):
here’s my build command:
#!/usr/bin/env bash #exit on error
set -o errexit
STORAGE_DIR=/opt/render/project/.render
if [[ ! -d $STORAGE_DIR/chrome ]]; then
echo “…Downloading Chrome”
mkdir -p $STORAGE_DIR/chrome
cd $STORAGE_DIR/chrome
wget -P ./ https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
dpkg -x ./google-chrome-stable_current_amd64.deb $STORAGE_DIR/chrome
rm ./google-chrome-stable_current_amd64.deb
cd $HOME/project/src # Make sure we return to where we were
else
echo “…Using Chrome from cache”
fi
I tried to run Pyppeteer which the app was deployed successfully. However, render log respond this message to me, although the app can work in my local machine. any thoughts?
Feb 22 06:07:09 PM PermissionError: [Errno 13] Permission denied: ‘/opt/render/.local/share/pyppeteer/local-chromium/588429/chrome-linux/chrome’
These are 2 different conversations, and this post is getting extremely confused.
idylljokesmith - The script in the gist installs Chrome. You’ve changed the path export to reference “chromedriver”. That’s a different binary, you’d need to install that separately, there are Python packages that appear to help with that.
Yeyoyo, I mentioned Pyppeteer above, there’s an install command, and you’ll need to refer to their docs for more info.
Thank you Alan! I’ve referred to your mentioned above regarding Pyppeteer install command and deployed successfully. Render log stills respond me this error. Likely Render rejects the web service app access to this render path when any functions use Pyppeteer (It’s weird), although it has been deployed successfully and other web app can work normally.
Feb 22 06:07:09 PM PermissionError: [Errno 13] Permission denied: ‘/opt/render/.local/share/pyppeteer/local-chromium/588429/chrome-linux/chrome’
Essentially, you need to install Chrome at build time to a path that is carried over from build to the running instance (somewhere in /opt/render/project/)
I’ve given up on trying to get this to work because I don’t understand enough. I’m trying the Docker route, but not fairing much better. Seems this might be beyond my capabilities at the moment. Not sure what to mark as a solution.