Cannot install TensorFlow - python

I am trying to install tensorflow on a remote machine. I am only one of many users. The command I used (and was told to use) is:
pip install tensorflow --user
However, I got an error: "ResponseError('too many 503 error responses',)".
When I googled this error, it said it was more for HTTP requests overwhelming a server. That's not what I'm doing here, so why am I seeing this error, and how can I fix it?
[user#remote ~]$ pip install tensorflow --user
Collecting tensorflow
Exception:
Traceback (most recent call last):
File "/path/python/3.6.3/core-intel1506/lib/python3.6/site-packages/pip/_vendor/requests/adapters.py", line 440, in send
timeout=timeout
File "/path/python/3.6.3/core-intel1506/lib/python3.6/site-packages/pip/_vendor/urllib3/connectionpool.py", line 732, in urlopen
body_pos=body_pos, **response_kw)
File "/path/python/3.6.3/core-intel1506/lib/python3.6/site-packages/pip/_vendor/urllib3/connectionpool.py", line 732, in urlopen
body_pos=body_pos, **response_kw)
File "/path/python/3.6.3/core-intel1506/lib/python3.6/site-packages/pip/_vendor/urllib3/connectionpool.py", line 732, in urlopen
body_pos=body_pos, **response_kw)
[Previous line repeated 1 more times]
File "/path/python/3.6.3/core-intel1506/lib/python3.6/site-packages/pip/_vendor/urllib3/connectionpool.py", line 712, in urlopen
retries = retries.increment(method, url, response=response, _pool=self)
File "/path/python/3.6.3/core-intel1506/lib/python3.6/site-packages/pip/_vendor/urllib3/util/retry.py", line 388, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
pip._vendor.urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Max retries exceeded with url: /packages/38/4a/42ba8d00a50a9fafc88dd5935246ecc64ffe1f6a0258ef535ffb9652140b/tensorflow-1.7.0-cp36-cp36m-manylinux1_x86_64.whl (Caused by ResponseError('too many 503 error responses',))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/path/python/3.6.3/core-intel1506/lib/python3.6/site-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/path/python/3.6.3/core-intel1506/lib/python3.6/site-packages/pip/commands/install.py", line 324, in run
requirement_set.prepare_files(finder)
File "/path/python/3.6.3/core-intel1506/lib/python3.6/site-packages/pip/req/req_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "/path/python/3.6.3/core-intel1506/lib/python3.6/site-packages/pip/req/req_set.py", line 620, in _prepare_file
session=self.session, hashes=hashes)
File "/path/python/3.6.3/core-intel1506/lib/python3.6/site-packages/pip/download.py", line 821, in unpack_url
hashes=hashes
File "/path/python/3.6.3/core-intel1506/lib/python3.6/site-packages/pip/download.py", line 659, in unpack_http_url
hashes)
File "/path/python/3.6.3/core-intel1506/lib/python3.6/site-packages/pip/download.py", line 853, in _download_http_url
stream=True,
File "/path/python/3.6.3/core-intel1506/lib/python3.6/site-packages/pip/_vendor/requests/sessions.py", line 521, in get
return self.request('GET', url, **kwargs)
File "/path/python/3.6.3/core-intel1506/lib/python3.6/site-packages/pip/download.py", line 386, in request
return super(PipSession, self).request(method, url, *args, **kwargs)
File "/path/python/3.6.3/core-intel1506/lib/python3.6/site-packages/pip/_vendor/requests/sessions.py", line 508, in request
resp = self.send(prep, **send_kwargs)
File "/path/python/3.6.3/core-intel1506/lib/python3.6/site-packages/pip/_vendor/requests/sessions.py", line 618, in send
r = adapter.send(request, **kwargs)
File "/path/python/3.6.3/core-intel1506/lib/python3.6/site-packages/pip/_vendor/cachecontrol/adapter.py", line 47, in send
resp = super(CacheControlAdapter, self).send(request, **kw)
File "/path/python/3.6.3/core-intel1506/lib/python3.6/site-packages/pip/_vendor/requests/adapters.py", line 499, in send
raise RetryError(e, request=request)
pip._vendor.requests.exceptions.RetryError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Max retries exceeded with url: /packages/38/4a/42ba8d00a50a9fafc88dd5935246ecc64ffe1f6a0258ef535ffb9652140b/tensorflow-1.7.0-cp36-cp36m-manylinux1_x86_64.whl (Caused by ResponseError('too many 503 error responses',))

