ontobio
ontobio copied to clipboard
Use behind proxy
I'm trying to use ontobio behind a proxy but when importing package with
from ontobio.ontol_factory import OntologyFactory
I get the following error (note that I do no get that when no proxy is used):
Traceback (most recent call last):
File "<path_to_project>/venv/lib/python3.8/site-packages/urllib3/connection.py", line 169, in _new_conn
conn = connection.create_connection(
File "<path_to_project>/venv/lib/python3.8/site-packages/urllib3/util/connection.py", line 96, in create_connection
raise err
File "<path_to_project>/venv/lib/python3.8/site-packages/urllib3/util/connection.py", line 86, in create_connection
sock.connect(sa)
TimeoutError: [Errno 110] Connection timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<path_to_project>/venv/lib/python3.8/site-packages/urllib3/connectionpool.py", line 699, in urlopen
httplib_response = self._make_request(
File "<path_to_project>/venv/lib/python3.8/site-packages/urllib3/connectionpool.py", line 382, in _make_request
self._validate_conn(conn)
File "<path_to_project>/venv/lib/python3.8/site-packages/urllib3/connectionpool.py", line 1010, in _validate_conn
conn.connect()
File "<path_to_project>/venv/lib/python3.8/site-packages/urllib3/connection.py", line 353, in connect
conn = self._new_conn()
File "<path_to_project>/venv/lib/python3.8/site-packages/urllib3/connection.py", line 181, in _new_conn
raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x7fe09119df70>: Failed to establish a new connection: [Errno 110] Connection timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<path_to_project>/venv/lib/python3.8/site-packages/requests/adapters.py", line 439, in send
resp = conn.urlopen(
File "<path_to_project>/venv/lib/python3.8/site-packages/urllib3/connectionpool.py", line 755, in urlopen
retries = retries.increment(
File "<path_to_project>/venv/lib/python3.8/site-packages/urllib3/util/retry.py", line 573, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='raw.githubusercontent.com', port=443): Max retries exceeded with url: /prefixcommons/biocontext/master/registry/monarch_context.jsonld (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7fe09119df70>: Failed to establish a new connection: [Errno 110] Connection timed out'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "/snap/pycharm-community/226/plugins/python-ce/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "<path_to_project>/venv/lib/python3.8/site-packages/ontobio/__init__.py", line 6, in <module>
from .ontol_factory import OntologyFactory
File "/snap/pycharm-community/226/plugins/python-ce/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "<path_to_project>/venv/lib/python3.8/site-packages/ontobio/ontol_factory.py", line 7, in <module>
import ontobio.obograph_util as obograph_util
File "/snap/pycharm-community/226/plugins/python-ce/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "<path_to_project>/venv/lib/python3.8/site-packages/ontobio/obograph_util.py", line 8, in <module>
from ontobio.golr.golr_associations import search_associations
File "/snap/pycharm-community/226/plugins/python-ce/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "<path_to_project>/venv/lib/python3.8/site-packages/ontobio/golr/golr_associations.py", line 13, in <module>
from ontobio.golr.golr_query import *
File "/snap/pycharm-community/226/plugins/python-ce/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "<path_to_project>/venv/lib/python3.8/site-packages/ontobio/golr/golr_query.py", line 49, in <module>
from prefixcommons.curie_util import expand_uri
File "/snap/pycharm-community/226/plugins/python-ce/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "<path_to_project>/venv/lib/python3.8/site-packages/prefixcommons/__init__.py", line 4, in <module>
from .curie_util import expand_uri, contract_uri, NoPrefix
File "/snap/pycharm-community/226/plugins/python-ce/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "<path_to_project>/venv/lib/python3.8/site-packages/prefixcommons/curie_util.py", line 79, in <module>
default_curie_maps = [read_biocontext('monarch_context'),read_biocontext('obo_context')]
File "<path_to_project>/venv/lib/python3.8/site-packages/prefixcommons/curie_util.py", line 75, in read_biocontext
return read_remote_jsonld_context("https://raw.githubusercontent.com/prefixcommons/biocontext/master/registry/"+name+".jsonld")
File "<path_to_project>/venv/lib/python3.8/site-packages/prefixcommons/curie_util.py", line 56, in read_remote_jsonld_context
with closing(requests.get(url, stream=False)) as resp:
File "<path_to_project>/venv/lib/python3.8/site-packages/requests/api.py", line 76, in get
return request('get', url, params=params, **kwargs)
File "<path_to_project>/venv/lib/python3.8/site-packages/requests/api.py", line 61, in request
return session.request(method=method, url=url, **kwargs)
File "<path_to_project>/venv/lib/python3.8/site-packages/requests/sessions.py", line 542, in request
resp = self.send(prep, **send_kwargs)
File "<path_to_project>/venv/lib/python3.8/site-packages/requests/sessions.py", line 655, in send
r = adapter.send(request, **kwargs)
File "<path_to_project>/venv/lib/python3.8/site-packages/requests/adapters.py", line 516, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='raw.githubusercontent.com', port=443): Max retries exceeded with url: /prefixcommons/biocontext/master/registry/monarch_context.jsonld (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7fe09119df70>: Failed to establish a new connection: [Errno 110] Connection timed out'))
Bumping this issue as it currently also prevents use of this package on compute cluster nodes that lack internet access. Ideally, this package should be able to get imported without the need for downloading external data (e.g., if we plan to use local ".obo" files).
I'll echo this issue. I am using two local obojson ontology files in order to do lexical mapping, so getting connection errors is not making much sense when I just need to make some ofactory/afactory objects.