WebDriverException while working with Selenium in Google Collab and Chrome: - python

I am trying to get selenium to work with Python for web scraping purposes in Google Colab. I countered the following errors:
First I install all the required libraries:
!pip3 install -U selenium
!pip3 install webdriver-manager
!apt-get install -y chromium-browser
!apt install chromium-chromedriver
This gave me this output:
Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/
Requirement already satisfied: selenium in /usr/local/lib/python3.8/dist-packages (4.8.2)
Requirement already satisfied: trio-websocket~=0.9 in /usr/local/lib/python3.8/dist-packages (from selenium) (0.9.2)
Requirement already satisfied: certifi>=2021.10.8 in /usr/local/lib/python3.8/dist-packages (from selenium) (2022.12.7)
Requirement already satisfied: trio~=0.17 in /usr/local/lib/python3.8/dist-packages (from selenium) (0.22.0)
Requirement already satisfied: urllib3[socks]~=1.26 in /usr/local/lib/python3.8/dist-packages (from selenium) (1.26.14)
Requirement already satisfied: sortedcontainers in /usr/local/lib/python3.8/dist-packages (from trio~=0.17->selenium) (2.4.0)
Requirement already satisfied: outcome in /usr/local/lib/python3.8/dist-packages (from trio~=0.17->selenium) (1.2.0)
Requirement already satisfied: exceptiongroup>=1.0.0rc9 in /usr/local/lib/python3.8/dist-packages (from trio~=0.17->selenium) (1.1.0)
Requirement already satisfied: attrs>=19.2.0 in /usr/local/lib/python3.8/dist-packages (from trio~=0.17->selenium) (22.2.0)
Requirement already satisfied: sniffio in /usr/local/lib/python3.8/dist-packages (from trio~=0.17->selenium) (1.3.0)
Requirement already satisfied: idna in /usr/local/lib/python3.8/dist-packages (from trio~=0.17->selenium) (2.10)
Requirement already satisfied: async-generator>=1.9 in /usr/local/lib/python3.8/dist-packages (from trio~=0.17->selenium) (1.10)
Requirement already satisfied: wsproto>=0.14 in /usr/local/lib/python3.8/dist-packages (from trio-websocket~=0.9->selenium) (1.2.0)
Requirement already satisfied: PySocks!=1.5.7,<2.0,>=1.5.6 in /usr/local/lib/python3.8/dist-packages (from urllib3[socks]~=1.26->selenium) (1.7.1)
Requirement already satisfied: h11<1,>=0.9.0 in /usr/local/lib/python3.8/dist-packages (from wsproto>=0.14->trio-websocket~=0.9->selenium) (0.14.0)
Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/
Requirement already satisfied: webdriver-manager in /usr/local/lib/python3.8/dist-packages (3.8.5)
Requirement already satisfied: packaging in /usr/local/lib/python3.8/dist-packages (from webdriver-manager) (23.0)
Requirement already satisfied: python-dotenv in /usr/local/lib/python3.8/dist-packages (from webdriver-manager) (0.21.1)
Requirement already satisfied: requests in /usr/local/lib/python3.8/dist-packages (from webdriver-manager) (2.25.1)
Requirement already satisfied: tqdm in /usr/local/lib/python3.8/dist-packages (from webdriver-manager) (4.64.1)
Requirement already satisfied: chardet<5,>=3.0.2 in /usr/local/lib/python3.8/dist-packages (from requests->webdriver-manager) (4.0.0)
Requirement already satisfied: idna<3,>=2.5 in /usr/local/lib/python3.8/dist-packages (from requests->webdriver-manager) (2.10)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.8/dist-packages (from requests->webdriver-manager) (2022.12.7)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in /usr/local/lib/python3.8/dist-packages (from requests->webdriver-manager) (1.26.14)
Reading package lists... Done
Building dependency tree
Reading state information... Done
chromium-browser is already the newest version (1:85.0.4183.83-0ubuntu0.20.04.2).
The following package was automatically installed and is no longer required:
libnvidia-common-510
Use 'apt autoremove' to remove it.
0 upgraded, 0 newly installed, 0 to remove and 21 not upgraded.
Reading package lists... Done
Building dependency tree
Reading state information... Done
chromium-chromedriver is already the newest version (1:85.0.4183.83-0ubuntu0.20.04.2).
The following package was automatically installed and is no longer required:
libnvidia-common-510
Use 'apt autoremove' to remove it.
0 upgraded, 0 newly installed, 0 to remove and 21 not upgraded.
Then I tried this code:
from selenium import webdriver
options = webdriver.ChromeOptions()
options.add_argument('--no-sandbox')
options.add_argument('--headless')
options.add_argument('--disable-gpu')
options.add_argument('--disable-dev-shm-usage')
driver = webdriver.Chrome(executable_path = '/usr/lib/chromium-browser/chromedriver', options=options)
driver.get("https://www.google.com")
It gave me this error:
<ipython-input-19-aff70976e36a>:8: DeprecationWarning: executable_path has been deprecated, please pass in a Service object
driver = webdriver.Chrome(executable_path = '/usr/lib/chromium-browser/chromedriver', options=options)
---------------------------------------------------------------------------
WebDriverException Traceback (most recent call last)
<ipython-input-19-aff70976e36a> in <module>
6 options.add_argument('--disable-gpu')
7 options.add_argument('--disable-dev-shm-usage')
----> 8 driver = webdriver.Chrome(executable_path = '/usr/lib/chromium-browser/chromedriver', options=options)
9 driver.get("https://www.google.com")
3 frames
/usr/local/lib/python3.8/dist-packages/selenium/webdriver/common/service.py in assert_process_still_running(self)
115 return_code = self.process.poll()
116 if return_code:
--> 117 raise WebDriverException(f"Service {self.path} unexpectedly exited. Status code was: {return_code}")
118
119 def is_connectable(self) -> bool:
WebDriverException: Message: Service /usr/lib/chromium-browser/chromedriver unexpectedly exited. Status code was: 1
So I tried to use the service object instead using this code:
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager
options = Options()
options.add_argument("--no-sandbox")
options.add_argument('--headless')
options.add_argument('--disable-gpu')
options.add_argument('--disable-dev-shm-usage')
driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=options)
driver.get("https://www.google.com")
This gave me this error:
---------------------------------------------------------------------------
WebDriverException Traceback (most recent call last)
<ipython-input-20-5092e72d4ef5> in <module>
9 options.add_argument('--disable-gpu')
10 options.add_argument('--disable-dev-shm-usage')
---> 11 driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=options)
12 driver.get("https://www.google.com")
5 frames
/usr/local/lib/python3.8/dist-packages/selenium/webdriver/remote/errorhandler.py in check_response(self, response)
243 alert_text = value["alert"].get("text")
244 raise exception_class(message, screen, stacktrace, alert_text) # type: ignore[call-arg] # mypy is not smart enough here
--> 245 raise exception_class(message, screen, stacktrace)
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.)
Stacktrace:
#0 0x559a65f56d93 <unknown>
#1 0x559a65d252d7 <unknown>
#2 0x559a65d4dab0 <unknown>
#3 0x559a65d49a3d <unknown>
#4 0x559a65d8e4f4 <unknown>
#5 0x559a65d85353 <unknown>
#6 0x559a65d54e40 <unknown>
#7 0x559a65d56038 <unknown>
#8 0x559a65faa8be <unknown>
#9 0x559a65fae8f0 <unknown>
#10 0x559a65f8ef90 <unknown>
#11 0x559a65fafb7d <unknown>
#12 0x559a65f80578 <unknown>
#13 0x559a65fd4348 <unknown>
#14 0x559a65fd44d6 <unknown>
#15 0x559a65fee341 <unknown>
#16 0x7f8b42564609 start_thread
Any idea how to solve this?

