Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IOError when using the Python neo4j driver to connect to Reactome data #365

Closed
dvklopfenstein opened this issue Mar 7, 2020 · 3 comments

Comments

@dvklopfenstein
Copy link

dvklopfenstein commented Mar 7, 2020

Guidelines

  • Neo4j version: neo4j-community-4.0.1
  • Neo4j Mode: Single instance
  • Driver version: Python3.6 lanaguage driver 1.7.6
  • Operating system: Ubuntu 16.04.4 LTS
  • Java: jdk-11.0.6
  • Reactome graph database version: 71

Steps to reproduce

The instructions to load the Reactome database into Neo4j are detailed in neo4j #12408.
The crucial step to get Reactome up and running in Neo4j was given by @gsviteri in
his comment.

Now I am trying to access the Reactome database from a Python script using the recommended Neo4j driver.

from neo4j import GraphDatabase

# Try various loads:
drv = GraphDatabase.driver("bolt://localhost:7687", auth=("neo4j", "password"))
drv = GraphDatabase.driver("neo4j://localhost:7687", auth=("neo4j", "password"))
drv = GraphDatabase.driver("bolt://localhost:7687/graph.db", auth=("neo4j", "password"))
drv = GraphDatabase.driver("neo4j://localhost:7687/graph.db", auth=("neo4j", "password"))

Each of these attempts result in the same OSError, shown in the Actual behavior section.

Expected behavior

I expect to get a GraphDatabase object back and see no errors.

Actual behavior

Here the error that appears on the screen for each attempt:

Traceback (most recent call last):
  File "/mnt/c/Users/note2/Data/git/ReactomePy/src/reactomepy/code/utils.py", line 32, in get_gdbdr
    return GraphDatabase.driver(dct['url'], auth=(dct['neo4j_username'], dct['neo4j_password']))
  File "/home/neo4j/anaconda3/lib/python3.6/site-packages/neo4j/__init__.py", line 120, in driver
    return Driver(uri, **config)
  File "/home/neo4j/anaconda3/lib/python3.6/site-packages/neo4j/__init__.py", line 161, in __new__
    return subclass(uri, **config)
  File "/home/neo4j/anaconda3/lib/python3.6/site-packages/neo4j/__init__.py", line 235, in __new__
    pool.release(pool.acquire())
  File "/home/neo4j/anaconda3/lib/python3.6/site-packages/neobolt/direct.py", line 715, in acquire
    return self.acquire_direct(self.address)
  File "/home/neo4j/anaconda3/lib/python3.6/site-packages/neobolt/direct.py", line 608, in acquire_direct
    connection = self.connector(address, error_handler=self.connection_error_handler)
  File "/home/neo4j/anaconda3/lib/python3.6/site-packages/neo4j/__init__.py", line 232, in connector
    return connect(address, **dict(config, **kwargs))
  File "/home/neo4j/anaconda3/lib/python3.6/site-packages/neobolt/direct.py", line 972, in connect
    raise last_error
  File "/home/neo4j/anaconda3/lib/python3.6/site-packages/neobolt/direct.py", line 963, in connect
    s, der_encoded_server_certificate = _secure(s, host, security_plan.ssl_context, **config)
  File "/home/neo4j/anaconda3/lib/python3.6/site-packages/neobolt/direct.py", line 854, in _secure
    s = ssl_context.wrap_socket(s, server_hostname=host if HAS_SNI and host else None)
  File "/home/neo4j/anaconda3/lib/python3.6/ssl.py", line 407, in wrap_socket
    _context=self, _session=session)
  File "/home/neo4j/anaconda3/lib/python3.6/ssl.py", line 817, in __init__
    self.do_handshake()
  File "/home/neo4j/anaconda3/lib/python3.6/ssl.py", line 1077, in do_handshake
    self._sslobj.do_handshake()
  File "/home/neo4j/anaconda3/lib/python3.6/ssl.py", line 689, in do_handshake
    self._sslobj.do_handshake()
OSError: [Errno 0] Error

I don't see anything interesting in the neo4j.log or the debug.log, but have attached them anyway.

This used to work for me for these versions:

  • Neo4j version: neo4j-community-3.4.7
  • Java: jdk1.8.0_192
  • Reactome graph database version: 68

Is this important?

As shown in the next couple figures, when things worked, the connection was:
neo4j@bolt://localhost:7687
Now, the connection is:
neo4j@neo4j://localhost:7687/graph.db

Successful past:

The browser looked like this in the past:
python_neo4j_gdbdr

Unsuccessful present:

Now it looks like this:
neo4j_4o0o1_connection

@dvklopfenstein
Copy link
Author

dvklopfenstein commented Mar 7, 2020

FYI: Thank goodness, it is working with:

  • Neo4j version: neo4j-community-3.4.7
  • Java: jdk1.8.0_192
  • Reactome graph database version: 71

Here is the successful run:

$ python3
Python 3.6.7 | packaged by conda-forge | (default, Jul  2 2019, 02:18:42)
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from neo4j import GraphDatabase
>>> drv = GraphDatabase.driver("bolt://localhost:7687", auth=("neo4j", password))
>>> print(drv)
<neo4j.DirectDriver object at 0x7f1b7b3d2240>

How might this work using Neo4j 4.0.1?

No hurry, though, since access to Reactome through Python works with neo4j 3.4.7.

@technige
Copy link
Contributor

technige commented Mar 9, 2020

@dvklopfenstein Going from a 1.7 driver to a 4.0 server, you will need to disable encryption, which is turned on by default. Use encrypted=False in your driver constructor.

@martin-neotech
Copy link
Contributor

@dvklopfenstein thanks for your feedback

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants