Проблема py2neo: ConnectionUnavailable: невозможно открыть соединение с ConnectionProfile('bolt://localhost:7687')Python

Программы на Python
Ответить Пред. темаСлед. тема
Anonymous
 Проблема py2neo: ConnectionUnavailable: невозможно открыть соединение с ConnectionProfile('bolt://localhost:7687')

Сообщение Anonymous »

Я пытаюсь воспроизвести этот пример на рабочем столе neo4j:
https://stellargraph.readthedocs.io/en/ ... -cora-into -neo4j.html
Я могу воспроизводить все, пока не доберусь до следующей строки:

Код: Выделить всё

import py2neo
default_host = os.environ.get("STELLARGRAPH_NEO4J_HOST")

# Create the Neo4j Graph database object; the arguments can be edited to specify location and authentication

graph = py2neo.Graph(host=default_host, port=None, user=None, password=None)
Я попробовал следующие попытки создать объект базы данных neo4j:

Код: Выделить всё

#1
default_host = os.environ.get("StellarGraph")
graph = py2neo.Graph(host=default_host, port=None, user=None, password=None)

#2
uri = 'bolt://localhost:7687'
graph = Graph(uri, auth=("neo4j", "password"), port= 7687, secure=True)

#3
uri = uri = 'bolt://localhost:7687'
graph = Graph(uri, auth=("neo4j", "password"), port= 7687, secure=True, name= "StellarGraph")
Однако каждый раз, когда я пытаюсь это сделать, это приводит к некоторым вариантам этой ошибки:

Код: Выделить всё

    IndexError                                Traceback (most recent call last)
File ~/.local/lib/python3.8/site-packages/py2neo/client/__init__.py:806, in ConnectionPool.acquire(self, force_reset, can_overfill)
804 try:
805     # Plan A: select a free connection from the pool
--> 806     cx = self._free_list.popleft()
807 except IndexError:

IndexError: pop from an empty deque

During handling of the above exception, another exception occurred:

ConnectionRefusedError                    Traceback (most recent call last)
File ~/.local/lib/python3.8/site-packages/py2neo/wiring.py:62, in Wire.open(cls, address, timeout, keep_alive, on_broken)
61 try:
---> 62     s.connect(address)
63 except (IOError, OSError) as error:

ConnectionRefusedError: [Errno 111] Connection refused

The above exception was the direct cause of the following exception:

WireError                                 Traceback (most recent call last)
File ~/.local/lib/python3.8/site-packages/py2neo/client/bolt.py:355, in Bolt.open(cls, profile, user_agent, on_release, on_broken)
354 try:
--> 355     wire = cls._connect(profile, on_broken=on_broken)
356     protocol_version = cls._handshake(wire)

File ~/.local/lib/python3.8/site-packages/py2neo/client/bolt.py:369, in Bolt._connect(cls, profile, on_broken)
368 log.debug("[#%04X] C: (Dialing )", 0, profile.address)
--> 369 wire = Wire.open(profile.address, keep_alive=True, on_broken=on_broken)
370 local_port = wire.local_address.port_number

File ~/.local/lib/python3.8/site-packages/py2neo/wiring.py:64, in Wire.open(cls, address, timeout, keep_alive, on_broken)
63 except (IOError, OSError) as error:
---> 64     raise_from(WireError("Cannot connect to %r" % (address,)), error)
65 return cls(s, on_broken=on_broken)

File :3, in raise_from(value, from_value)

WireError: Cannot connect to IPv4Address(('localhost', 7687))

The above exception was the direct cause of the following exception:

ConnectionUnavailable                     Traceback (most recent call last)
/home/myname/Project1/graph_import.ipynb Cell 13' in ()
1 uri = 'bolt://localhost:7687'
----> 2 graph = Graph(uri, auth=("neo4j", "mypass"), port= 7687, secure=True, name= "StellarGraph")

File ~/.local/lib/python3.8/site-packages/py2neo/database.py:288, in Graph.__init__(self, profile, name, **settings)
287 def __init__(self, profile=None, name=None, **settings):
--> 288     self.service = GraphService(profile, **settings)
289     self.__name__ = name
290     self.schema = Schema(self)

