run-llama / llama-hub

A library of data loaders for LLMs made by the community -- to be used with LlamaIndex and/or LangChain
https://llamahub.ai/
MIT License
3.44k stars 731 forks source link

[Bug]: Llamahub.ai integrations appear blank & API gives Timeout error #813

Closed jayita13 closed 8 months ago

jayita13 commented 8 months ago

Bug Description

image image

Version

llama-index==0.9.21

Steps to Reproduce

Go on to https://llamahub.ai/ and open any integration or try hitting from API

Relevant Logs/Tracbacks

{
    "name": "ConnectTimeout",
    "message": "HTTPSConnectionPool(host='raw.githubusercontent.com', port=443): Max retries exceeded with url: /run-llama/llama-hub/main/llama_hub/library.json (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x0000026477F0BB50>, 'Connection to raw.githubusercontent.com timed out. (connect timeout=None)'))",
    "stack": "---------------------------------------------------------------------------
TimeoutError                              Traceback (most recent call last)
File c:\\Users\\jayit\\GlobeHopper\\venv\\lib\\site-packages\\urllib3\\connection.py:174, in HTTPConnection._new_conn(self)
    173 try:
--> 174     conn = connection.create_connection(
    175         (self._dns_host, self.port), self.timeout, **extra_kw
    176     )
    178 except SocketTimeout:

File c:\\Users\\jayit\\GlobeHopper\\venv\\lib\\site-packages\\urllib3\\util\\connection.py:95, in create_connection(address, timeout, source_address, socket_options)
     94 if err is not None:
---> 95     raise err
     97 raise socket.error(\"getaddrinfo returns an empty list\")

File c:\\Users\\jayit\\GlobeHopper\\venv\\lib\\site-packages\\urllib3\\util\\connection.py:85, in create_connection(address, timeout, source_address, socket_options)
     84     sock.bind(source_address)
---> 85 sock.connect(sa)
     86 return sock

TimeoutError: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond

During handling of the above exception, another exception occurred:

ConnectTimeoutError                       Traceback (most recent call last)
File c:\\Users\\jayit\\GlobeHopper\\venv\\lib\\site-packages\\urllib3\\connectionpool.py:715, in HTTPConnectionPool.urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw)
    714 # Make the request on the httplib connection object.
--> 715 httplib_response = self._make_request(
    716     conn,
    717     method,
    718     url,
    719     timeout=timeout_obj,
    720     body=body,
    721     headers=headers,
    722     chunked=chunked,
    723 )
    725 # If we're going to release the connection in ``finally:``, then
    726 # the response doesn't need to know about the connection. Otherwise
    727 # it will also try to release it and we'll have a double-release
    728 # mess.

File c:\\Users\\jayit\\GlobeHopper\\venv\\lib\\site-packages\\urllib3\\connectionpool.py:404, in HTTPConnectionPool._make_request(self, conn, method, url, timeout, chunked, **httplib_request_kw)
    403 try:
--> 404     self._validate_conn(conn)
    405 except (SocketTimeout, BaseSSLError) as e:
    406     # Py2 raises this as a BaseSSLError, Py3 raises it as socket timeout.

File c:\\Users\\jayit\\GlobeHopper\\venv\\lib\\site-packages\\urllib3\\connectionpool.py:1058, in HTTPSConnectionPool._validate_conn(self, conn)
   1057 if not getattr(conn, \"sock\", None):  # AppEngine might not have  `.sock`
-> 1058     conn.connect()
   1060 if not conn.is_verified:

File c:\\Users\\jayit\\GlobeHopper\\venv\\lib\\site-packages\\urllib3\\connection.py:363, in HTTPSConnection.connect(self)
    361 def connect(self):
    362     # Add certificate verification
--> 363     self.sock = conn = self._new_conn()
    364     hostname = self.host

File c:\\Users\\jayit\\GlobeHopper\\venv\\lib\\site-packages\\urllib3\\connection.py:179, in HTTPConnection._new_conn(self)
    178 except SocketTimeout:
--> 179     raise ConnectTimeoutError(
    180         self,
    181         \"Connection to %s timed out. (connect timeout=%s)\"
    182         % (self.host, self.timeout),
    183     )
    185 except SocketError as e:

ConnectTimeoutError: (<urllib3.connection.HTTPSConnection object at 0x0000026477F0BB50>, 'Connection to raw.githubusercontent.com timed out. (connect timeout=None)')

During handling of the above exception, another exception occurred:

MaxRetryError                             Traceback (most recent call last)
File c:\\Users\\jayit\\GlobeHopper\\venv\\lib\\site-packages\\requests\\adapters.py:486, in HTTPAdapter.send(self, request, stream, timeout, verify, cert, proxies)
    485 try:
--> 486     resp = conn.urlopen(
    487         method=request.method,
    488         url=url,
    489         body=request.body,
    490         headers=request.headers,
    491         redirect=False,
    492         assert_same_host=False,
    493         preload_content=False,
    494         decode_content=False,
    495         retries=self.max_retries,
    496         timeout=timeout,
    497         chunked=chunked,
    498     )
    500 except (ProtocolError, OSError) as err:

File c:\\Users\\jayit\\GlobeHopper\\venv\\lib\\site-packages\\urllib3\\connectionpool.py:799, in HTTPConnectionPool.urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw)
    797     e = ProtocolError(\"Connection aborted.\", e)
--> 799 retries = retries.increment(
    800     method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
    801 )
    802 retries.sleep()

File c:\\Users\\jayit\\GlobeHopper\\venv\\lib\\site-packages\\urllib3\\util\\retry.py:592, in Retry.increment(self, method, url, response, error, _pool, _stacktrace)
    591 if new_retry.is_exhausted():
--> 592     raise MaxRetryError(_pool, url, error or ResponseError(cause))
    594 log.debug(\"Incremented Retry for (url='%s'): %r\", url, new_retry)

MaxRetryError: HTTPSConnectionPool(host='raw.githubusercontent.com', port=443): Max retries exceeded with url: /run-llama/llama-hub/main/llama_hub/library.json (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x0000026477F0BB50>, 'Connection to raw.githubusercontent.com timed out. (connect timeout=None)'))

During handling of the above exception, another exception occurred:

ConnectTimeout                            Traceback (most recent call last)
Cell In[4], line 4
      1 from pathlib import Path
      2 from llama_index import download_loader
----> 4 SimpleCSVReader = download_loader(\"SimpleCSVReader\")
      6 loader = SimpleCSVReader(encoding=\"utf-8\", concat_rows=False)
      7 documents = loader.load_data(file=Path('./data/hotels_50_entries_countries.csv'))

File c:\\Users\\jayit\\GlobeHopper\\venv\\lib\\site-packages\\llama_index\\readers\\download.py:49, in download_loader(loader_class, loader_hub_url, refresh_cache, use_gpt_index_import, custom_path)
     46 else:
     47     custom_dir = \"llamahub_modules\"
---> 49 reader_cls = download_llama_module(
     50     loader_class,
     51     llama_hub_url=loader_hub_url,
     52     refresh_cache=refresh_cache,
     53     custom_dir=custom_dir,
     54     custom_path=custom_path,
     55     use_gpt_index_import=use_gpt_index_import,
     56 )
     57 if not issubclass(reader_cls, BaseReader):
     58     raise ValueError(
     59         f\"Loader class {loader_class} must be a subclass of BaseReader.\"
     60     )

File c:\\Users\\jayit\\GlobeHopper\\venv\\lib\\site-packages\\llama_index\\download\\module.py:216, in download_llama_module(module_class, llama_hub_url, refresh_cache, custom_dir, custom_path, library_path, base_file_name, use_gpt_index_import, disable_library_cache, override_path)
    213 dirpath = initialize_directory(custom_path=custom_path, custom_dir=custom_dir)
    215 # fetch info from library.json file
--> 216 module_info = get_module_info(
    217     local_dir_path=dirpath,
    218     remote_dir_path=llama_hub_url,
    219     module_class=module_class,
    220     refresh_cache=refresh_cache,
    221     library_path=library_path,
    222     disable_library_cache=disable_library_cache,
    223 )
    224 module_id = module_info[\"module_id\"]
    225 extra_files = module_info[\"extra_files\"]

File c:\\Users\\jayit\\GlobeHopper\\venv\\lib\\site-packages\\llama_index\\download\\module.py:66, in get_module_info(local_dir_path, remote_dir_path, module_class, refresh_cache, library_path, disable_library_cache)
     64 # Fetch up-to-date library from remote repo if module_id not found
     65 if module_id is None:
---> 66     library_raw_content, _ = get_file_content(
     67         str(remote_dir_path), f\"/{library_path}\"
     68     )
     69     library = json.loads(library_raw_content)
     70     if module_class not in library:

File c:\\Users\\jayit\\GlobeHopper\\venv\\lib\\site-packages\\llama_index\\download\\utils.py:10, in get_file_content(url, path)
      8 def get_file_content(url: str, path: str) -> Tuple[str, int]:
      9     \"\"\"Get the content of a file from the GitHub REST API.\"\"\"
---> 10     resp = requests.get(url + path)
     11     return resp.text, resp.status_code

File c:\\Users\\jayit\\GlobeHopper\\venv\\lib\\site-packages\\requests\\api.py:73, in get(url, params, **kwargs)
     62 def get(url, params=None, **kwargs):
     63     r\"\"\"Sends a GET request.
     64 
     65     :param url: URL for the new :class:`Request` object.
   (...)
     70     :rtype: requests.Response
     71     \"\"\"
---> 73     return request(\"get\", url, params=params, **kwargs)

File c:\\Users\\jayit\\GlobeHopper\\venv\\lib\\site-packages\\requests\\api.py:59, in request(method, url, **kwargs)
     55 # By using the 'with' statement we are sure the session is closed, thus we
     56 # avoid leaving sockets open which can trigger a ResourceWarning in some
     57 # cases, and look like a memory leak in others.
     58 with sessions.Session() as session:
---> 59     return session.request(method=method, url=url, **kwargs)

File c:\\Users\\jayit\\GlobeHopper\\venv\\lib\\site-packages\\requests\\sessions.py:589, in Session.request(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, json)
    584 send_kwargs = {
    585     \"timeout\": timeout,
    586     \"allow_redirects\": allow_redirects,
    587 }
    588 send_kwargs.update(settings)
--> 589 resp = self.send(prep, **send_kwargs)
    591 return resp

File c:\\Users\\jayit\\GlobeHopper\\venv\\lib\\site-packages\\requests\\sessions.py:703, in Session.send(self, request, **kwargs)
    700 start = preferred_clock()
    702 # Send the request
--> 703 r = adapter.send(request, **kwargs)
    705 # Total elapsed time of the request (approximately)
    706 elapsed = preferred_clock() - start

File c:\\Users\\jayit\\GlobeHopper\\venv\\lib\\site-packages\\requests\\adapters.py:507, in HTTPAdapter.send(self, request, stream, timeout, verify, cert, proxies)
    504 if isinstance(e.reason, ConnectTimeoutError):
    505     # TODO: Remove this in 3.0.0: see #2811
    506     if not isinstance(e.reason, NewConnectionError):
--> 507         raise ConnectTimeout(e, request=request)
    509 if isinstance(e.reason, ResponseError):
    510     raise RetryError(e, request=request)

ConnectTimeout: HTTPSConnectionPool(host='raw.githubusercontent.com', port=443): Max retries exceeded with url: /run-llama/llama-hub/main/llama_hub/library.json (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x0000026477F0BB50>, 'Connection to raw.githubusercontent.com timed out. (connect timeout=None)'))"
}
anoopshrma commented 8 months ago

Hi @jayita13 ! Working at my end, Can you try now one more time?

jayita13 commented 8 months ago

Hi @anoopshrma Thanks. Tried out just now, it's still the same. image not sure if I'm missing out on anything have pip install llama-hub as well

anoopshrma commented 8 months ago

Worked for me with same code as well image

Maybe your Internet service provider is blocking certain requests

jayita13 commented 8 months ago

thats strange! Could you suggest any workaround for this? Should I setup proxy server settings?

anoopshrma commented 8 months ago

thats strange! Could you suggest any workaround for this? Should I setup proxy server settings?

If you are using a wifi try using a different network once!

jayita13 commented 8 months ago

@anoopshrma thanks for the support. Strangely it worked after changing my network!

jayita13 commented 8 months ago

got resolved after switching network