Related

YouTube video viewer program

I am trying to use the Youtube viewer program on someone's YouTube videos. The source code of this program can be found on the GitHub page.
There is a problem in the import statements, though.
In the YouTube viewer -> youtubeviewer -> download_driver.py file, so this page, there is an import statement.
import undetected_chromedriver._compat as uc
At first when I tried to run this program, the following error pops up:
ModuleNotFoundError: No module named 'undetected_chromedriver'
I eventually installed it using the python3 -m pip install undetected_chromedriver command. Everything ran smoothly until the statement above. The command prompt popped up the following error message.
Traceback (most recent call last):
File "C:\Users\14725\YouTube-Viewer\youtube_viewer.py", line 42, in <module>
from youtubeviewer.download_driver import *
File "C:\Users\14725\YouTube-Viewer\youtubeviewer\download_driver.py", line 29, in <module>
import undetected_chromedriver._compat as uc
ModuleNotFoundError: No module named 'undetected_chromedriver._compat'
I checked again if I had installed the module by using the python3 -m pip install undetected_chromedriver command. The following messages popped up:
Requirement already satisfied: undetected_chromedriver in c:\users\14725\appdata\roaming\python\python39\site-packages (3.4)
Requirement already satisfied: requests in c:\users\14725\appdata\roaming\python\python39\site-packages (from undetected_chromedriver) (2.28.0)
Requirement already satisfied: selenium>=4.0.0 in c:\users\14725\appdata\roaming\python\python39\site-packages (from undetected_chromedriver) (4.8.0)
Requirement already satisfied: websockets in c:\users\14725\appdata\roaming\python\python39\site-packages (from undetected_chromedriver) (10.4)
Requirement already satisfied: certifi>=2021.10.8 in c:\users\14725\appdata\roaming\python\python39\site-packages (from selenium>=4.0.0->undetected_chromedriver) (2022.5.18.1)
Requirement already satisfied: trio~=0.17 in c:\users\14725\appdata\roaming\python\python39\site-packages (from selenium>=4.0.0->undetected_chromedriver) (0.22.0)
Requirement already satisfied: urllib3[socks]~=1.26 in c:\users\14725\appdata\roaming\python\python39\site-packages (from selenium>=4.0.0->undetected_chromedriver) (1.26.9)
Requirement already satisfied: trio-websocket~=0.9 in c:\users\14725\appdata\roaming\python\python39\site-packages (from selenium>=4.0.0->undetected_chromedriver) (0.9.2)
Requirement already satisfied: charset-normalizer~=2.0.0 in c:\users\14725\appdata\roaming\python\python39\site-packages (from requests->undetected_chromedriver) (2.0.12)
Requirement already satisfied: idna<4,>=2.5 in c:\users\14725\appdata\roaming\python\python39\site-packages (from requests->undetected_chromedriver) (3.3)
Requirement already satisfied: cffi>=1.14 in c:\users\14725\appdata\roaming\python\python39\site-packages (from trio~=0.17->selenium>=4.0.0->undetected_chromedriver) (1.15.0)
Requirement already satisfied: sniffio in c:\users\14725\appdata\roaming\python\python39\site-packages (from trio~=0.17->selenium>=4.0.0->undetected_chromedriver) (1.3.0)
Requirement already satisfied: sortedcontainers in c:\users\14725\appdata\roaming\python\python39\site-packages (from trio~=0.17->selenium>=4.0.0->undetected_chromedriver) (2.4.0)
Requirement already satisfied: async-generator>=1.9 in c:\users\14725\appdata\roaming\python\python39\site-packages (from trio~=0.17->selenium>=4.0.0->undetected_chromedriver) (1.10)
Requirement already satisfied: outcome in c:\users\14725\appdata\roaming\python\python39\site-packages (from trio~=0.17->selenium>=4.0.0->undetected_chromedriver) (1.2.0)
Requirement already satisfied: attrs>=19.2.0 in c:\users\14725\appdata\roaming\python\python39\site-packages (from trio~=0.17->selenium>=4.0.0->undetected_chromedriver) (21.4.0)
Requirement already satisfied: exceptiongroup>=1.0.0rc9 in c:\users\14725\appdata\roaming\python\python39\site-packages (from trio~=0.17->selenium>=4.0.0->undetected_chromedriver) (1.1.0)
Requirement already satisfied: wsproto>=0.14 in c:\users\14725\appdata\roaming\python\python39\site-packages (from trio-websocket~=0.9->selenium>=4.0.0->undetected_chromedriver) (1.2.0)
Requirement already satisfied: PySocks!=1.5.7,<2.0,>=1.5.6 in c:\users\14725\appdata\roaming\python\python39\site-packages (from urllib3[socks]~=1.26->selenium>=4.0.0->undetected_chromedriver) (1.7.1)
Requirement already satisfied: pycparser in c:\users\14725\appdata\roaming\python\python39\site-packages (from cffi>=1.14->trio~=0.17->selenium>=4.0.0->undetected_chromedriver) (2.21)
Requirement already satisfied: h11<1,>=0.9.0 in c:\users\14725\appdata\roaming\python\python39\site-packages (from wsproto>=0.14->trio-websocket~=0.9->selenium>=4.0.0->undetected_chromedriver) (0.14.0)
Which I think these have indicated that I have the module installed. What should I do to run this program? Have I missed something?
There was an important update of undetected_chromedriver recently. I recommend you to install the latest known stable version with:
pip install undetected-chromedriver==3.2.1

