Remove requests as dependency (#26083)

Summary:
local build is slow... test in CI...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/26083

Differential Revision: D17346949

Pulled By: ailzhang

fbshipit-source-id: f552d1a4be55ad4e2bd915af7c5a2c1b6667c446
This commit is contained in:
Ailing Zhang 2019-09-13 08:37:52 -07:00 committed by Facebook Github Bot
parent 07e7c7eb9f
commit 079cd4e1fc
5 changed files with 10 additions and 30 deletions

View file

@ -104,10 +104,6 @@ if [[ "$BUILD_ENVIRONMENT" == *py3* ]]; then
export LANG=C.UTF-8
fi
if [[ "$BUILD_ENVIRONMENT" == *py2* ]]; then
pip install --user requests
fi
pip install --user pytest-sugar
"$PYTHON" \
-m pytest \

View file

@ -56,8 +56,6 @@ if [[ "$BUILD_ENVIRONMENT" != *ppc64le* ]]; then
pip_install --user mypy || true
fi
pip_install --user requests
# faulthandler become built-in since 3.3
if [[ ! $(python -c "import sys; print(int(sys.version_info >= (3, 3)))") == "1" ]]; then
pip_install --user faulthandler

View file

@ -169,7 +169,7 @@ If you are building for NVIDIA's Jetson platforms (Jetson Nano, TX1, TX2, AGX Xa
Common
```
conda install numpy ninja pyyaml mkl mkl-include setuptools cmake cffi typing requests
conda install numpy ninja pyyaml mkl mkl-include setuptools cmake cffi typing
```
On Linux

View file

@ -352,9 +352,6 @@ install_requires = []
if sys.version_info <= (2, 7):
install_requires += ['future']
if sys.version_info[0] == 2:
install_requires += ['requests']
missing_pydep = '''
Missing build dependency: Unable to `import {importname}`.
Please install it via `conda install {module}` or `pip install {module}`

View file

@ -12,7 +12,7 @@ import zipfile
if sys.version_info[0] == 2:
from urlparse import urlparse
import requests
from urllib2 import urlopen # noqa f811
else:
from urllib.request import urlopen
from urllib.parse import urlparse # noqa: F401
@ -95,10 +95,7 @@ def _download_archive_zip(url, filename):
sys.stderr.write('Downloading: \"{}\" to {}\n'.format(url, filename))
# We use a different API for python2 since urllib(2) doesn't recognize the CA
# certificates in older Python
if sys.version_info[0] == 2:
response = requests.get(url, stream=True).raw
else:
response = urlopen(url)
response = urlopen(url)
with open(filename, 'wb') as f:
while True:
data = response.read(READ_DATA_CHUNK)
@ -376,22 +373,14 @@ def _download_url_to_file(url, dst, hash_prefix, progress):
file_size = None
# We use a different API for python2 since urllib(2) doesn't recognize the CA
# certificates in older Python
if sys.version_info[0] == 2:
response = requests.get(url, stream=True)
content_length = response.headers['Content-Length']
file_size = int(content_length)
u = response.raw
u = urlopen(url)
meta = u.info()
if hasattr(meta, 'getheaders'):
content_length = meta.getheaders("Content-Length")
else:
u = urlopen(url)
meta = u.info()
if hasattr(meta, 'getheaders'):
content_length = meta.getheaders("Content-Length")
else:
content_length = meta.get_all("Content-Length")
if content_length is not None and len(content_length) > 0:
file_size = int(content_length[0])
content_length = meta.get_all("Content-Length")
if content_length is not None and len(content_length) > 0:
file_size = int(content_length[0])
# We deliberately save it in a temp file and move it after
# download is complete. This prevents a local working checkpoint