I'm unable to install Selenium Python module. I've tried sudo pip3 install -U selenium .

I actually tried to install it in a virtualenv. I got an error.

A long way back I've installed pip3 and virtualenv

sudo apt-get install python3-pip
sudo pip3 install virtualenv

This is the traceback

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/usr/lib/python3/dist-packages/pip/commands/install.py", line 278, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "/usr/lib/python3/dist-packages/pip/req.py", line 1197, in prepare_files
  File "/usr/lib/python3/dist-packages/pip/req.py", line 1375, in unpack_url
  File "/usr/lib/python3/dist-packages/pip/download.py", line 572, in unpack_http_url
    download_hash = _download_url(resp, link, temp_location)
  File "/usr/lib/python3/dist-packages/pip/download.py", line 433, in _download_url
    for chunk in resp_read(4096):
  File "/usr/lib/python3/dist-packages/pip/download.py", line 421, in resp_read
    chunk_size, decode_content=False):
  File "/usr/lib/python3/dist-packages/urllib3/response.py", line 225, in stream
    data = self.read(amt=amt, decode_content=decode_content)
  File "/usr/lib/python3/dist-packages/urllib3/response.py", line 174, in read
    data = self._fp.read(amt)
  File "/usr/lib/python3.4/http/client.py", line 500, in read
    return super(HTTPResponse, self).read(amt)
  File "/usr/lib/python3.4/http/client.py", line 539, in readinto
    n = self.fp.readinto(b)
  File "/usr/lib/python3.4/socket.py", line 371, in readinto
    return self._sock.recv_into(b)
  File "/usr/lib/python3.4/ssl.py", line 746, in recv_into
    return self.read(nbytes, buffer)
  File "/usr/lib/python3.4/ssl.py", line 618, in read
    v = self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out

You are trying to install a Python 3 module in Python virtual environment (python-virtualenv) which is specific to Python 2.x. In order to use pip3 to install Python 3 modules in Ubuntu 14.04, you must create a Python virtual environment for Python 3.x by following the instructions in this answer. Then you can install the Selenium module in the new Pyvenv virtual environment using pip3. The supported Python 3.x versions for the latest version of the Selenium module are Python 3.2 and Python 3.3, so you cannot use pip3.4 to install this module, only pip3.

  • I've installed pip for python3 I've followed this guide digitalocean.com/community/tutorials/… – Ajay Apr 9 '15 at 17:17
  • That's the default pip3 package in Ubuntu 14.04, but you also need to create a Python virtual environment that is fully compatible with Python 3, and then you can use pip3 inside that Python virtual environment to install Selenium. – karel Apr 9 '15 at 17:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.