cannot load synapser unless I have an internet connection

Description

If I'm not connected to the internet, I can't load synapser:

Environment

None

Activity

Show:
Kara Woo
May 10, 2018, 8:14 PM

I ran into this yesterday as well while trying to work on a plane. I was doing work on a package that depends on synapser but has some functions that don't involve synapser (these are the ones I was working on). Trying to load the package locally with devtools::load_all() or run tests with devtools::test() both fail because somewhere in there they call requireNamespace("synapser").

In python import synapseclient works for me without an internet connection.

Sara Gosline
May 15, 2018, 2:54 AM
Edited

Synapser spits out lots of errors that make it unclear what is happening:

library(synapser)
Loading required package: PythonEmbedInR
Loading required package: R6
Loading required package: rjson
Traceback (most recent call last):

File "/Library/Frameworks/R.framework/Versions/3.4/Resources/library/synapser/lib/python3.5/site-packages/urllib3-1.22-py3.5.egg/urllib3/connection.py", line 141, in _new_conn

(self.host, self.port), self.timeout, **extra_kw)
File "/Library/Frameworks/R.framework/Versions/3.4/Resources/library/synapser/lib/python3.5/site-packages/urllib3-1.22-py3.5.egg/urllib3/util/connection.py", line 60, in create_connection

for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
File "/Library/Frameworks/R.framework/Versions/3.4/Resources/library/PythonEmbedInR/lib/python3.5/socket.py", line 733, in getaddrinfo

for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket
.
gaierror
:
[Errno 8] nodename nor servname provided, or not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File "/Library/Frameworks/R.framework/Versions/3.4/Resources/library/synapser/lib/python3.5/site-packages/urllib3-1.22-py3.5.egg/urllib3/connectionpool.py", line 601, in urlopen

chunked=chunked)
File "/Library/Frameworks/R.framework/Versions/3.4/Resources/library/synapser/lib/python3.5/site-packages/urllib3-1.22-py3.5.egg/urllib3/connectionpool.py", line 346, in _make_request

self._validate_conn(conn)
File "/Library/Frameworks/R.framework/Versions/3.4/Resources/library/synapser/lib/python3.5/site-packages/urllib3-1.22-py3.5.egg/urllib3/connectionpool.py", line 850, in _validate_conn

conn.connect()
File "/Library/Frameworks/R.framework/Versions/3.4/Resources/library/synapser/lib/python3.5/site-packages/urllib3-1.22-py3.5.egg/urllib3/connection.py", line 284, in connect

conn = self._new_conn()
File "/Library/Frameworks/R.framework/Versions/3.4/Resources/library/synapser/lib/python3.5/site-packages/urllib3-1.22-py3.5.egg/urllib3/connection.py", line 150, in _new_conn

self, "Failed to establish a new connection: %s" % e)
urllib3.exceptions
.
NewConnectionError
:
<urllib3.connection.VerifiedHTTPSConnection object at 0x1112649b0>: Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File "/Library/Frameworks/R.framework/Versions/3.4/Resources/library/synapser/lib/python3.5/site-packages/requests-2.18.4-py3.5.egg/requests/adapters.py", line 440, in send

timeout=timeout
File "/Library/Frameworks/R.framework/Versions/3.4/Resources/library/synapser/lib/python3.5/site-packages/urllib3-1.22-py3.5.egg/urllib3/connectionpool.py", line 639, in urlopen

_stacktrace=sys.exc_info()[2])
File "/Library/Frameworks/R.framework/Versions/3.4/Resources/library/synapser/lib/python3.5/site-packages/urllib3-1.22-py3.5.egg/urllib3/util/retry.py", line 388, in increment

raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions
.
MaxRetryError
:
HTTPSConnectionPool(host='repo-prod.prod.sagebase.org', port=443): Max retries exceeded with url: /repo/v1 (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x1112649b0>: Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known',))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File "<string>", line 1, in <module>

File "/Library/Frameworks/R.framework/Versions/3.4/Resources/library/synapser/lib/python3.5/site-packages/synapseclient-1.7.5-py3.5.egg/synapseclient/client.py", line 209, in _init_

self.setEndpoints(repoEndpoint, authEndpoint, fileHandleEndpoint, portalEndpoint, skip_checks)
File "/Library/Frameworks/R.framework/Versions/3.4/Resources/library/synapser/lib/python3.5/site-packages/synapseclient-1.7.5-py3.5.egg/synapseclient/client.py", line 291, in setEndpoints

response = requests.get(endpoints[point], allow_redirects=False, headers=synapseclient.USER_AGENT)
File "/Library/Frameworks/R.framework/Versions/3.4/Resources/library/synapser/lib/python3.5/site-packages/requests-2.18.4-py3.5.egg/requests/api.py", line 72, in get

return request('get', url, params=params, **kwargs)
File "/Library/Frameworks/R.framework/Versions/3.4/Resources/library/synapser/lib/python3.5/site-packages/requests-2.18.4-py3.5.egg/requests/api.py", line 58, in request

return session.request(method=method, url=url, **kwargs)
File "/Library/Frameworks/R.framework/Versions/3.4/Resources/library/synapser/lib/python3.5/site-packages/requests-2.18.4-py3.5.egg/requests/sessions.py", line 508, in request

resp = self.send(prep, **send_kwargs)
File "/Library/Frameworks/R.framework/Versions/3.4/Resources/library/synapser/lib/python3.5/site-packages/requests-2.18.4-py3.5.egg/requests/sessions.py", line 618, in send

r = adapter.send(request, **kwargs)
File "/Library/Frameworks/R.framework/Versions/3.4/Resources/library/synapser/lib/python3.5/site-packages/requests-2.18.4-py3.5.egg/requests/adapters.py", line 508, in send

raise ConnectionError(e, request=request)
requests.exceptions
.
ConnectionError
:
HTTPSConnectionPool(host='repo-prod.prod.sagebase.org', port=443): Max retries exceeded with url: /repo/v1 (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x1112649b0>: Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known',))
Error: package or namespace load failed for ‘synapser’:
.onLoad failed in loadNamespace() for 'synapser', details:
call: pyExec("syn=synapseclient.Synapse()")
error: An error has occurred while executing Python code. See traceback above.

>

Kara Woo
December 10, 2019, 8:25 PM

It looks like this has been fixed and I can now load synapser without an internet connection, however I still get a warning message:

I believe the warning is coming from .checkForUpdate() here:

 

It seems to me that .checkForUpdate() belongs better in .onAttach() than .onLoad() and should be silent if it can’t access the repository, since the warning message is a little confusing and doesn’t interfere with any actual functionality in the package. would you be open to a PR that makes these changes?

 

Bruce Hoff
December 10, 2019, 8:47 PM

> would you be open to a PR that makes these changes?
yes

Jordan Kiang
May 11, 2020, 3:28 PM

Resolved by Kara in

Assignee

Kara Woo

Reporter

Kenneth Daily

Labels

None

Validator

Jordan Kiang

Development Area

None

Release Version History

None

Fix versions

Priority

Minor
Configure