File ~/.local/lib/python3.8/site-packages/py2neo/database.py:119, in GraphService.__init__(self, profile, **settings)
116 if connector_settings["init_size"] is None and not profile.routing:
117     # Ensures credentials are checked on construction
118     connector_settings["init_size"] = 1
--> 119 self._connector = Connector(profile, **connector_settings)
120 self._graphs = {}

File ~/.local/lib/python3.8/site-packages/py2neo/client/__init__.py:960, in Connector.__init__(self, profile, user_agent, init_size, max_size, max_age, routing_refresh_ttl)
958 else:
959     self._router = None
-->  960 self._add_pools(*self._initial_routers)

File ~/.local/lib/python3.8/site-packages/py2neo/client/__init__.py:982, in Connector._add_pools(self, *profiles)
980     continue
981 log.debug("Adding connection pool for profile %r", profile)
--> 982 pool = ConnectionPool.open(
983     profile,
984     user_agent=self._user_agent,
985     init_size=self._init_size,
986     max_size=self._max_size,
987     max_age=self._max_age,
988     on_broken=self._on_broken)
989 self._pools[profile] = pool

File ~/.local/lib/python3.8/site-packages/py2neo/client/__init__.py:649, in ConnectionPool.open(cls, profile, user_agent, init_size, max_size, max_age, on_broken)
627 """ Create a new connection pool, with an option to seed one
628 or more initial connections.
629
(...)
646     scheme
647 """
648 pool = cls(profile, user_agent, max_size, max_age, on_broken)
--> 649 seeds = [pool.acquire() for _ in range(init_size or cls.default_init_size)]
650 for seed in seeds:
651     seed.release()

File ~/.local/lib/python3.8/site-packages/py2neo/client/__init__.py:649, in (.0)
627 """ Create a new connection pool, with an option to seed one
628 or more initial connections.
629
(...)
646     scheme
647 """
648 pool = cls(profile, user_agent, max_size, max_age, on_broken)
--> 649 seeds = [pool.acquire() for _ in range(init_size or cls.default_init_size)]
650 for seed in seeds:
651     seed.release()

File ~/.local/lib/python3.8/site-packages/py2neo/client/__init__.py:813, in ConnectionPool.acquire(self, force_reset, can_overfill)
807 except IndexError:
808     if self._has_capacity() or can_overfill:
809         # Plan B: if the pool isn't full, open
810         # a new connection. This may raise a
811         # ConnectionUnavailable exception, which
812         # should bubble up to the caller.
--> 813         cx = self._connect()
814         if cx.supports_multi():
815             self._supports_multi = True

File ~/.local/lib/python3.8/site-packages/py2neo/client/__init__.py:764, in ConnectionPool._connect(self)
761 def _connect(self):
762     """ Open and return a new connection.
763     """
--> 764     cx = Connection.open(self.profile, user_agent=self.user_agent,
765                          on_release=lambda c: self.release(c),
766                          on_broken=lambda msg: self.__on_broken(msg))
767     self._server_agent = cx.server_agent
768     return cx

File ~/.local/lib/python3.8/site-packages/py2neo/client/__init__.py:174, in Connection.open(cls, profile, user_agent, on_release, on_broken)
172 if profile.protocol == "bolt":
173     from py2neo.client.bolt import Bolt
--> 174     return Bolt.open(profile, user_agent=user_agent,
175                      on_release=on_release, on_broken=on_broken)
176 elif profile.protocol == "http":
177     from py2neo.client.http import HTTP

File ~/.local/lib/python3.8/site-packages/py2neo/client/bolt.py:364, in Bolt.open(cls, profile, user_agent, on_release, on_broken)
362     return bolt
363 except (TypeError, WireError) as error:
--> 364     raise_from(ConnectionUnavailable("Cannot open connection to %r" % profile), error)

File :3, in raise_from(value, from_value)

ConnectionUnavailable: Cannot open connection to ConnectionProfile('bolt+s://localhost:7687')
Я также пробовал варианты этого исправления, но имел ту же ошибку:
Проблема при подключении py2neo v4 к моему серверу neo4j
Проблема при подключении py2neo v4 к моему серверу neo4j
p>
Я ценю любую помощь в решении этой проблемы. Спасибо!

Подробнее здесь: https://stackoverflow.com/questions/725 ... ionprofile
Реклама
Ответить Пред. темаСлед. тема

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

  • Похожие темы
    Ответы
    Просмотры
    Последнее сообщение

Вернуться в «Python»