0

I opened jupyter notebook on my google cloud cluster with these steps: https://cloud.google.com/dataproc/docs/tutorials/jupyter-notebook Now I get an error on this piece of code:

import selenium  
from contextlib import closing  
from selenium.webdriver import PhantomJS  
with closing(PhantomJS()) as browser:  
     #some further code

I get the following error message:

WebDriverException: Message: 'phantomjs' executable needs to be in PATH.

Now in my own environment when I got this error, I fixed it by adding the path to my phantomjs.exe in my system variables. But now while I am on the google cloud cluster environment, I am looking for another way to add the phantomjs.exe path. Any other solution would be appreciated aswell.

Selman
  • 1
  • 1

1 Answers1

0

I have no experience with Selenium or PhantomJS. However since Dataproc runs on Debian 8 Jessie and not Windows, you probably want to run sudo apt-get install phantomjs instead of using an exe. You could either install it manually after SSHing or in an initialization action.

Patrick Clay
  • 1,339
  • 7
  • 5
  • Yes this was very helpful, I managed to run your codeline in my gcloud shell on my cluster and it downloaded PhantomJS to the cluster. Now I am facing another error (on the same piece of code). 'WebDriverException: Message: Service phantomjs unexpectedly exited. Status code was: -6'. Any ideas? – Selman Nov 06 '17 at 16:49