'No module named 'webdriver_manager'' after reinstalling, checking library correctness

When I want to
from webdriver_manager.chrome import ChromeDriverManager
I get ModuleNotFoundError. I have uninstalled and installed again using pip3, and chekced the previous related questions here about the same matter, but still can't figure it out. Below are the installation details.
C:\Users\eywy0>pip3 install webdriver_manager
Requirement already satisfied: webdriver_manager in c:\users\eywy0\anaconda3\lib\site-packages (3.7.1)
Requirement already satisfied: requests in c:\users\eywy0\anaconda3\lib\site-packages (from webdriver_manager) (2.27.1)
Requirement already satisfied: python-dotenv in c:\users\eywy0\anaconda3\lib\site-packages (from webdriver_manager) (0.20.0)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in c:\users\eywy0\anaconda3\lib\site-packages (from requests->webdriver_manager) (1.26.9)
Requirement already satisfied: charset-normalizer~=2.0.0 in c:\users\eywy0\anaconda3\lib\site-packages (from requests->webdriver_manager) (2.0.4)
Requirement already satisfied: idna<4,>=2.5 in c:\users\eywy0\anaconda3\lib\site-packages (from requests->webdriver_manager) (3.3)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\eywy0\anaconda3\lib\site-packages (from requests->webdriver_manager) (2021.10.8)
Any clue on what might have gone wrong? Thanks for any help!!

