Can't connect neo4j 4.0 through bolt api

I just switched from 3.5 to 4.0 and can visit it:
http://localhost:7474/browser/

However, my bolt api test failed, which worked in 3.5 previously:

from neo4j import GraphDatabase

uri = "bolt://localhost:7687"
driver = GraphDatabase.driver(uri, auth=("neo4j", "123456"))

The error message:

Traceback (most recent call last):
  File "/my-env/data_collection/lib/python3.7/site-packages/neobolt/direct.py", line 831, in _connect
    s.connect(resolved_address)
ConnectionRefusedError: [Errno 61] Connection refused

During handling of the above exception, another exception occurred:
...
File "/my-env/data_collection/lib/python3.7/site-packages/neobolt/direct.py", line 843, in _connect
    raise ServiceUnavailable("Failed to establish connection to {!r} (reason {})".format(resolved_address, error))
neobolt.exceptions.ServiceUnavailable: Failed to establish connection to ('::1', 7687, 0, 0) (reason [Errno 61] Connection refused)

I followed the instruction: Neo4j Python Driver 5.4 — Neo4j Python Driver 5.4
python -m pip install neo4j

However, this still installed the 'neo4j-driver==1.7.6' and 'neo4j==1.7.6'. The doc said that 4.0 works backward. How to get rid of the message?

BTW, I am on a Mac. I searched and some post said changing localhost to 127.0.0.1 worked, but it didn't work for me.

However, my command line works:

./cypher-shell -a 127.0.0.1 -u neo4j -p 1234
Connected to Neo4j 4.0.4 at bolt://127.0.0.1:7687 as user neo4j.
Type :help for a list of available commands or :exit to exit the shell.

Hello,

Can you try:

driver = GraphDatabase.driver(uri, auth=("neo4j", "123456"), encrypted=False))

and

uri = "bolt://localhost:7687"

It woked! and Thank you really.

1 Like

A pleasure, if that's all, you can close this topic:)

1 Like

Where is the button to close an issue?

Normally, on one of my post, you should be able to accept my answer :)

I clicked the 'Solution'. So that's 'closing'?

Yep normally:)

Have a good night :)