0
votes

I am following a tutorial about py2neo, I am moving the first steps.

I want to connect to a graph I created by using the command graph = Graph()

Here is what I did from the very beginning:

I open Neo4j Desktop (v. 1.3.11), create a new project, and then create a new database:

add database > create a local database

DBMS Name: Neo4j
Password: Neo4j

Then I start it and then I click on open, so that the Neo4j browser opens and it connects to the database.

enter image description here

enter image description here

Since I see the message that I am connected, I can go on.

I am using Anaconda as prompt.

I type python to activate the python shell, and the output is:

Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 16:07:46) [MSC v.1900 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>

I type:

from py2neo import Graph

and then

graph = Graph()

But then the prompt returns:

Traceback (most recent call last):
  File "C:\Applicazioni_Tommaso\Phyton\lib\site-packages\py2neo\client\__init__.py", line 450, in acquire
    cx = self._free_list.popleft()
IndexError: pop from an empty deque

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Applicazioni_Tommaso\Phyton\lib\site-packages\py2neo\database\__init__.py", line 358, in __init__
    self.service = GraphService(profile, **settings)
  File "C:\Applicazioni_Tommaso\Phyton\lib\site-packages\py2neo\database\__init__.py", line 189, in __init__
    self._connector = Connector(profile, **connector_settings)
  File "C:\Applicazioni_Tommaso\Phyton\lib\site-packages\py2neo\client\__init__.py", line 603, in __init__
    self.add_pools(self._profile)
  File "C:\Applicazioni_Tommaso\Phyton\lib\site-packages\py2neo\client\__init__.py", line 631, in add_pools
    on_broken=self._on_broken)
  File "C:\Applicazioni_Tommaso\Phyton\lib\site-packages\py2neo\client\__init__.py", line 316, in open
    seeds = [pool.acquire() for _ in range(init_size or cls.default_init_size)]
  File "C:\Applicazioni_Tommaso\Phyton\lib\site-packages\py2neo\client\__init__.py", line 316, in <listcomp>
    seeds = [pool.acquire() for _ in range(init_size or cls.default_init_size)]
  File "C:\Applicazioni_Tommaso\Phyton\lib\site-packages\py2neo\client\__init__.py", line 460, in acquire
    on_broken=lambda msg: self.__on_broken(msg))
  File "C:\Applicazioni_Tommaso\Phyton\lib\site-packages\py2neo\client\__init__.py", line 118, in open
    on_release=on_release, on_broken=on_broken)
  File "C:\Applicazioni_Tommaso\Phyton\lib\site-packages\py2neo\client\bolt.py", line 213, in open
    bolt._hello()
  File "C:\Applicazioni_Tommaso\Phyton\lib\site-packages\py2neo\client\bolt.py", line 653, in _hello
    self._audit(response)
  File "C:\Applicazioni_Tommaso\Phyton\lib\site-packages\py2neo\client\bolt.py", line 626, in _audit
    task.audit()
  File "C:\Applicazioni_Tommaso\Phyton\lib\site-packages\py2neo\client\bolt.py", line 1062, in audit
    raise self._failure
py2neo.database.work.ClientError: [Security.Unauthorized] The client is unauthorized due to authentication failure.

I see that the problem is due to security reasons, so I tryed with

graph = Graph("bolt://localhost:7687", user="Neo4j", password="Neo4j")

But I get the same error. What is wrong?

1

1 Answers

1
votes

You are trying to authenticate by using your DBMS name instead of your user name, that by default is neo4j.

Actually the Neo4j browser is telling you that:

You are connected as user neo4j

to bolt://localhost:7687

So the correct command to connect to your graph is

graph = Graph("bolt://localhost:7687", user="neo4j", password="Neo4j")