I am running a code from server A. Below is the error message. The error is tracing back to this line of code api_url = 'http://127.0.0.1:4657/embeddings' every time, which is think is from a different server B. What should I do to remove this error?
Traceback (most recent call last):
File "/root/pritika/ner/lib/python3.11/site-packages/urllib3/connection.py", line 174, in _new_conn
conn = connection.create_connection(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/pritika/ner/lib/python3.11/site-packages/urllib3/util/connection.py", line 95, in create_connection
raise err
File "/root/pritika/ner/lib/python3.11/site-packages/urllib3/util/connection.py", line 85, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/root/pritika/ner/lib/python3.11/site-packages/urllib3/connectionpool.py", line 715, in urlopen
httplib_response = self._make_request(
^^^^^^^^^^^^^^^^^^^
File "/root/pritika/ner/lib/python3.11/site-packages/urllib3/connectionpool.py", line 416, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/root/pritika/ner/lib/python3.11/site-packages/urllib3/connection.py", line 244, in request
super(HTTPConnection, self).request(method, url, body=body, headers=headers)
File "/root/miniconda3/lib/python3.11/http/client.py", line 1294, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/root/miniconda3/lib/python3.11/http/client.py", line 1340, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/root/miniconda3/lib/python3.11/http/client.py", line 1289, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/root/miniconda3/lib/python3.11/http/client.py", line 1048, in _send_output
self.send(msg)
File "/root/miniconda3/lib/python3.11/http/client.py", line 986, in send
self.connect()
File "/root/pritika/ner/lib/python3.11/site-packages/urllib3/connection.py", line 205, in connect
conn = self._new_conn()
^^^^^^^^^^^^^^^^
File "/root/pritika/ner/lib/python3.11/site-packages/urllib3/connection.py", line 186, in _new_conn
raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7f374f413650>: Failed to establish a new connection: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/root/pritika/ner/lib/python3.11/site-packages/requests/adapters.py", line 486, in send
resp = conn.urlopen(
^^^^^^^^^^^^^
File "/root/pritika/ner/lib/python3.11/site-packages/urllib3/connectionpool.py", line 799, in urlopen
retries = retries.increment(
^^^^^^^^^^^^^^^^^^
File "/root/pritika/ner/lib/python3.11/site-packages/urllib3/util/retry.py", line 592, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='127.0.0.1', port=4657): Max retries exceeded with url: /embeddings (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f374f413650>: Failed to establish a new connection: [Errno 111] Connection refused'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/root/pritika/EaseMyTrip/Chat/main.py", line 1, in <module>
from INTENT.intent import IntentDetector
File "/root/pritika/EaseMyTrip/Chat/INTENT/intent.py", line 233, in <module>
top_5 = intent.get_top_sentence_candidates("This is the first sentence.")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/pritika/EaseMyTrip/Chat/INTENT/intent.py", line 56, in get_top_sentence_candidates
input_embedding = self.get_input_embedding_from_api(input_sentence)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/pritika/EaseMyTrip/Chat/INTENT/intent.py", line 42, in get_input_embedding_from_api
response = requests.post(api_url, json={'texts': input_sentence})
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/pritika/ner/lib/python3.11/site-packages/requests/api.py", line 115, in post
return request("post", url, data=data, json=json, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/pritika/ner/lib/python3.11/site-packages/requests/api.py", line 59, in request
return session.request(method=method, url=url, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/pritika/ner/lib/python3.11/site-packages/requests/sessions.py", line 589, in request
resp = self.send(prep, **send_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/pritika/ner/lib/python3.11/site-packages/requests/sessions.py", line 703, in send
r = adapter.send(request, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/pritika/ner/lib/python3.11/site-packages/requests/adapters.py", line 519, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='127.0.0.1', port=4657): Max retries exceeded with url: /embeddings (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f374f413650>: Failed to establish a new connection: [Errno 111] Connection refused'))
I am running a code from server A. Below is the error message. The error is tracing back to this line of code api_url = 'http://127.0.0.1:4657/embeddings' every time, which is think is from a different server B. What should I do to remove this error?
127.0.0.1is the "loopback" or "localhost" address - it's how a system can use the Internet Protocol to refer to itself. (The English words "I", "me", "my", and "mine" are similar: the person using those words is always referring to themselves, or to something associated with themselves.)Your code here is running on Server A and attempting to connect to Server A - not Server B. It looks like there's nothing listening on port 4657 on Server A's loopback address; should there be?