Anupurba Mitra
Anupurba Mitra

Reputation: 35

Google colab to neo4j database connectivity error: service unavailable

I am trying to connect my google colab notebook to neo4j server, using neo4j driver package that is officially supported by neo4j. BI am getting the following error. ServiceUnavailable: Couldn't connect to 127.0.0.1:7687 (resolved to ('127.0.0.1:7687',)): Failed to establish connection to ResolvedIPv4Address(('127.0.0.1', 7687)) (reason [Errno 111] Connection refused) This is my full stack trace:

ConnectionRefusedError                    Traceback (most recent call last)
/usr/local/lib/python3.7/dist-packages/neo4j/io/__init__.py in _connect(resolved_address, timeout, keep_alive)
   1175         log.debug("[#0000]  C: <OPEN> %s", resolved_address)
-> 1176         s.connect(resolved_address)
   1177         s.settimeout(t)

ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

ServiceUnavailable                        Traceback (most recent call last)
9 frames
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:

ServiceUnavailable                        Traceback (most recent call last)
/usr/local/lib/python3.7/dist-packages/neo4j/io/__init__.py in connect(address, timeout, custom_resolver, ssl_context, keep_alive)
   1316                 "\n".join(map(str, errors))
   1317             )
-> 1318         ) from errors[0]
   1319 
   1320 

ServiceUnavailable: Couldn't connect to 127.0.0.1:7687 (resolved to ('127.0.0.1:7687',)):
Failed to establish connection to ResolvedIPv4Address(('127.0.0.1', 7687)) (reason [Errno 111] Connection refused)

Upvotes: 2

Views: 1849

Answers (1)

Tomaž Bratanič
Tomaž Bratanič

Reputation: 6534

Yes, well, you can't connect to localhost from Google Colab, because the localhost for the notebook is completely different than your machine IP. Either expose your localhost outwardly, or create a VM on a cloud, or use a Neo4j Sandbox version, which is already exposed to the internet: https://neo4j.com/sandbox/

Upvotes: 1

Related Questions