MaartenGr / MaartenGr/BERTopic

ProxyError: (MaxRetryError("HTTPSConnectionPool(host='huggingface.co', port=443): Max retries exceeded with url: /api/models/sentence-transformers/all-MiniLM-L6-v2 (Caused by ProxyError('Unable to connect to proxy', OSError(0, 'Error')))"), '(Request ID: b09891d9-4b3f-459a-aec9-931fb0cce74a)')

Open
#1,625 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
7.8k
Forks
920
Avg merge
22h 24m
Merged PRs (30d)
5

Description

Could you tell me how to solve this problem
![image](https://github.com/MaartenGr/BERTopic/assets/93305253/47b4d525-920f-4938-afd2-33963a250af1)
Running the above code presents the following problem
Traceback (most recent call last):
File "D:\Anaconda3\envs\dy_berttopic\lib\site-packages\urllib3\connectionpool.py", line 777, in urlopen
self._prepare_proxy(conn)
File "D:\Anaconda3\envs\dy_berttopic\lib\site-packages\urllib3\connectionpool.py", line 1046, in _prepare_proxy
conn.connect()
File "D:\Anaconda3\envs\dy_berttopic\lib\site-packages\urllib3\connection.py", line 619, in connect
self.sock = sock = self._connect_tls_proxy(self.host, sock)
File "D:\Anaconda3\envs\dy_berttopic\lib\site-packages\urllib3\connection.py", line 692, in _connect_tls_proxy
tls_in_tls=False,
File "D:\Anaconda3\envs\dy_berttopic\lib\site-packages\urllib3\connection.py", line 793, in _ssl_wrap_socket_and_match_hostname
tls_in_tls=tls_in_tls,
File "D:\Anaconda3\envs\dy_berttopic\lib\site-packages\urllib3\util\ssl_.py", line 471, in ssl_wrap_socket
ssl_sock = _ssl_wrap_socket_impl(sock, context, tls_in_tls, server_hostname)
File "D:\Anaconda3\envs\dy_berttopic\lib\site-packages\urllib3\util\ssl_.py", line 515, in _ssl_wrap_socket_impl
return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
File "D:\Anaconda3\envs\dy_berttopic\lib\ssl.py", line 423, in wrap_socket
session=session
File "D:\Anaconda3\envs\dy_berttopic\lib\ssl.py", line 870, in _create
self.do_handshake()
File "D:\Anaconda3\envs\dy_berttopic\lib\ssl.py", line 1139, in do_handshake
self._sslobj.do_handshake()
OSError: [Errno 0] Error

The above exception was the direct cause of the following exception:

urllib3.exceptions.ProxyError: ('Unable to connect to proxy', OSError(0, 'Error'))

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "D:\Anaconda3\envs\dy_berttopic\lib\site-packages\requests\adapters.py", line 497, in send
chunked=chunked,
File "D:\Anaconda3\envs\dy_berttopic\lib\site-packages\urllib3\connectionpool.py", line 846, in urlopen
method, url, error=new_e, _pool=self, _stacktrace=sys.exc_info()[2]
File "D:\Anaconda3\envs\dy_berttopic\lib\site-packages\urllib3\util\retry.py", line 515, in increment
raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type]
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='huggingface.co', port=443): Max retries exceeded with url: /api/models/sentence-transformers/all-MiniLM-L6-v2 (Caused by ProxyError('Unable to connect to proxy', OSError(0, 'Error')))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "F:/dy/1BERTopic-master/BERTopic-master/test-quick1.py", line 16, in
topics, probs = topic_model.fit_transform(docs)
File "F:\dy\1BERTopic-master\BERTopic-master\bertopic\_bertopic.py", line 373, in fit_transform
language=self.language)
File "F:\dy\1BERTopic-master\BERTopic-master\bertopic\backend\_utils.py", line 120, in select_backend
return SentenceTransformerBackend("sentence-transformers/all-MiniLM-L6-v2")
File "F:\dy\1BERTopic-master\BERTopic-master\bertopic\backend\_sentencetransformers.py", line 44, in __init__
self.embedding_model = SentenceTransformer(embedding_model)
File "D:\Anaconda3\envs\dy_berttopic\lib\site-packages\sentence_transformers\SentenceTransformer.py", line 92, in __init__
use_auth_token=use_auth_token)
File "D:\Anaconda3\envs\dy_berttopic\lib\site-packages\sentence_transformers\util.py", line 442, in snapshot_download
model_info = _api.model_info(repo_id=repo_id, revision=revision, token=token)
File "D:\Anaconda3\envs\dy_berttopic\lib\site-packages\huggingface_hub\utils\_validators.py", line 118, in _inner_fn
return fn(*args, **kwargs)
File "D:\Anaconda3\envs\dy_berttopic\lib\site-packages\huggingface_hub\hf_api.py", line 1677, in model_info
r = get_session().get(path, headers=headers, timeout=timeout, params=params)
File "D:\Anaconda3\envs\dy_berttopic\lib\site-packages\requests\sessions.py", line 602, in get
return self.request("GET", url, **kwargs)
File "D:\Anaconda3\envs\dy_berttopic\lib\site-packages\requests\sessions.py", line 589, in request
resp = self.send(prep, **send_kwargs)
File "D:\Anaconda3\envs\dy_berttopic\lib\site-packages\requests\sessions.py", line 703, in send
r = adapter.send(request, **kwargs)
File "D:\Anaconda3\envs\dy_berttopic\lib\site-packages\huggingface_hub\utils\_http.py", line 63, in send
return super().send(request, *args, **kwargs)
File "D:\Anaconda3\envs\dy_berttopic\lib\site-packages\requests\adapters.py", line 513, in send
raise ProxyError(e, request=request)
requests.exceptions.ProxyError: (MaxRetryError("HTTPSConnectionPool(host='huggingface.co', port=443): Max retries exceeded with url: /api/models/sentence-transformers/all-MiniLM-L6-v2 (Caused by ProxyError('Unable to connect to proxy', OSError(0, 'Error')))"), '(Request ID: b09891d9-4b3f-459a-aec9-931fb0cce74a)')
I've set up a proxy server

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the provided script and trace the model-loading path through bertopic/backend/_utils.py and bertopic/backend/_sentencetransformers.py. Check whether the failure is project-specific or limited to the proxy connection to huggingface.co; done requires a reproducible diagnosis or documented resolution.

Written by the indexing model from the issue text.

Assessment

Tech stack
huggingface, python
Domain
machine-learning, networking
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
15/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.