How to import and use PyWhatKit on Google Colaboratory?

I wanted to automate sending messages on WhatsApp from Google Colab using the pywhatkit library. So far I have tried doing:
pip install pywhatkit
Output:
Requirement already satisfied: pywhatkit in /usr/local/lib/python3.7/dist-packages (5.3)
Requirement already satisfied: wikipedia in /usr/local/lib/python3.7/dist-packages (from pywhatkit) (1.4.0)
Requirement already satisfied: pyautogui in /usr/local/lib/python3.7/dist-packages (from pywhatkit) (0.9.53)
Requirement already satisfied: requests in /usr/local/lib/python3.7/dist-packages (from pywhatkit) (2.23.0)
Requirement already satisfied: Pillow in /usr/local/lib/python3.7/dist-packages (from pywhatkit) (7.1.2)
Requirement already satisfied: mouseinfo in /usr/local/lib/python3.7/dist-packages (from pyautogui->pywhatkit) (0.1.3)
Requirement already satisfied: pyscreeze>=0.1.21 in /usr/local/lib/python3.7/dist-packages (from pyautogui->pywhatkit) (0.1.28)
Requirement already satisfied: pygetwindow>=0.0.5 in /usr/local/lib/python3.7/dist-packages (from pyautogui->pywhatkit) (0.0.9)
Requirement already satisfied: PyTweening>=1.0.1 in /usr/local/lib/python3.7/dist-packages (from pyautogui->pywhatkit) (1.0.4)
Requirement already satisfied: python3-Xlib in /usr/local/lib/python3.7/dist-packages (from pyautogui->pywhatkit) (0.15)
Requirement already satisfied: pymsgbox in /usr/local/lib/python3.7/dist-packages (from pyautogui->pywhatkit) (1.0.9)
Requirement already satisfied: pyrect in /usr/local/lib/python3.7/dist-packages (from pygetwindow>=0.0.5->pyautogui->pywhatkit) (0.2.0)
Requirement already satisfied: pyperclip in /usr/local/lib/python3.7/dist-packages (from mouseinfo->pyautogui->pywhatkit) (1.8.2)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.7/dist-packages (from requests->pywhatkit) (2021.10.8)
Requirement already satisfied: chardet<4,>=3.0.2 in /usr/local/lib/python3.7/dist-packages (from requests->pywhatkit) (3.0.4)
Requirement already satisfied: idna<3,>=2.5 in /usr/local/lib/python3.7/dist-packages (from requests->pywhatkit) (2.10)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /usr/local/lib/python3.7/dist-packages (from requests->pywhatkit) (1.24.3)
Requirement already satisfied: beautifulsoup4 in /usr/local/lib/python3.7/dist-packages (from wikipedia->pywhatkit) (4.6.3)
I have also tried to see if pip list has it installed and it says it has:
pip list
Output:
....
....
pywhatkit 5.3
....
....
When I try to import it shows error.
import pywhatkit
Output:
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
<ipython-input-16-54f6f476dc6e> in <module>()
----> 1 import pywhatkit
4 frames
/usr/lib/python3.7/os.py in __getitem__(self, key)
679 except KeyError:
680 # raise KeyError with the original key value
--> 681 raise KeyError(key) from None
682 return self.decodevalue(value)
683
KeyError: 'DISPLAY'
What is the workaround or solution to this problem?

