macosautomationcytoscape

Cytoscape Automation - RequestException: Cannot find local or remote Cytoscape. Start Cytoscape and then proceed


I cannot connect to Cytoscape from Cytoscape Automation script in Google Colab on MacOS(arm64).

Using the Overview-of-py4cytoscape.ipynb example file to diagnose the issue. It works on my Windows 11 PC, but I cannot get it working on my MacBook(ARM).

Cytoscape About information: Version: 3.10.1 Java: 17.0.5 by Eclipse Adoptium Java Home: /Applications/Cytoscape_v3.10.1/.install4j/jre.bundle/Contents/Home OS: Mac OS X 14.1.1 - aarch64

The Cytoscape application starts on MacOS just fine.

But I keep getting this error message in Colab when trying to ping the Cytoscape program running locally using the p4c.cytoscape_version_info() function:

RequestException                          Traceback (most recent call last)
<ipython-input-3-aac4e79c4feb> in <cell line: 1>()
----> 1 p4c.cytoscape_version_info()

9 frames
/usr/local/lib/python3.10/dist-packages/py4cytoscape/py4cytoscape_logger.py in wrapper_log(*args, **kwargs)
    131             return log_return(func, value)
    132         except Exception as e:
--> 133             log_exception(func, e)
    134         finally:
    135             log_finally()

/usr/local/lib/python3.10/dist-packages/py4cytoscape/py4cytoscape_logger.py in wrapper_log(*args, **kwargs)
    128         log_incoming(func, *args, **kwargs)
    129         try:
--> 130             value = func(*args, **kwargs) # Call function being logged
    131             return log_return(func, value)
    132         except Exception as e:

/usr/local/lib/python3.10/dist-packages/py4cytoscape/cytoscape_system.py in cytoscape_version_info(base_url)
     79         {'apiVersion': 'v1', 'cytoscapeVersion': '3.8.1', 'automationAPIVersion': '0.0.0', 'py4cytoscapeVersion': '0.0.2'}
     80     """
---> 81     versions = commands.cyrest_get('version', base_url=base_url)
     82     if len(versions) == 0:
     83         raise CyError('CyREST connection problem. py4cytoscape cannot continue!')

/usr/local/lib/python3.10/dist-packages/py4cytoscape/py4cytoscape_logger.py in wrapper_log(*args, **kwargs)
    131             return log_return(func, value)
    132         except Exception as e:
--> 133             log_exception(func, e)
    134         finally:
    135             log_finally()

/usr/local/lib/python3.10/dist-packages/py4cytoscape/py4cytoscape_logger.py in wrapper_log(*args, **kwargs)
    128         log_incoming(func, *args, **kwargs)
    129         try:
--> 130             value = func(*args, **kwargs) # Call function being logged
    131             return log_return(func, value)
    132         except Exception as e:

/usr/local/lib/python3.10/dist-packages/py4cytoscape/commands.py in cyrest_get(operation, parameters, base_url, require_json, raw_get)
    157                 return r.text
    158     except requests.exceptions.RequestException as e:
--> 159         _handle_error(e)
    160 
    161 

/usr/local/lib/python3.10/dist-packages/py4cytoscape/commands.py in cyrest_get(operation, parameters, base_url, require_json, raw_get)
    147     try:
    148         url = build_url(base_url, operation)
--> 149         r = _do_request('GET', url, params=parameters, base_url=base_url, raw_request=raw_get)
    150         r.raise_for_status()
    151         try:

/usr/local/lib/python3.10/dist-packages/py4cytoscape/commands.py in _do_request(method, url, base_url, raw_request, **kwargs)
    693 def _do_request(method, url, base_url=DEFAULT_BASE_URL, raw_request=False, **kwargs):
    694     # Determine whether actual call is local or remote
--> 695     requester, default_sandbox = _get_requester(base_url)
    696 
    697     if not raw_request:

/usr/local/lib/python3.10/dist-packages/py4cytoscape/commands.py in _get_requester(base_url)
    777 def _get_requester(base_url):
    778     # Figure out whether CyREST available only via Jupyter-Bridge and what the default sandbox should be
--> 779     environment = _find_execution_environment(base_url)
    780     if environment == ExecutionEnvironment.REMOTE_JUPYTER_BRIDGE:
    781         default_sandbox = set_default_sandbox(**sandbox_initializer(sandboxName=PREDEFINED_SANDBOX_NAME))

/usr/local/lib/python3.10/dist-packages/py4cytoscape/commands.py in _find_execution_environment(base_url)
    801     environment = check_execution_environment(base_url)
    802     if environment == ExecutionEnvironment.UNKNOWN:
--> 803         raise requests.exceptions.RequestException('Cannot find local or remote Cytoscape. Start Cytoscape and then proceed.')
    804     return environment

RequestException: Cannot find local or remote Cytoscape. Start Cytoscape and then proceed.

I have followed the troubleshooting guide and used the system checker script. It said JAVA_HOME was not found, so I followed the steps in the "Common Issues" page for setting up JAVA_HOME.

If anyone can help me with this or direct me to another post with a solution I would greatly appreciate it.


Solution

  • It turns out the issue had to do with using Colab on the Safari browser.

    I switched to Chrome and it work now.