1

I have python 3.5.2 installed. I also have pip 9.0.1 installed. The version number shows up when I type in the command python or pip --version. But when I try to install django using the command pip install Django, after a certain percentage, it stops downloading and the following error comes up on the command prompt. I have tried to set up the path but still the error shows up.

Exception:
Traceback (most recent call last):
File "c:\users\dell\appdata\local\programs\python\python35-32\lib\site-packages\pip\_vendor\requests\packages\urllib3\response.py", line 232, in_error_catcher
yield
File "c:\users\dell\appdata\local\programs\python\python35-32\lib\site-packages\pip\_vendor\requests\packages\urllib3\response.py", line 314, in read
data = self._fp.read(amt)
File "c:\users\dell\appdata\local\programs\python\python35-32\lib\site-packages\pip\_vendor\cachecontrol\filewrapper.py", line 60, in read
data = self.__fp.read(amt)
File "c:\users\dell\appdata\local\programs\python\python35-32\lib\http\client.py", line 448, in read
n = self.readinto(b)
File "c:\users\dell\appdata\local\programs\python\python35-32\lib\http\client.py", line 488, in readinto
n = self.fp.readinto(b)
File "c:\users\dell\appdata\local\programs\python\python35-32\lib\socket.py",line 575, in readinto
return self._sock.recv_into(b)
File "c:\users\dell\appdata\local\programs\python\python35-32\lib\ssl.py", line 929, in recv_into
return self.read(nbytes, buffer)
File "c:\users\dell\appdata\local\programs\python\python35-32\lib\ssl.py", line 791, in read
return self._sslobj.read(len, buffer)
File "c:\users\dell\appdata\local\programs\python\python35-32\lib\ssl.py", line 575, in read
v = self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "c:\users\dell\appdata\local\programs\python\python35-32\lib\site-packages\pip\basecommand.py", line 215, in main
status = self.run(options, args)
File "c:\users\dell\appdata\local\programs\python\python35-32\lib\site-packages\pip\commands\install.py", line 324, in run
requirement_set.prepare_files(finder)
File "c:\users\dell\appdata\local\programs\python\python35-32\lib\site-packages\pip\req\req_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "c:\users\dell\appdata\local\programs\python\python35-32\lib\site-packages\pip\req\req_set.py", line 620, in _prepare_file
session=self.session, hashes=hashes)
File "c:\users\dell\appdata\local\programs\python\python35-32\lib\site-packages\pip\download.py", line 821, in unpack_url
hashes=hashes
File "c:\users\dell\appdata\local\programs\python\python35-32\lib\site-packages\pip\download.py", line 659, in unpack_http_url
hashes)
File "c:\users\dell\appdata\local\programs\python\python35-32\lib\site-packages\pip\download.py", line 882, in _download_http_url
_download_url(resp, link, content_file, hashes)
File "c:\users\dell\appdata\local\programs\python\python35-32\lib\site-packages\pip\download.py", line 603, in _download_url
hashes.check_against_chunks(downloaded_chunks)
File "c:\users\dell\appdata\local\programs\python\python35-32\lib\site-packages\pip\utils\hashes.py", line 46, in check_against_chunks
for chunk in chunks:
File "c:\users\dell\appdata\local\programs\python\python35-32\lib\site-packages\pip\download.py", line 571, in written_chunks
for chunk in chunks:
File "c:\users\dell\appdata\local\programs\python\python35-32\lib\site-packages\pip\utils\ui.py", line 139, in iter
for x in it:
File "c:\users\dell\appdata\local\programs\python\python35-32\lib\site-packages\pip\download.py", line 560, in resp_read
decode_content=False):
File "c:\users\dell\appdata\local\programs\python\python35-32\lib\site-packages\pip\_vendor\requests\packages\urllib3\response.py", line 357, in stream
data = self.read(amt=amt, decode_content=decode_content)
File "c:\users\dell\appdata\local\programs\python\python35-32\lib\site-packages\pip\_vendor\requests\packages\urllib3\response.py", line 324, in read
flush_decoder = True
File "c:\users\dell\appdata\local\programs\python\python35-32\lib\contextlib.py", line 77, in __exit__
self.gen.throw(type, value, traceback)
File "c:\users\dell\appdata\local\programs\python\python35-32\lib\site-packages\pip\_vendor\requests\packages\urllib3\response.py", line 237, in_error_catcher
raise ReadTimeoutError(self._pool, None, 'Read timed out.')
pip._vendor.requests.packages.urllib3.exceptions.ReadTimeoutError:HTTPSConnectionPool(host='pypi.python.org', port=443): Read timed out.
Cache Staheli
  • 3,510
  • 7
  • 32
  • 51
J1tu
  • 11
  • 1
  • 3

2 Answers2

2

What the traceback tells you is that the maximum time allocated to one read operation was spent and, thus, the operation was aborted. This may be due to a low connection speed, in which case a quick fix may be to increase the timeout time for installing a package. Try this:

pip --default-timeout=500 install django

where 500 is the amount of time in seconds. Feel free to increase / decrease it as you wish. Hope it helps.

Chris
  • 1,173
  • 11
  • 19
0

You should use a virtualenv

to create a virtual environment. Then installing django: pip install django, not Django

!SOF: How to leave/exit/deactivate a python virtualenv? Link

mrK
  • 1
  • 1