FormGroup was deprecated in dash-bootstrap-components version 1.0.0

I'm trying to copy the exact code here.
When I run:
from jaal import Jaal
from jaal.datasets import load_got
# load the data
edge_df, node_df = load_got()
# init Jaal and run server
Jaal(edge_df, node_df).plot()
The error I get is:
FormGroup was deprecated in dash-bootstrap-components version 1.0.0. You are using 1.0.0. For more details please see the migration guide: https://dbc-v1.herokuapp.com/migration-guide/
From the migration guide here, I followed 'pip install "dash-bootstrap-components<1"'
as suggested, and it installed like this:
Collecting dash-bootstrap-components<1
Downloading dash_bootstrap_components-0.13.1-py3-none-any.whl (197 kB)
|████████████████████████████████| 197 kB 2.0 MB/s eta 0:00:01
Requirement already satisfied: dash>=1.9.0 in ./anaconda/lib/python3.7/site-packages (from dash-bootstrap-components<1) (2.0.0)
Requirement already satisfied: flask-compress in ./anaconda/lib/python3.7/site-packages (from dash>=1.9.0->dash-bootstrap-components<1) (1.4.0)
Requirement already satisfied: Flask>=1.0.4 in ./anaconda/lib/python3.7/site-packages (from dash>=1.9.0->dash-bootstrap-components<1) (1.1.1)
Requirement already satisfied: dash-core-components==2.0.0 in ./anaconda/lib/python3.7/site-packages (from dash>=1.9.0->dash-bootstrap-components<1) (2.0.0)
Requirement already satisfied: dash-table==5.0.0 in ./anaconda/lib/python3.7/site-packages (from dash>=1.9.0->dash-bootstrap-components<1) (5.0.0)
Requirement already satisfied: dash-html-components==2.0.0 in ./anaconda/lib/python3.7/site-packages (from dash>=1.9.0->dash-bootstrap-components<1) (2.0.0)
Requirement already satisfied: plotly>=5.0.0 in ./anaconda/lib/python3.7/site-packages (from dash>=1.9.0->dash-bootstrap-components<1) (5.3.1)
Requirement already satisfied: Werkzeug>=0.15 in ./anaconda/lib/python3.7/site-packages (from Flask>=1.0.4->dash>=1.9.0->dash-bootstrap-components<1) (0.15.4)
Requirement already satisfied: Jinja2>=2.10.1 in ./anaconda/lib/python3.7/site-packages (from Flask>=1.0.4->dash>=1.9.0->dash-bootstrap-components<1) (2.10.1)
Requirement already satisfied: click>=5.1 in ./anaconda/lib/python3.7/site-packages (from Flask>=1.0.4->dash>=1.9.0->dash-bootstrap-components<1) (7.0)
Requirement already satisfied: itsdangerous>=0.24 in ./anaconda/lib/python3.7/site-packages (from Flask>=1.0.4->dash>=1.9.0->dash-bootstrap-components<1) (1.1.0)
Requirement already satisfied: MarkupSafe>=0.23 in ./anaconda/lib/python3.7/site-packages (from Jinja2>=2.10.1->Flask>=1.0.4->dash>=1.9.0->dash-bootstrap-components<1) (1.1.1)
Requirement already satisfied: tenacity>=6.2.0 in ./anaconda/lib/python3.7/site-packages (from plotly>=5.0.0->dash>=1.9.0->dash-bootstrap-components<1) (8.0.1)
Requirement already satisfied: six in ./anaconda/lib/python3.7/site-packages (from plotly>=5.0.0->dash>=1.9.0->dash-bootstrap-components<1) (1.15.0)
Installing collected packages: dash-bootstrap-components
Attempting uninstall: dash-bootstrap-components
Found existing installation: dash-bootstrap-components 1.0.0
Uninstalling dash-bootstrap-components-1.0.0:
Successfully uninstalled dash-bootstrap-components-1.0.0
Successfully installed dash-bootstrap-components-0.13.
But then when I rerun the code segment above to build a network, the output is still the same error. I'm using python 3.7.3, knowing that is says that I must use 3.6+. Can anyone explain how to fix this?
I tried on conda enviroment:
conda install -c conda-forge "dash-bootstrap-components<1"
and then it's working.

