Forums

'chromedriver' executable may have wrong permissions

I am trying to use selenium along with chrome web driver .chrome web driver .exe is already uploaded on the code files . How can I fix the following problem ?

self.service.start() File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/common/service.py", line 76, in start os.path.basename(self.path), self.start_error_message) selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable may have wrong permissions. Please see https://sites.google.com/a/ chromium.org/chromedriver/home

I'm pretty sure Chrome doesn't work in our virtualisation system. We have a version of Firefox installed that does work, though.

Does it still not work?

No, we have a new experimental virtualization system. We can switch your account over to it. Headless chrome works there.

fjl, can you switch my account to the experimental virtualization system, please?

fjl, I am a beginner in programming, so just wondering that switching to the experimental virtualization system will not cause problems for the working parts of my web app, right? If not, then please switch me the experimental virtualization system as well.

@ipala5, it shouldn't cause issues, but it's still experimental and we haven't identified all of the issues it may have. So, while it shouldn't cause any issues with your web app, it may. Let us know if you'd still like to go ahead with the switch.

@glenn, I also would like to switch to the experimental virtualization system.

It is already enabled for your account. I believe you've asked for it before and we enabled it.

Hi glenn, could you please switch me over to the experimental virtualization system? Also, could you inform me when its done. Thanks

@ipala5 -- sure, no problem -- that's done now. To use Chrome, you'll need to upgrade Selenium for your account -- for example, if you're using Python 3.7, run this in Bash:

pip3.7 install --user --upgrade selenium

...and then you can run Selenium with Chrome using code like this:

chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("--headless")
chrome_options.add_argument("--disable-gpu")
browser = webdriver.Chrome(options=chrome_options)

try:
    browser.get("https://www.google.com")
    return "Page title was '{}'".format(browser.title)

finally:
    browser.quit()

Hi @glenn, I also would like to switch to the experimental virtualization system. Thks

No problem. I have enabled it for your account.

Hi glenn, I have followed exactly what you have said. I have successfully been able to upgrade selenium, however my code doesn't seem to be working... from test/models.py code that you said to run: Error that emerges:

Thank you for all the help.

I don't think you can see the images I have inserted -- so just go to test/models.py

Taking a peak at the error you are seeing:

'chromedriver' executable needs to be in PATH

It seems you don't have chrome/chromdriver installed. Our latest system image does have that ready for you. We can switch you over to that, but because it will change the versions of python libraries etc, that means that all your code may break and you will need to delete and recreate your virtualenvs. Do you want us to do that? Otherwise, you can also try to build chrome yourself.

no, I can't do anything that will break my code currently as my assignment is due very soon. I do have 'chromedriver.exe' file in my test/ folder

