Saturday, March 8, 2025

Flask Issue of "Address already in use" in PythonAnywhere Cloud

To See All Articles About Technology: Index of Lessons in Technology

Project Setup X:

Issue of: "Address already in use" * Serving Flask app '__main__' (lazy loading) * Environment: production WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead. * Debug mode: on Address already in use Port 5000 is in use by another program. Either identify and stop that program, or start the server with a different port. Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/werkzeug/serving.py", line 908, in prepare_socket s.bind(server_address) OSError: [Errno 98] Address already in use FIX: if __name__ == '__main__': app.run(debug=True, port=5002, use_reloader=False)

Project Setup For ASR

04:47 ~ $ python app_pt.py 2025-03-09 04:49:18.556050: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libcudart.so.11.0'; dlerror: libcudart.so.11.0: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /usr/local/lib/python3.10/site-packages/cv2/../../lib64: 2025-03-09 04:49:18.556080: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine. * Serving Flask app 'app_pt' (lazy loading) * Environment: production WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead. * Debug mode: on Address already in use Port 5000 is in use by another program. Either identify and stop that program, or start the server with a different port. 05:08 ~ $ tail -3 app_pt.py if __name__ == "__main__": # Run the server on port 5000 and listen on all interfaces. app.run(host="0.0.0.0", port=5001, debug=False) 04:59 ~ $ python app_pt.py 2025-03-09 05:01:13.156268: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libcudart.so.11.0'; dlerror: libcudart.so.11.0: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /usr/local/lib/python3.10/site-packages/cv2/../../lib64: 2025-03-09 05:01:13.156294: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine. * Serving Flask app 'app_pt' (lazy loading) * Environment: production WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead. * Debug mode: off Address already in use Port 5001 is in use by another program. Either identify and stop that program, or start the server with a different port. 05:03 ~ $ 05:09 ~ $ tail -3 app_pt.py if __name__ == "__main__": # Run the server on port 5000 and listen on all interfaces. app.run(host="0.0.0.0", port=5001, debug=False, use_reloader=False) 05:09 ~ $ python app_pt.py 2025-03-09 05:11:43.255847: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libcudart.so.11.0'; dlerror: libcudart.so.11.0: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /usr/local/lib/python3.10/site-packages/cv2/../../lib64: 2025-03-09 05:11:43.255871: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine. * Serving Flask app 'app_pt' (lazy loading) * Environment: production WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead. * Debug mode: off Address already in use Port 5001 is in use by another program. Either identify and stop that program, or start the server with a different port. 05:13 ~

The way to resolve this is to not attempt to run a 'flask app' as a Python Script. Rather use 'Web' app configuration of PythonAnywhere as shown below:

Below screen is not the actual one but only for demo purpose...
Tags: Python,Cloud,Technology,Web Development,

No comments:

Post a Comment