localGPT icon indicating copy to clipboard operation
localGPT copied to clipboard

500 Internal Server Error

Open lawk107 opened this issue 1 year ago • 2 comments

I need assistance. I execute 'python localGPTUI.py' . I then go to the 'http://127.0.0.1:5111' where I see the html page. I enter a search prompt. I am faced with '500 Internal Server Error'.

I have changed the Microsoft Firewall rules to allow 'InBound' and 'OutBound' to allow Port: 5110-5111. I have tried: python localGPTUI.py --port 5111 --host 127.0.0.1 (and variations) My browsers are: Firefox, and Google Chrome. Proxy has been disabled. I do not use VPN. I have checked discussions and Issues on this GitHub PromtEngineer page for clues to resolve my issue.

What am I doing wrong:?

(base) C:\Users\UserDebb\LocalGPT\localGPT\localGPTUI>python localGPTUI.py * Serving Flask app 'localGPTUI' * Debug mode: off WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead. * Running on http://127.0.0.1:5111 Press CTRL+C to quit User Prompt: hello [2023-12-17 11:28:37,417] ERROR in app: Exception on / [POST] Traceback (most recent call last): File "C:\Users\UserDebb\anaconda3\Lib\site-packages\urllib3\connection.py", line 169, in _new_conn conn = connection.create_connection( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\UserDebb\anaconda3\Lib\site-packages\urllib3\util\connection.py", line 96, in create_connection raise err File "C:\Users\UserDebb\anaconda3\Lib\site-packages\urllib3\util\connection.py", line 86, in create_connection sock.connect(sa) ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Users\UserDebb\anaconda3\Lib\site-packages\urllib3\connectionpool.py", line 699, in urlopen httplib_response = self._make_request( ^^^^^^^^^^^^^^^^^^^ File "C:\Users\UserDebb\anaconda3\Lib\site-packages\urllib3\connectionpool.py", line 394, in _make_request conn.request(method, url, **httplib_request_kw) File "C:\Users\UserDebb\anaconda3\Lib\site-packages\urllib3\connection.py", line 234, in request super(HTTPConnection, self).request(method, url, body=body, headers=headers) File "C:\Users\UserDebb\anaconda3\Lib\http\client.py", line 1286, in request self._send_request(method, url, body, headers, encode_chunked) File "C:\Users\UserDebb\anaconda3\Lib\http\client.py", line 1332, in _send_request self.endheaders(body, encode_chunked=encode_chunked) File "C:\Users\UserDebb\anaconda3\Lib\http\client.py", line 1281, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "C:\Users\UserDebb\anaconda3\Lib\http\client.py", line 1041, in _send_output self.send(msg) File "C:\Users\UserDebb\anaconda3\Lib\http\client.py", line 979, in send self.connect() File "C:\Users\UserDebb\anaconda3\Lib\site-packages\urllib3\connection.py", line 200, in connect conn = self._new_conn() ^^^^^^^^^^^^^^^^ File "C:\Users\UserDebb\anaconda3\Lib\site-packages\urllib3\connection.py", line 181, in _new_conn raise NewConnectionError( urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x00000168C1D4AE10>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Users\UserDebb\anaconda3\Lib\site-packages\requests\adapters.py", line 486, in send resp = conn.urlopen( ^^^^^^^^^^^^^ File "C:\Users\UserDebb\anaconda3\Lib\site-packages\urllib3\connectionpool.py", line 755, in urlopen retries = retries.increment( ^^^^^^^^^^^^^^^^^^ File "C:\Users\UserDebb\anaconda3\Lib\site-packages\urllib3\util\retry.py", line 574, in increment raise MaxRetryError(_pool, url, error or ResponseError(cause)) urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=5110): Max retries exceeded with url: /api/prompt_route (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x00000168C1D4AE10>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it')) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Users\UserDebb\anaconda3\Lib\site-packages\flask\app.py", line 2525, in wsgi_app response = self.full_dispatch_request() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\UserDebb\anaconda3\Lib\site-packages\flask\app.py", line 1822, in full_dispatch_request rv = self.handle_user_exception(e) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\UserDebb\anaconda3\Lib\site-packages\flask\app.py", line 1820, in full_dispatch_request rv = self.dispatch_request() ^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\UserDebb\anaconda3\Lib\site-packages\flask\app.py", line 1796, in dispatch_request return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\UserDebb\LocalGPT\localGPT\localGPTUI\localGPTUI.py", line 27, in home_page response = requests.post(main_prompt_url, data={"user_prompt": user_prompt}) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\UserDebb\anaconda3\Lib\site-packages\requests\api.py", line 115, in post return request("post", url, data=data, json=json, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\UserDebb\anaconda3\Lib\site-packages\requests\api.py", line 59, in request return session.request(method=method, url=url, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\UserDebb\anaconda3\Lib\site-packages\requests\sessions.py", line 589, in request resp = self.send(prep, **send_kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\UserDebb\anaconda3\Lib\site-packages\requests\sessions.py", line 703, in send r = adapter.send(request, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\UserDebb\anaconda3\Lib\site-packages\requests\adapters.py", line 519, in send raise ConnectionError(e, request=request) requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=5110): Max retries exceeded with url: /api/prompt_route (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x00000168C1D4AE10>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it')) 127.0.0.1 - - [17/Dec/2023 11:28:37] "POST / HTTP/1.1" 500 -

lawk107 avatar Dec 17 '23 19:12 lawk107

Try changing the main_prompt url in localGPTUI.py to http://127.0.0.1:5111/prompt_route it might work.

nidhi-chipre avatar Jan 03 '24 05:01 nidhi-chipre

@lawk107 Same issue I also faced.

So, I found out that before running the localGPTUI.py file. You need to run run_localGPT_API.py file, for the following.

So, it will start the API and then enable you to run the local server which will connect to API, and then you can query your answers.

Hope this helps. Do ask me any other questions if there. Thank you.

NitkarshChourasia avatar Mar 31 '24 22:03 NitkarshChourasia