Cannot connect to neo4j via python driver but everything is fine with cypher-shell

I established a neo4j instance with all config in default, and it can be connected with cypher-shell.

But I cannot connect it with python-driver.

Traceback (most recent call last):
  File "~/mambaforge/envs/llama-index/lib/python3.11/site-packages/neo4j/_async_compat/network/_bolt_socket.py", line 523, in _connect
    s.connect(resolved_address)
ConnectionRefusedError: [Errno 111] Connection refused
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File "~/mambaforge/envs/llama-index/lib/python3.11/site-packages/neo4j/_async_compat/network/_bolt_socket.py", line 681, in connect
    s = BoltSocket._connect(resolved_address, tcp_timeout,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/mambaforge/envs/llama-index/lib/python3.11/site-packages/neo4j/_async_compat/network/_bolt_socket.py", line 541, in _connect
    raise ServiceUnavailable(
neo4j.exceptions.ServiceUnavailable: Failed to establish connection to ResolvedIPv4Address(('127.0.0.1', 7687)) (reason [Errno 111] Connection refused)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File "~/mambaforge/envs/llama-index/lib/python3.11/site-packages/llama_index/graph_stores/neo4j.py", line 55, in __init__
    self._driver.verify_connectivity()
  File "~/mambaforge/envs/llama-index/lib/python3.11/site-packages/neo4j/_sync/driver.py", line 974, in verify_connectivity
    self._get_server_info(session_config)
  File "~/mambaforge/envs/llama-index/lib/python3.11/site-packages/neo4j/_sync/driver.py", line 1185, in _get_server_info
    return session._get_server_info()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/mambaforge/envs/llama-index/lib/python3.11/site-packages/neo4j/_sync/work/session.py", line 173, in _get_server_info
    self._connect(READ_ACCESS, liveness_check_timeout=0)
  File "~/mambaforge/envs/llama-index/lib/python3.11/site-packages/neo4j/_sync/work/session.py", line 131, in _connect
    super()._connect(
  File "~/mambaforge/envs/llama-index/lib/python3.11/site-packages/neo4j/_sync/work/workspace.py", line 178, in _connect
    self._connection = self._pool.acquire(**acquire_kwargs_)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/mambaforge/envs/llama-index/lib/python3.11/site-packages/neo4j/_sync/io/_pool.py", line 528, in acquire
    return self._acquire(
           ^^^^^^^^^^^^^^
  File "~/mambaforge/envs/llama-index/lib/python3.11/site-packages/neo4j/_sync/io/_pool.py", line 315, in _acquire
    return connection_creator()
           ^^^^^^^^^^^^^^^^^^^^
  File "~/mambaforge/envs/llama-index/lib/python3.11/site-packages/neo4j/_sync/io/_pool.py", line 167, in connection_creator
    connection = self.opener(
                 ^^^^^^^^^^^^
  File "~/mambaforge/envs/llama-index/lib/python3.11/site-packages/neo4j/_sync/io/_pool.py", line 502, in opener
    return Bolt.open(
           ^^^^^^^^^^
  File "~/mambaforge/envs/llama-index/lib/python3.11/site-packages/neo4j/_sync/io/_bolt.py", line 402, in open
    BoltSocket.connect(
  File "~/mambaforge/envs/llama-index/lib/python3.11/site-packages/neo4j/_async_compat/network/_bolt_socket.py", line 709, in connect
    raise ServiceUnavailable(
neo4j.exceptions.ServiceUnavailable: Couldn't connect to 127.0.0.1:7687 (resolved to ()):
Failed to establish connection to ResolvedIPv4Address(('127.0.0.1', 7687)) (reason [Errno 111] Connection refused)

And the browser connection has the same error.

All debugging requests failed against neo4j://localhost:7687
Double check the URL, make sure neo4j is running and that you have a network connection if needed.
Full diagnostic details
Browser will attempt to open a websocket connection to neo4j://localhost:7687 and do an encrypted and an unencrypted bolt handshake.
bolt handshake
Status: 
Error
encrypted bolt handshake
Status: 
Error
The bolt connector port only supports running cypher transactions via websocket but it can respond to HTTP requests with some limited server information. Using this Browser can try to detect a running neo4j server at neo4j://localhost:7687 by doing a GET request.
HTTP GET http://localhost:7687
Status: 
Request failed
Failed to fetch
Check your web browsers developer tools network tab for more details.
HTTPs GET https://localhost:7687
Status: 
Request failed
Failed to fetch
Check your web browsers developer tools network tab for more details.
Neo4j Browser Version: 5.12.0
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36
Current time: 2023-11-08T06:43:58.495Z 

Can you show us the python code you are using? I'm not sure but it could be the instance URI you are using.