Also, I just remembered that I have chrome version 81.0.4044.92 but I have had to install the driver for 81.0.4044.69 ( the most current release according to https://chromedriver.chromium.org/downloads/version-selection). I don't know if that will make a difference.. but yeh just though I would add.

chromedriver.exe is the Windows version of Chromedriver -- to run this on PythonAnywhere, you would need the 64-bit Linux version for the version of Chrome that you're using.

sorry, for constantly asking so many questions. I have installed the linux version and instead of chromedriver.exe it is now just chromedriver. However, I am still getting the same error: 'chromedriver' executable needs to be in PATH' Also, my chromedriver is in the same directory as my python file

Is that directory in the PATH? See result of echo $PATH in the bash console.

I have added the directory to my PATH, however same error is received. bash console /home/ipala5/test present

The error in models.py when I run it error

where is the chromedriver that you installed, what is your path, and what is the error?

The chromedriver is installed in /home/ipala5/test The images of the error and the path were attached in the above post (I have hosted my images on https://ibb.co/h8kG7vP and https://ibb.co/VSyTp7m)

hi, i encountered following error after i updated my chromedriver on server: Message: 'chromedriver' executable may have wrong permissions. Please see https://sites.google.com/a/chromium.org/chromedriver/home can anyone kindly guide me how to fix this issue, thank you

i got this error, please can anyone update which version of chrome using on server thankyou Message: session not created: This version of ChromeDriver only supports Chrome version 81

The version of Chrome needs to match the version of Chromedriver, and if you've uploaded a new version then you need to also upload the matching version of Chrome; that's not something we can change for you.

Out of interest, why don't you just use the version that is already there?

I'm with same problem. I think the main issue is that I don't have any Chrome in pythoneverywhere server. How to deal with it? I've tried to install it and I got a error

Ok, @dividendocao, I have enabled the new virtualisation system for your account. Give it a go now.

could you please switch me over to the experimental virtualization system?

sure @chikaki I have switched you over now.

could you please switch me over to the experimental virtualization system?

No problem. I have switched your account over.

Is the compatible version of chromedriver 78? I am still getting the error "WebDriverException: Message: 'chromedriver' executable may have wrong permissions."

that's not a version problem. That's a file permissions problem. Did you build your own chrome?

Hi, I am having troubles with this too. Would you be able to help switch my account over to the experimental virtualisation system as well?

sure, that's already done for you

Hi, even after the move i am getting the errors:

PermissionError: [Errno 13] Permission denied: '/home/jacommoditydata/mysite/chromedriver'

and also

selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable may have wrong permissions. Please see https://sites.google.com/a/chromium. org/chromedriver/home

Does anyone know what the reasons may be? How can I go about fixing that?

Thanks Conrad. I'm not sure I understand what you mean by building my own chrome. Could you provide a resource that explains?

@jacommoditydata - It looks like you're trying to use a different chromedriver to the one that is already supplied. If you do not specify the chromedriver executable or the path to it, then you should just use the built in one. @cwestie - I suspect that you have the same issue as @jacommoditydata

hi glenn, when i remove the chromedriver path altogether, i get the following error:

selenium.common.exceptions.WebDriverException: Message: chrome not reachable (Session info: headless chrome=78.0.3904.70) (Driver info: chromedriver=2.42.591071 (0b695ff80972cc1a65a5cd643186d2ae582cd4ac),platform=Linux 4.4.0-1106-aws x86_64)

Thanks, Glenn. I'm getting the following error:

WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally (unknown error: DevToolsActivePort file doesn't exist) (The process started from chrome location /usr/bin/chromium-browser is no longer running, so ChromeDriver is assuming that Chrome has crashed.) (Driver info: chromedriver=2.42.591071 (0b695ff80972cc1a65a5cd643186d2ae582cd4ac),platform=Linux 4.4.0-1106-aws x86_64)

@jacommoditydata, @cwestie27 -- what do you see if you run the following commands in a fresh Bash console?

which chromedriver
chromedriver --version
which chromium-browser
chromium-browser --version

Hi giles, this is what i get:

10:27 ~ $ which chromedriver
/usr/local/bin/chromedriver
10:26 ~ $ chromedriver --version
ChromeDriver 2.42.591071 (0b695ff80972cc1a65a5cd643186d2ae582cd4ac)
10:26 ~ $ which chromium-browser
/usr/bin/chromium-browser
10:26 ~ $ chromium-browser --version
Chromium 78.0.3904.70 Built on Ubuntu , running on Ubuntu 16.04

when i run it again in a new bash i get the following:

10:28 ~ $ 10:27 ~ $ which chromedriver
bash: 10:27: command not found
10:28 ~ $ /usr/local/bin/chromedriver
Starting ChromeDriver 2.42.591071 (0b695ff80972cc1a65a5cd643186d2ae582cd4ac) on port 9515
Only local connections are allowed.

[edit by admin: formatting]

OK, that's good news at least -- those are the pre-installed ones. What happens if you run a super-simple selenium script like this?

chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("--headless")
chrome_options.add_argument("--disable-gpu")
browser = webdriver.Chrome(options=chrome_options)

try:
    browser.get("https://www.google.com")
    print("Page title was '{}'".format(browser.title))

finally:
    browser.quit()

Running the above simple code I get TypeError: init() got an unexpected keyword argument 'options'

That sounds like you're running a version of webdriver that does not support the options argument. If you're running that code in a virtualenv, try running it outside of the virtualenv. Also, if you have installed selenium with the --user argument, try uninstalling it, so you can use the system-provided selenium.

I don't think that's the case. I opened a bash console where my simple python script you provided is and did the below. These are the ones provided right? chromedriver 78 should have the options argument?

14:51 ~/.local $ chromedriver --version
ChromeDriver 2.42.591071 (0b695ff80972cc1a65a5cd643186d2ae582cd4ac)
14:51 ~/.local $ which chromedriver
/usr/local/bin/chromedriver
14:52 ~/.local $ which chromium-browser
/usr/bin/chromium-browser
14:52 ~/.local $ chromium-browser --version
Chromium 78.0.3904.70 Built on Ubuntu , running on Ubuntu 16.04
14:52 ~/.local $

[edit by admin: formatting]

Have you upgraded Selenium to the most recent version? For example, if you're using Python 3.7, you would run

pip3.7 install --user --upgrade selenium

Thank you, Giles! That worked. Now I'm trying a piece of code that simply inputs text into an input field of instagram to log in via selecting the respective Xpath. Does PA have the ability to do that? The error I'm getting is:

WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally (unknown error: DevToolsActivePort file doesn't exist) (The process started from chrome location /usr/bin/chromium-browser is no longer running, so ChromeDriver is assuming that Chrome has crashed.) (Driver info: chromedriver=2.42.591071 (0b695ff80972cc1a65a5cd643186d2ae582cd4ac),platform=Linux 4.4.0-1106-aws x86_64)

That sounds really weird -- it's as if Chromium crashed. Did you get any emails from our systems saying that it had used up too much memory? There is a 3GiB memory limit for processes on PythonAnywhere, which certainly should be sufficient for showing a web page, but with modern websites you never know...

No, I haven't. Is there anything else you can think of trying?

If you have the example code that accesses Google working and that does not cause Chrome to crash, then it's probably something about the code that is accessing instagram. Start with the Google code, and slowly add in the instagram code into it to see if you can determine where the browser starts crashing. Then maybe we can use that information to identify what's causing the crash.

Hi! I have tried the code above and it throws this error: TypeError: init() got an unexpected keyword argument 'options'... I wanted to write a more complex code, but I don't think that the chrome driver is working properly... I have also attached the error: https://ibb.co/r2tg1TY . How can I solve it? :)

that sounds like your python selenium library version is incorrect

Well, I tried to run the same script from the bash and this is what I get now... I've seen the error above too, but cannot solve it. https://ibb.co/HpsTnzM

What is the command / script that you are using?

Sorry about that, i managed to solve. The problem was that i didn't have the activation of the chrome virtualization. Thanks!

Glad to see that you figured it out!

Hi, I am having issues with this too. Could you switch my account over to the experimental virtualisation system as well? Thanks in advance!

Hi @glenn, I also would like to switch to the experimental virtualization system. Thks

@eudesrodrigo It's done for you

Giles wrote: chromedriver.exe is the Windows version of Chromedriver -- to run this on PythonAnywhere, you would need the 64-bit Linux version for the version of Chrome that you're using. But I'm using Mac. Should it be the version of Chrome that PythonAnywhere is using? Please clarify

Hi @glenn, please switch my account to the experimental virtualization system. Thanks!

@alvaropmartins -- the operating system that your own computer is using does not matter; you need to use the 64-bit Linux version of Chromedriver because our servers run 64-bit Linux.

@thirstybear85 no problem, that's done now. As a next step, you'll need to upgrade Selenium for your account -- for example, if you're using Python 3.7, run this in Bash:

pip3.7 install --user --upgrade selenium

...and then you can run Selenium with Chrome using code like this:

chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("--headless")
chrome_options.add_argument("--disable-gpu")
browser = webdriver.Chrome(options=chrome_options)

try:
    browser.get("https://www.google.com")
    print("Page title was '{}'".format(browser.title))

finally:
    browser.quit()

Thanks a lot. Turns out that Firefox was just fine. I followed: https://www.pythonanywhere.com/forums/topic/26693/

@giles - thank you! Maybe you can help me a bit further... I upgraded selenium via bash console and now tried to run the sample code you provided in a notebook but I get this error:

WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally (unknown error: DevToolsActivePort file doesn't exist) (The process started from chrome location /usr/bin/chromium-browser is no longer running, so ChromeDriver is assuming that Chrome has crashed.) (Driver info: chromedriver=2.42.591071 (0b695ff80972cc1a65a5cd643186d2ae582cd4ac),platform=Linux 4.4.0-1106-aws x86_64)

just to double check- is that a new bash console since Giles turned on the features for you? (perhaps try closing all the consoles so you don't get confused with an old one?)

@conrad - yes I did install on a new bash console after giles post. also double checked it again now, closed all consoles started a new one and it says selenium is up to date. then I ran the sample code again and it gave me this error this time:

TypeError: init() got an unexpected keyword argument 'options'

That error would definitely suggest that it's not using the most recent version of Selenium. What command did you use to upgrade it, and what command are you using to run the script? Are you using a virtualenv?

I used the bash command giles provided in his post above:

pip3.7 install --user --upgrade selenium

I'm not using a virtualenv, I just ran that code in a notebook with a python 3.7 kernel which I opened from my dashboard. I'm a newbie maybe I have something wrong with the imports? Or some other stupid mistake??

import selenium
from selenium import webdriver
from selenium.webdriver import Chrome

chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("--headless")
chrome_options.add_argument("--disable-gpu")
browser = webdriver.Chrome(options=chrome_options)

try:
    browser.get("https://www.google.com")
    print("Page title was '{}'".format(browser.title))

finally:
    browser.quit()

This code gives me this error:

WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally (unknown error: DevToolsActivePort file doesn't exist) (The process started from chrome location /usr/bin/chromium-browser is no longer running, so ChromeDriver is assuming that Chrome has crashed.) (Driver info: chromedriver=2.42.591071 (0b695ff80972cc1a65a5cd643186d2ae582cd4ac),platform=Linux 4.4.0-1106-aws x86_64)

The error mentioned in my last post (TypeError: init() got an unexpected keyword argument 'options') occured when I accidently ran the code on a python 3.8 kernel which of course can't work as I upgraded selenium on python 3.7 in bash console. so you can forget about that error, sorry. my problem is the one mentioned with the code above in this post. any further help much apreciated;-)

hi giles - I used the command line provided in your earlier post.

pip3.7 install --user --upgrade selenium

I'm not using a virtualenv. I started a notebook with python 3.7 from my dashboard and used the code below. I'm relatively new to python so maybe it is just some stupid mistake?

import selenium
from selenium import webdriver
from selenium.webdriver import Chrome
from selenium.webdriver import ChromeOptions


chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("--headless")
chrome_options.add_argument("--disable-gpu")
browser = webdriver.Chrome(options=chrome_options)

try:
    browser.get("https://www.google.com")
    print("Page title was '{}'".format(browser.title))

finally:
    browser.quit()

This code gives mit this error:

WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally
  (unknown error: DevToolsActivePort file doesn't exist)
  (The process started from chrome location /usr/bin/chromium-browser is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
  (Driver info: chromedriver=2.42.591071 (0b695ff80972cc1a65a5cd643186d2ae582cd4ac),platform=Linux 4.4.0-1106-aws x86_64)

Please forget about the error mentioned in my last post (TypeError: init() got an unexpected keyword argument 'options'), as I accidently used a python 3.8 kernel which obviously can't work as I updated selenium in bash for python 3.7. Any further help much appreciated!

Ah, I'm sorry! I completely missed the fact that you were running this code in a notebook. Unfortunately the new virtualization system doesn't work in notebooks yet -- that would be what's causing the problem here :-(

ah ok, that makes sense:-)) thank you anyway!

Can you activate my chrome virtualization. Thanks

Sure, that's done. See my earlier post for the next steps.

Could you please activate my chrome virtualization? Thanks so much!

@acj608 It's done for you.

Hi @glenn, I also would like to switch the experimental chrome virtualization. Thank you!

okay, that has actually already been switched on for you.

Hi @glenn, I also would like to switch the experimental chrome virtualization. Thank you!

Sure, that's done. See my earlier post for the next steps.

I am getting this error: -

Bad display name ""

Now i am getting this error: -

Message: 'chromedriver.exe' executable may have wrong permissions.

Please let me know what can i do to solve this.

Thanks!

chromedriver.exe would be the Windows version of ChromeDriver -- you should not install that into your account. Instead, just use the one that is pre-installed -- Selenium will do that if you do not specify a path to ChromeDriver when you create your browser.

I removed the path of my own chrome driver and now i am getting this error: -

Bad display name ""enter image description here

It looks like the image link you posted is broken. Just post the text of the exception.

This is the image link. You can visit this to see the error: https://ibb.co/gSMdzT0

Could you please activate my chrome virtualization?I would be very happy about that.

I see the part of the traceback, but not the Error. Could you take it from your logs? It looks like it's coming from your web app, so the link to your error.log is on your "Web" page on PythonAnywhere. The newest entries are on the bottom.