Seems like there are issues with files.pythonhosted.org https://status.python.org/

I think there are the same problem with pip site. I can not install anything with .

Related

Got ssl.SSLEOFError when working behind a vpn

I m working behind a vpn and trying to use python requests, but I keep getting ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:1123). Once I turned down the vpn it worked as excepted. Is there any way to work around this issue?
Also one thing worth noting is that I tried to use postman while the vpn was on, and it worked fine.
Example
import requests
requests.get('https://www.google.com')
Traceback (most recent call last):
File "D:\Programming\Projects\Python\Scripts\venv\lib\site-packages\urllib3\connectionpool.py", line 700, in urlopen
self._prepare_proxy(conn)
File "D:\Programming\Projects\Python\Scripts\venv\lib\site-packages\urllib3\connectionpool.py", line 994, in _prepare_proxy
conn.connect()
File "D:\Programming\Projects\Python\Scripts\venv\lib\site-packages\urllib3\connection.py", line 364, in connect
conn = self._connect_tls_proxy(hostname, conn)
File "D:\Programming\Projects\Python\Scripts\venv\lib\site-packages\urllib3\connection.py", line 501, in _connect_tls_proxy
socket = ssl_wrap_socket(
File "D:\Programming\Projects\Python\Scripts\venv\lib\site-packages\urllib3\util\ssl_.py", line 453, in ssl_wrap_socket
ssl_sock = _ssl_wrap_socket_impl(sock, context, tls_in_tls)
File "D:\Programming\Projects\Python\Scripts\venv\lib\site-packages\urllib3\util\ssl_.py", line 495, in _ssl_wrap_socket_impl
return ssl_context.wrap_socket(sock)
File "D:\Programming\Python\Python39\lib\ssl.py", line 500, in wrap_socket
return self.sslsocket_class._create(
File "D:\Programming\Python\Python39\lib\ssl.py", line 1040, in _create
self.do_handshake()
File "D:\Programming\Python\Python39\lib\ssl.py", line 1309, in do_handshake
self._sslobj.do_handshake()
ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:1123)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\Programming\Projects\Python\Scripts\venv\lib\site-packages\requests\adapters.py", line 440, in send
resp = conn.urlopen(
File "D:\Programming\Projects\Python\Scripts\venv\lib\site-packages\urllib3\connectionpool.py", line 785, in urlopen
retries = retries.increment(
File "D:\Programming\Projects\Python\Scripts\venv\lib\site-packages\urllib3\util\retry.py", line 592, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='www.google.com', port=443): Max retries exceeded with url: / (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1123)')))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\Programming\Projects\Python\Scripts\crawling\util.py", line 197, in <module>
main()
File "D:\Programming\Projects\Python\Scripts\crawling\util.py", line 189, in main
requests.get('https://www.google.com')
File "D:\Programming\Projects\Python\Scripts\venv\lib\site-packages\requests\api.py", line 75, in get
return request('get', url, params=params, **kwargs)
File "D:\Programming\Projects\Python\Scripts\venv\lib\site-packages\requests\api.py", line 61, in request
return session.request(method=method, url=url, **kwargs)
File "D:\Programming\Projects\Python\Scripts\venv\lib\site-packages\requests\sessions.py", line 529, in request
resp = self.send(prep, **send_kwargs)
File "D:\Programming\Projects\Python\Scripts\venv\lib\site-packages\requests\sessions.py", line 645, in send
r = adapter.send(request, **kwargs)
File "D:\Programming\Projects\Python\Scripts\venv\lib\site-packages\requests\adapters.py", line 517, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='www.google.com', port=443): Max retries exceeded with url: / (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1123)')))
Thanks in advance.

Python3 selenoid can't ignore SSL certificate verification

I'm trying to control selenoid from another network computer.
Make drivers with this
self.drivers.append(webdriver.Remote(
command_executor='http://e2f5a65c53.ngrok.io/wd/hub', desired_capabilities=capabilities))
when I run this code getting this error
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/urllib3/connectionpool.py", line 699, in urlopen
httplib_response = self._make_request(
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/urllib3/connectionpool.py", line 382, in _make_request
self._validate_conn(conn)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/urllib3/connectionpool.py", line 1010, in _validate_conn
conn.connect()
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/urllib3/connection.py", line 464, in connect
_match_hostname(cert, self.assert_hostname or server_hostname)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/urllib3/connection.py", line 512, in _match_hostname
match_hostname(cert, asserted_hostname)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ssl.py", line 416, in match_hostname
raise CertificateError("hostname %r "
ssl.SSLCertVerificationError: ("hostname '3.22.30.40' doesn't match either of '*.ngrok.io', 'ngrok.io'",)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/ryo/Dropbox/Mac/Desktop/selenium_for_beWinning/autoTradeGUI.py", line 4, in <module>
trading = Trading()
File "/Users/ryo/Dropbox/Mac/Desktop/selenium_for_beWinning/main.py", line 32, in __init__
self.driver.append(webdriver.Remote(
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
self.start_session(capabilities, browser_profile)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 319, in execute
response = self.command_executor.execute(driver_command, params)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/selenium/webdriver/remote/remote_connection.py", line 374, in execute
return self._request(command_info[0], url, body=data)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/selenium/webdriver/remote/remote_connection.py", line 402, in _request
resp = http.request(method, url, body=body, headers=headers)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/urllib3/request.py", line 78, in request
return self.request_encode_body(
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/urllib3/request.py", line 170, in request_encode_body
return self.urlopen(method, url, **extra_kw)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/urllib3/poolmanager.py", line 417, in urlopen
return self.urlopen(method, redirect_location, **kw)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/urllib3/poolmanager.py", line 375, in urlopen
response = conn.urlopen(method, u.request_uri, **kw)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/urllib3/connectionpool.py", line 783, in urlopen
return self.urlopen(
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/urllib3/connectionpool.py", line 783, in urlopen
return self.urlopen(
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/urllib3/connectionpool.py", line 755, in urlopen
retries = retries.increment(
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/urllib3/util/retry.py", line 574, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='3.22.30.40', port=443): Max retries exceeded with url: /wd/hub/session (Caused by SSLError(SSLCertVerificationError("hostname '3.22.30.40' doesn't match either of '*.ngrok.io', 'ngrok.io'")))
Then I tried to ignore SSL certificate verification.
ssl._create_default_https_context = ssl._create_unverified_context
by this line of code
but still getting the same error
How can I solve this problem?
Try to add acceptInsecureCerts = true capability. This will not work when your web site has strict transport security (HSTS) enabled.

pyTelegramBotAPI connection problem or what?

this is my code:
import telebot
bot = telebot.TeleBot(Token)
#bot.message_handler(commands=["greet"])
def greeting(message):
bot.reply_to(message, "Hi")
bot.polling()
and this is the error I receive:
Traceback (most recent call last):
File "C:\Users\pc\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\connectionpool.py", line 696, in urlopen
self._prepare_proxy(conn)
File "C:\Users\pc\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\connectionpool.py", line 964, in _prepare_proxy
conn.connect()
File "C:\Users\pc\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\connection.py", line 359, in connect
conn = self._connect_tls_proxy(hostname, conn)
File "C:\Users\pc\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\connection.py", line 496, in _connect_tls_proxy
return ssl_wrap_socket(
File "C:\Users\pc\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\util\ssl_.py", line 432, in ssl_wrap_socket
ssl_sock = _ssl_wrap_socket_impl(sock, context, tls_in_tls)
File "C:\Users\pc\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\util\ssl_.py", line 474, in _ssl_wrap_socket_impl
return ssl_context.wrap_socket(sock)
File "C:\Users\pc\AppData\Local\Programs\Python\Python38-32\lib\ssl.py", line 500, in wrap_socket
return self.sslsocket_class._create(
File "C:\Users\pc\AppData\Local\Programs\Python\Python38-32\lib\ssl.py", line 1040, in _create
self.do_handshake()
File "C:\Users\pc\AppData\Local\Programs\Python\Python38-32\lib\ssl.py", line 1309, in do_handshake
self._sslobj.do_handshake()
ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1123)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\pc\AppData\Local\Programs\Python\Python38-32\lib\site-packages\requests\adapters.py", line 439, in send
resp = conn.urlopen(
File "C:\Users\pc\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\connectionpool.py", line 755, in urlopen
retries = retries.increment(
File "C:\Users\pc\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\util\retry.py", line 573, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='api.telegram.org', port=443): Max retries exceeded with url: /bot1494641875:AAEPX72rP7YFT0ZZzASh0cn9rAw6l8PUMk0/getUpdates?offset=1&timeout=20 (Caused by SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1123)')))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "E:/Programming/Python/Training/TelegramBot02/main.py", line 13, in <module>
bot.polling()
File "C:\Users\pc\AppData\Local\Programs\Python\Python38-32\lib\site-packages\telebot\__init__.py", line 455, in polling
self.__threaded_polling(none_stop, interval, timeout, long_polling_timeout)
File "C:\Users\pc\AppData\Local\Programs\Python\Python38-32\lib\site-packages\telebot\__init__.py", line 513, in __threaded_polling
raise e
File "C:\Users\pc\AppData\Local\Programs\Python\Python38-32\lib\site-packages\telebot\__init__.py", line 478, in __threaded_polling
polling_thread.raise_exceptions()
File "C:\Users\pc\AppData\Local\Programs\Python\Python38-32\lib\site-packages\telebot\util.py", line 88, in raise_exceptions
raise self.exception_info
File "C:\Users\pc\AppData\Local\Programs\Python\Python38-32\lib\site-packages\telebot\util.py", line 69, in run
task(*args, **kwargs)
File "C:\Users\pc\AppData\Local\Programs\Python\Python38-32\lib\site-packages\telebot\__init__.py", line 295, in __retrieve_updates
updates = self.get_updates(offset=(self.last_update_id + 1), timeout=timeout, long_polling_timeout = long_polling_timeout)
File "C:\Users\pc\AppData\Local\Programs\Python\Python38-32\lib\site-packages\telebot\__init__.py", line 265, in get_updates
json_updates = apihelper.get_updates(self.token, offset, limit, timeout, allowed_updates, long_polling_timeout)
File "C:\Users\pc\AppData\Local\Programs\Python\Python38-32\lib\site-packages\telebot\apihelper.py", line 248, in get_updates
return _make_request(token, method_url, params=payload)
File "C:\Users\pc\AppData\Local\Programs\Python\Python38-32\lib\site-packages\telebot\apihelper.py", line 107, in _make_request
result = _get_req_session().request(
File "C:\Users\pc\AppData\Local\Programs\Python\Python38-32\lib\site-packages\requests\sessions.py", line 542, in request
resp = self.send(prep, **send_kwargs)
File "C:\Users\pc\AppData\Local\Programs\Python\Python38-32\lib\site-packages\requests\sessions.py", line 655, in send
r = adapter.send(request, **kwargs)
File "C:\Users\pc\AppData\Local\Programs\Python\Python38-32\lib\site-packages\requests\adapters.py", line 514, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='api.telegram.org', port=443): Max retries exceeded with url: /bot1494641875:AAEPX72rP7YFT0ZZzASh0cn9rAw6l8PUMk0/getUpdates?offset=1&timeout=20 (Caused by SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1123)')))
Connection is OK. Token is OK. It works manually when I browse https://api.telegram.org/botToken/getme and it works fine.
Other site for example google.com are OK too and works fine.
I would be glad to know what is the problem.
Actually because error I receive is too much a lot, stackoverflow does not allow me to post the question and wants me to add some more details, so I wrote this paragraph which is not related to the question and is just some words.
Do you have connected your telegram with a proxy? I can't solve your problem but you can follow this post: Problem connecting telegram bot through Python

python ssl error from gs cloud client MaxRetryError or WRONG_VERSION_NUMBER

I have a code that runs 24/7 (while true on the main.py file) with multiprocessing (12 workers) that accesses gcloud on a regular basis (listing buckets, downloading etc.)
I dont think its a regular ssl error because I get ssl error only one time throughout a day long run and every subprocess access their own gs client.
I dont really understand why the error happens or how to fix it since the same traceback gives me two types of errors.
Also worked everything until i increased the amount of my workers.
The way i create my client:
def get_gs_bucket():
storage_client = storage.Client.from_service_account_json(JSON_CREDENTIALS_PATH)
gs_bucket_name = BUCKET_NAME
return storage_client.get_bucket(gs_bucket_name)
the function that's mentioned in the error:
def list_gs_dir(prefix=''):
sleep_random_prevent_gs_over_api_usage()
return gs_bucket.list_blobs(delimiter='/', prefix=prefix)._get_next_page_response()['prefixes']
my error:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 601, in urlopen
chunked=chunked)
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 387, in _make_request
six.raise_from(e, None)
File "<string>", line 3, in raise_from
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 383, in _make_request
httplib_response = conn.getresponse()
File "/usr/lib/python3.6/http/client.py", line 1373, in getresponse
response.begin()
File "/usr/lib/python3.6/http/client.py", line 311, in begin
version, status, reason = self._read_status()
File "/usr/lib/python3.6/http/client.py", line 272, in _read_status
line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
File "/usr/lib/python3.6/socket.py", line 586, in readinto
return self._sock.recv_into(b)
File "/usr/lib/python3.6/ssl.py", line 1012, in recv_into
return self.read(nbytes, buffer)
File "/usr/lib/python3.6/ssl.py", line 874, in read
return self._sslobj.read(len, buffer)
File "/usr/lib/python3.6/ssl.py", line 631, in read
v = self._sslobj.read(len, buffer)
ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:2309)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/requests/adapters.py", line 440, in send
timeout=timeout
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 639, in urlopen
_stacktrace=sys.exc_info()[2])
File "/usr/lib/python3/dist-packages/urllib3/util/retry.py", line 398, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='www.googleapis.com', port=443): Max retries exceeded with url: <url> (Caused by SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:2309)'),))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/etl/work_wish/etl/etl/utils.py", line 97, in inner
return func(*args, **kwargs)
File "/opt/etl/work_wish/etl/etl/input_bucket.py", line 119, in get_recent_sstables_group_file_per_node
sstables_ts_pairs = get_sstables_ts_pairs(node, table_type, last_ts)
File "/opt/etl/work_wish/etl/etl/input_bucket.py", line 129, in get_sstables_ts_pairs
gs_path_prefixes = list_gs_dir(prefix=node)
File "/opt/etl/work_wish/etl/etl/input_bucket.py", line 35, in list_gs_dir
return gs_bucket.list_blobs(delimiter='/', prefix=prefix)._get_next_page_response()['prefixes']
File "/usr/local/lib/python3.6/dist-packages/google/api_core/page_iterator.py", line 419, in _get_next_page_response
method=self._HTTP_METHOD, path=self.path, query_params=params
File "/usr/local/lib/python3.6/dist-packages/google/cloud/_http.py", line 315, in api_request
target_object=_target_object,
File "/usr/local/lib/python3.6/dist-packages/google/cloud/_http.py", line 192, in _make_request
return self._do_request(method, url, headers, data, target_object)
File "/usr/local/lib/python3.6/dist-packages/google/cloud/_http.py", line 221, in _do_request
return self.http.request(url=url, method=method, headers=headers, data=data)
File "/usr/local/lib/python3.6/dist-packages/google/auth/transport/requests.py", line 470, in request
**kwargs
File "/usr/lib/python3/dist-packages/requests/sessions.py", line 520, in request
resp = self.send(prep, **send_kwargs)
File "/usr/lib/python3/dist-packages/requests/sessions.py", line 630, in send
r = adapter.send(request, **kwargs)
File "/usr/lib/python3/dist-packages/requests/adapters.py", line 506, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='www.googleapis.com', port=443): Max retries exceeded with url: <url> (Caused by SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:2309)'),))

Python urllib3 - Crawling webpages failed at a specific webpage only from google cloud vm

I have built a crawler script that download webpages using urllib3 and python3. I ran the crawler in a Google Cloud Virtual Machine instance and tried it with many different urls. I found a url that i couldn't download on the VM instance but succeeded to download on my personal Linux.
The code that i've tried on my computer and worked:
>>> import urllib3
>>> pool = urllib3.PoolManager()
>>> response = pool.request('GET', 'http://www.azlyrics.com/lyrics/drake/dowhatyoudo.html')
>>> response.status
200
I have tried the exact same code on the VM instance using ssh and this exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/urllib3/connectionpool.py", line 594, in urlopen
chunked=chunked)
File "/usr/local/lib/python3.5/dist-packages/urllib3/connectionpool.py", line 391, in _make_request
six.raise_from(e, None)
File "<string>", line 2, in raise_from
File "/usr/local/lib/python3.5/dist-packages/urllib3/connectionpool.py", line 387, in _make_request
httplib_response = conn.getresponse()
File "/usr/lib/python3.5/http/client.py", line 1197, in getresponse
response.begin()
File "/usr/lib/python3.5/http/client.py", line 297, in begin
version, status, reason = self._read_status()
File "/usr/lib/python3.5/http/client.py", line 266, in _read_status
raise RemoteDisconnected("Remote end closed connection without"
http.client.RemoteDisconnected: Remote end closed connection without response
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.5/dist-packages/urllib3/request.py", line 66, in request
**urlopen_kw)
File "/usr/local/lib/python3.5/dist-packages/urllib3/request.py", line 87, in request_encode_url
return self.urlopen(method, url, **extra_kw)
File "/usr/local/lib/python3.5/dist-packages/urllib3/poolmanager.py", line 244, in urlopen
response = conn.urlopen(method, u.request_uri, **kw)
File "/usr/local/lib/python3.5/dist-packages/urllib3/connectionpool.py", line 671, in urlopen
release_conn=release_conn, **response_kw)
File "/usr/local/lib/python3.5/dist-packages/urllib3/connectionpool.py", line 671, in urlopen
release_conn=release_conn, **response_kw)
File "/usr/local/lib/python3.5/dist-packages/urllib3/connectionpool.py", line 671, in urlopen
release_conn=release_conn, **response_kw)
File "/usr/local/lib/python3.5/dist-packages/urllib3/connectionpool.py", line 643, in urlopen
_stacktrace=sys.exc_info()[2])
File "/usr/local/lib/python3.5/dist-packages/urllib3/util/retry.py", line 303, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='www.azlyrics.com', port=80): Max retries exceeded with url: /lyrics/drake/dowhatyoudo.html (Caused by ProtocolError('Connection aborted.', RemoteDisconnected('Remote
end closed connection without response',)))
I have checked the VM dashboard and I didn't find any firewall or other restrictions that I may have mistakenly defined.
What could it possibly be?

Categories