Can't either install or uninstall package via Anaconda

I've been trying to install the openquake.engine package via Anaconda. At first I got multiple errors one after another but [I thought] I fixed everything (pls see the P.S. for errors and solutions to them). Now, after going through all that, I get the following error:
openquake-engine 3.3.2 has requirement numpy<1.15,>=1.14, but you'll have numpy 1.16.2 which is incompatible.
osmnx 0.9 has requirement networkx>=2.2, but you'll have networkx 2.1 which is incompatible.
osmnx 0.9 has requirement requests>=2.21, but you'll have requests 2.20.1 which is incompatible.
First, it does not make sense as in PyPi the last released date of the package is Jan 22, 2019! Then here is the main issue: when I use conda list, openquake.engine is not listed!!
But when I runpip install openquake.engine, I get the following:
Requirement already satisfied: openquake.engine in c:\users\ameri19\appdata\roaming\python\python36\site-packages (3.3.2)
Requirement already satisfied: numpy<1.15,>=1.14 in c:\programdata\anaconda3\lib\site-packages (from openquake.engine) (1.14.6)
Requirement already satisfied: nose<1.4,>=1.3 in c:\programdata\anaconda3\lib\site-packages (from openquake.engine) (1.3.7)
Requirement already satisfied: requests<2.21,>=2.20 in c:\users\ameri19\appdata\roaming\python\python36\site-packages (from openquake.engine) (2.20.1)
Requirement already satisfied: scipy<1.2,>=1.0.1 in c:\users\ameri19\appdata\roaming\python\python36\site-packages (from openquake.engine) (1.1.0)
Requirement already satisfied: docutils<0.15,>=0.11 in c:\programdata\anaconda3\lib\site-packages (from openquake.engine) (0.14)
Requirement already satisfied: mock<2.1,>=1.0 in c:\users\ameri19\appdata\roaming\python\python36\site-packages (from openquake.engine) (2.0.0)
Requirement already satisfied: rtree==0.8.3 in c:\users\ameri19\appdata\roaming\python\python36\site-packages (from openquake.engine) (0.8.3)
Requirement already satisfied: decorator>=4.3 in c:\users\ameri19\appdata\roaming\python\python36\site-packages (from openquake.engine) (4.3.2)
Requirement already satisfied: shapely<1.7,>=1.3 in c:\programdata\anaconda3\lib\site-packages (from openquake.engine) (1.6.4.post2)
Requirement already satisfied: matplotlib<2.3,>=1.5 in c:\users\ameri19\appdata\roaming\python\python36\site-packages (from openquake.engine) (2.2.4)
Requirement already satisfied: pyshp==1.2.3 in c:\users\ameri19\appdata\roaming\python\python36\site-packages (from openquake.engine) (1.2.3)
Requirement already satisfied: setuptools in c:\programdata\anaconda3\lib\site-packages (from openquake.engine) (40.8.0)
Requirement already satisfied: h5py<2.9,>=2.8 in c:\users\ameri19\appdata\roaming\python\python36\site-packages (from openquake.engine) (2.8.0)
Requirement already satisfied: pyzmq<18.0 in c:\programdata\anaconda3\lib\site-packages (from openquake.engine) (17.1.3)
Requirement already satisfied: django<2.1,>=1.10 in c:\programdata\anaconda3\lib\site-packages (from openquake.engine) (2.0.13)
Requirement already satisfied: psutil<5.5,>=2.0 in c:\programdata\anaconda3\lib\site-packages (from openquake.engine) (5.4.3)
Requirement already satisfied: PyYAML in c:\programdata\anaconda3\lib\site-packages (from openquake.engine) (3.12)
Requirement already satisfied: urllib3<1.25,>=1.21.1 in c:\programdata\anaconda3\lib\site-packages (from requests<2.21,>=2.20->openquake.engine) (1.22)
Requirement already satisfied: certifi>=2017.4.17 in c:\programdata\anaconda3\lib\site-packages (from requests<2.21,>=2.20->openquake.engine) (2018.11.29)
Requirement already satisfied: idna<2.8,>=2.5 in c:\programdata\anaconda3\lib\site-packages (from requests<2.21,>=2.20->openquake.engine) (2.6)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in c:\programdata\anaconda3\lib\site-packages (from requests<2.21,>=2.20->openquake.engine) (3.0.4)
Requirement already satisfied: pbr>=0.11 in c:\users\ameri19\appdata\roaming\python\python36\site-packages (from mock<2.1,>=1.0->openquake.engine) (5.1.3)
Requirement already satisfied: six>=1.9 in c:\programdata\anaconda3\lib\site-packages (from mock<2.1,>=1.0->openquake.engine) (1.11.0)
Requirement already satisfied: python-dateutil>=2.1 in c:\programdata\anaconda3\lib\site-packages (from matplotlib<2.3,>=1.5->openquake.engine) (2.6.1)
Requirement already satisfied: pytz in c:\programdata\anaconda3\lib\site-packages (from matplotlib<2.3,>=1.5->openquake.engine) (2017.3)
Requirement already satisfied: kiwisolver>=1.0.1 in c:\programdata\anaconda3\lib\site-packages (from matplotlib<2.3,>=1.5->openquake.engine) (1.0.1)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in c:\programdata\anaconda3\lib\site-packages (from matplotlib<2.3,>=1.5->openquake.engine) (2.2.0)
Requirement already satisfied: cycler>=0.10 in c:\programdata\anaconda3\lib\site-packages (from matplotlib<2.3,>=1.5->openquake.engine) (0.10.0)
Then, when I use pip uninstall openquake.engine, I get the following error:
Exception:
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site-packages\pip\_internal\cli\base_command.py", line 179, in main
status = self.run(options, args)
File "C:\ProgramData\Anaconda3\lib\site-packages\pip\_internal\commands\uninstall.py", line 75, in run
auto_confirm=options.yes, verbose=self.verbosity > 0,
File "C:\ProgramData\Anaconda3\lib\site-packages\pip\_internal\req\req_install.py", line 816, in uninstall
uninstalled_pathset = UninstallPathSet.from_dist(dist)
File "C:\ProgramData\Anaconda3\lib\site-packages\pip\_internal\req\req_uninstall.py", line 496, in from_dist
for path in uninstallation_paths(dist):
File "C:\ProgramData\Anaconda3\lib\site-packages\pip\_internal\req\req_uninstall.py", line 50, in unique
for item in fn(*args, **kw):
File "C:\ProgramData\Anaconda3\lib\site-packages\pip\_internal\req\req_uninstall.py", line 67, in uninstallation_paths
r = csv.reader(FakeFile(dist.get_metadata_lines('RECORD')))
File "C:\ProgramData\Anaconda3\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 1414, in get_metadata_lines
return yield_lines(self.get_metadata(name))
File "C:\ProgramData\Anaconda3\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 1411, in get_metadata
return value.decode('utf-8') if six.PY3 else value
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe8 in position 152595: invalid continuation byte
Also, after I run pip install openquake.engine, it seems it automatically uninstalls the latest version of numpy and installs a former version that is compatible to openquake.engine, but then when I run something like from openquake.hazardlib import const I get the following error:
could not find or load spatialindex_c.dll
which is error #3 in the P.S. section below! And after I run conda install -c conda-forge osmnx to solve the issue, I start getting this error:
Something is wrong with the numpy installation. While importing we detected an older version of numpy in ['C:\\ProgramData\\Anaconda3\\lib\\site-packages\\numpy']. One method of fixing this is to repeatedly uninstall numpy until none is found, then reinstall this version.
So it seems like a deadlock! Dose anyone know how I could fix this?
P.S. Errors and Solutions:
error #1: (occurred while using 'pip install openquake.engine' in Anaconda)
Command "python setup.py egg_info" failed with error code 1 in C:\temp\pip-install-mco6__1j\shapely\
Solution to error #1:
conda install -c conda-forge shapely
error #2: (occurred while using 'pip install openquake.engine' in Anaconda, EVEN THOUGH I was running the prompt as administrator!!)
PermissionError: [WinError 5] Access is denied
Solution to error #2:
pip install openquake.engine --user
Here, I got multiple warnings, but they did not seem to be that important! I tried import epenquake.engine in the Spyder and as it worked like a charm I thought it is all good (but it was not; see error #3)!
error #3: (occured while running from openquake.hazardlib import const)
could not find or load spatialindex_c.dll
Solution to error #3:
conda install -c conda-forge osmnx

Categories