Error occuring while trying the API


The error I get: Traceback (most recent call last):
File “C:\Users\90538\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connectionpool.py”, line 703, in urlopen
httplib_response = self._make_request(
File “C:\Users\90538\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connectionpool.py”, line 398, in _make_request
conn.request(method, url, **httplib_request_kw)
File “C:\Users\90538\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connection.py”, line 239, in request
super(HTTPConnection, self).request(method, url, body=body, headers=headers)
File “C:\Users\90538\AppData\Local\Programs\Python\Python38\lib\http\client.py”, line 1255, in request
self._send_request(method, url, body, headers, encode_chunked)
File “C:\Users\90538\AppData\Local\Programs\Python\Python38\lib\http\client.py”, line 1301, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File “C:\Users\90538\AppData\Local\Programs\Python\Python38\lib\http\client.py”, line 1250, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File “C:\Users\90538\AppData\Local\Programs\Python\Python38\lib\http\client.py”, line 1049, in _send_output
self.send(chunk)
File “C:\Users\90538\AppData\Local\Programs\Python\Python38\lib\http\client.py”, line 971, in send
self.sock.sendall(data)
File “C:\Users\90538\AppData\Local\Programs\Python\Python38\lib\ssl.py”, line 1204, in sendall
v = self.send(byte_view[count:])
File “C:\Users\90538\AppData\Local\Programs\Python\Python38\lib\ssl.py”, line 1173, in send
return self._sslobj.write(data)
ConnectionResetError: [WinError 10054] Varolan bir bağlantı uzaktaki bir ana bilgisayar tarafından zorla kapatıldı

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “C:\Users\90538\AppData\Local\Programs\Python\Python38\lib\site-packages\requests\adapters.py”, line 489, in send
resp = conn.urlopen(
File “C:\Users\90538\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connectionpool.py”, line 787, in urlopen
retries = retries.increment(
File “C:\Users\90538\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\util\retry.py”, line 550, in increment
raise six.reraise(type(error), error, _stacktrace)
File “C:\Users\90538\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\packages\six.py”, line 769, in reraise
raise value.with_traceback(tb)
File “C:\Users\90538\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connectionpool.py”, line 703, in urlopen
httplib_response = self._make_request(
File “C:\Users\90538\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connectionpool.py”, line 398, in _make_request
conn.request(method, url, **httplib_request_kw)
File “C:\Users\90538\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connection.py”, line 239, in request
super(HTTPConnection, self).request(method, url, body=body, headers=headers)
File “C:\Users\90538\AppData\Local\Programs\Python\Python38\lib\http\client.py”, line 1255, in request
self._send_request(method, url, body, headers, encode_chunked)
File “C:\Users\90538\AppData\Local\Programs\Python\Python38\lib\http\client.py”, line 1301, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File “C:\Users\90538\AppData\Local\Programs\Python\Python38\lib\http\client.py”, line 1250, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File “C:\Users\90538\AppData\Local\Programs\Python\Python38\lib\http\client.py”, line 1049, in _send_output
self.send(chunk)
File “C:\Users\90538\AppData\Local\Programs\Python\Python38\lib\http\client.py”, line 971, in send
self.sock.sendall(data)
File “C:\Users\90538\AppData\Local\Programs\Python\Python38\lib\ssl.py”, line 1204, in sendall
v = self.send(byte_view[count:])
File “C:\Users\90538\AppData\Local\Programs\Python\Python38\lib\ssl.py”, line 1173, in send
return self._sslobj.write(data)
urllib3.exceptions.ProtocolError: (‘Connection aborted.’, ConnectionResetError(10054, ‘Varolan bir bağlantı uzaktaki bir ana bilgisayar tarafından zorla kapatıldı’, None, 10054, None))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “c:/Users/90538/Desktop/import cv2.py”, line 9, in
prediction = model.predict(“C:/Users/90538/Desktop/OkeyData/20230305_025932.jpg”)
File “C:\Users\90538\AppData\Local\Programs\Python\Python38\lib\site-packages\roboflow\models\object_detection.py”, line 157, in predict
resp = requests.post(
File “C:\Users\90538\AppData\Local\Programs\Python\Python38\lib\site-packages\requests\api.py”, line 115, in post
return request(“post”, url, data=data, json=json, **kwargs)
File “C:\Users\90538\AppData\Local\Programs\Python\Python38\lib\site-packages\requests\api.py”, line 59, in request
return session.request(method=method, url=url, **kwargs)
File “C:\Users\90538\AppData\Local\Programs\Python\Python38\lib\site-packages\requests\sessions.py”, line 587, in request
resp = self.send(prep, **send_kwargs)
File “C:\Users\90538\AppData\Local\Programs\Python\Python38\lib\site-packages\requests\sessions.py”, line 701, in send
r = adapter.send(request, **kwargs)
File “C:\Users\90538\AppData\Local\Programs\Python\Python38\lib\site-packages\requests\adapters.py”, line 547, in send
raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: (‘Connection aborted.’, ConnectionResetError(10054, ‘Varolan bir bağlantı uzaktaki bir ana bilgisayar tarafından zorla kapatıldı’, None, 10054, None))

It keeps saying “A connection that existed was forcibly closed by a remote host”
I checked my project, I checked the versions of my project. I can see them all via python. But as soon as I try to predict by uploading an image, I get that error. Please help

Are you on a VPN or firewall that may be re-routing or blocking your traffic?

And what is the size of the image, in MB and in pixels (width and height) for the image in question that failed?

No, I’m not using any VPN. The file I am testing is 2016 x 980 in pixels and 100 KB in MBs.

I have been facing the same problem when trying to predict by uploading an image and when trying to infer on local images. I get the same error:

Exception has occurred: ConnectionError
(‘Connection aborted.’, ConnectionResetError(10054, ‘An existing connection was forcibly closed by the remote host’, None, 10054, None))

@Mohamed is there anything I can do to address this?

I’m looking at this on another thread, too. I have a hunch as to what the problem may be - can you two email help@roboflow.com with the scripts you’re using to run the API calls?

Additionally, please include the example image file(s) you tested when receiving the 500-errors.

Hi @Oleg

I am deleting your post since you have an API key shared publicly. You should revoke your API key as soon as possible. API keys allow access to your account and should never be shared publicly.

If you are still having issues, please create a new forum post. Can you confirm which workspace and model you are trying to infer on?