Ubuntu 如何在Google Colab上安装Cytoscape?

Ubuntu 如何在Google Colab上安装Cytoscape?,ubuntu,google-colaboratory,cytoscape,Ubuntu,Google Colaboratory,Cytoscape,我想在Google Colab上使用Cytoscape.js()。我在这里发现()这可以在Jupyter笔记本中完成,但是文档不是很完整 以下是我尝试设置Cytoscape和CyREST的代码(将每个代码块粘贴到Google Colab中的单独单元格中): 这给了我以下错误: --------------------------------------------------------------------------- ConnectionRefusedError

我想在Google Colab上使用Cytoscape.js()。我在这里发现()这可以在Jupyter笔记本中完成,但是文档不是很完整

以下是我尝试设置Cytoscape和CyREST的代码(将每个代码块粘贴到Google Colab中的单独单元格中):

这给了我以下错误:

---------------------------------------------------------------------------
ConnectionRefusedError                    Traceback (most recent call last)
/usr/local/lib/python3.6/dist-packages/urllib3/connection.py in _new_conn(self)
    158             conn = connection.create_connection(
--> 159                 (self._dns_host, self.port), self.timeout, **extra_kw)
    160 

23 frames
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

NewConnectionError                        Traceback (most recent call last)
NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7f822bd80860>: Failed to establish a new connection: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

MaxRetryError                             Traceback (most recent call last)
MaxRetryError: HTTPConnectionPool(host='localhost', port=1234): Max retries exceeded with url: /v1/styles/visualproperties (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f822bd80860>: Failed to establish a new connection: [Errno 111] Connection refused',))

During handling of the above exception, another exception occurred:

ConnectionError                           Traceback (most recent call last)
/usr/local/lib/python3.6/dist-packages/requests/adapters.py in send(self, request, stream, timeout, verify, cert, proxies)
    514                 raise SSLError(e, request=request)
    515 
--> 516             raise ConnectionError(e, request=request)
    517 
    518         except ClosedPoolError as e:

ConnectionError: HTTPConnectionPool(host='localhost', port=1234): Max retries exceeded with url: /v1/styles/visualproperties (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f822bd80860>: Failed to establish a new connection: [Errno 111] Connection refused',))

我猜这是Google Colab Ubuntu环境中的端口存在的问题,但我不确定如何解决它。

对于遇到此问题的任何其他人,我了解到,与使用此方法不同,更简单的方法是使用
ipycytoscape
,这使得运行一切变得更加容易

然而,这种方法和我在问题中描述的方法的问题是,Cytoscape依赖于一些IPyWidget进行输出,而Google Colab还不支持这些


您可以在此处跟踪此问题的进度:

您尝试了什么,遇到了什么错误?
# Start Cytoscape
!Cytoscape &

from py2cytoscape.data.cyrest_client import CyRestClient

cy = CyRestClient()
network = cy.network.create(name='My Network', collection='My network collection')
print(network.get_id())
---------------------------------------------------------------------------
ConnectionRefusedError                    Traceback (most recent call last)
/usr/local/lib/python3.6/dist-packages/urllib3/connection.py in _new_conn(self)
    158             conn = connection.create_connection(
--> 159                 (self._dns_host, self.port), self.timeout, **extra_kw)
    160 

23 frames
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

NewConnectionError                        Traceback (most recent call last)
NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7f822bd80860>: Failed to establish a new connection: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

MaxRetryError                             Traceback (most recent call last)
MaxRetryError: HTTPConnectionPool(host='localhost', port=1234): Max retries exceeded with url: /v1/styles/visualproperties (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f822bd80860>: Failed to establish a new connection: [Errno 111] Connection refused',))

During handling of the above exception, another exception occurred:

ConnectionError                           Traceback (most recent call last)
/usr/local/lib/python3.6/dist-packages/requests/adapters.py in send(self, request, stream, timeout, verify, cert, proxies)
    514                 raise SSLError(e, request=request)
    515 
--> 516             raise ConnectionError(e, request=request)
    517 
    518         except ClosedPoolError as e:

ConnectionError: HTTPConnectionPool(host='localhost', port=1234): Max retries exceeded with url: /v1/styles/visualproperties (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f822bd80860>: Failed to establish a new connection: [Errno 111] Connection refused',))
REST_PORT = '1234' # Set to whatever rest.port is in Cytoscape preferences
REST_ENDPOINT = "http://localhost:{}/v1".format(REST_PORT)
import requests
import json
import os
from urllib.request import urlretrieve
from IPython.display import Image, display, HTML

response = requests.get(REST_ENDPOINT)
js_resp = response.json()
assert js_resp['apiVersion'] == 'v1', \
    "This notebook uses CyREST API v1, but version {} was found.".format(js_resp['apiVersion'])

print("CyREST v1 is running!")