Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Got SSLCertVerificationError when import GeneratorOutput #320

Open
zjffdu opened this issue Jan 23, 2025 · 0 comments · May be fixed by #321
Open

Got SSLCertVerificationError when import GeneratorOutput #320

zjffdu opened this issue Jan 23, 2025 · 0 comments · May be fixed by #321
Labels
bug Something isn't working, either in /adalflow, /tutorials, or /use cases...

Comments

@zjffdu
Copy link
Contributor

zjffdu commented Jan 23, 2025

Bug description

When I import GeneratorOutput, I got the following error. This might due to my system environment, but import GeneratorOutput should not lead such kind of issue as I don't need to call Tokenizer in my code.

Traceback (most recent call last):
  File "/Users/jianfezhang/github/metadata-repo/data-discovery-exp/dde/llm/knowledge/glossary_term_extractor.py", line 4, in <module>
    from adalflow import DataClassParser, GeneratorOutput
  File "/Users/jianfezhang/github/metadata-repo/data-discovery-exp/.venv/lib/python3.11/site-packages/adalflow/__init__.py", line 67, in <module>
    from adalflow.components.data_process.text_splitter import TextSplitter
  File "/Users/jianfezhang/github/metadata-repo/data-discovery-exp/.venv/lib/python3.11/site-packages/adalflow/components/data_process/__init__.py", line 3, in <module>
    from .text_splitter import TextSplitter
  File "/Users/jianfezhang/github/metadata-repo/data-discovery-exp/.venv/lib/python3.11/site-packages/adalflow/components/data_process/text_splitter.py", line 46, in <module>
    tokenizer = Tokenizer()
                ^^^^^^^^^^^
  File "/Users/jianfezhang/github/metadata-repo/data-discovery-exp/.venv/lib/python3.11/site-packages/adalflow/core/tokenizer.py", line 25, in __init__
    self.tokenizer = tiktoken.get_encoding(name)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jianfezhang/github/metadata-repo/data-discovery-exp/.venv/lib/python3.11/site-packages/tiktoken/registry.py", line 73, in get_encoding
    enc = Encoding(**constructor())
                     ^^^^^^^^^^^^^
  File "/Users/jianfezhang/github/metadata-repo/data-discovery-exp/.venv/lib/python3.11/site-packages/tiktoken_ext/openai_public.py", line 72, in cl100k_base
    mergeable_ranks = load_tiktoken_bpe(
                      ^^^^^^^^^^^^^^^^^^
  File "/Users/jianfezhang/github/metadata-repo/data-discovery-exp/.venv/lib/python3.11/site-packages/tiktoken/load.py", line 147, in load_tiktoken_bpe
    contents = read_file_cached(tiktoken_bpe_file, expected_hash)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jianfezhang/github/metadata-repo/data-discovery-exp/.venv/lib/python3.11/site-packages/tiktoken/load.py", line 64, in read_file_cached
    contents = read_file(blobpath)
               ^^^^^^^^^^^^^^^^^^^
  File "/Users/jianfezhang/github/metadata-repo/data-discovery-exp/.venv/lib/python3.11/site-packages/tiktoken/load.py", line 25, in read_file
    resp = requests.get(blobpath)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jianfezhang/github/metadata-repo/data-discovery-exp/.venv/lib/python3.11/site-packages/requests/api.py", line 73, in get
    return request("get", url, params=params, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jianfezhang/github/metadata-repo/data-discovery-exp/.venv/lib/python3.11/site-packages/requests/api.py", line 59, in request
    return session.request(method=method, url=url, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jianfezhang/github/metadata-repo/data-discovery-exp/.venv/lib/python3.11/site-packages/requests/sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jianfezhang/github/metadata-repo/data-discovery-exp/.venv/lib/python3.11/site-packages/requests/sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jianfezhang/github/metadata-repo/data-discovery-exp/.venv/lib/python3.11/site-packages/requests/adapters.py", line 698, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='openaipublic.blob.core.windows.net', port=443): Max retries exceeded with url: /encodings/cl100k_base.tiktoken (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate in certificate chain (_ssl.c:1006)')))

What version are you seeing the problem on?

0.2.7

How to reproduce the bug

Error messages and logs

Traceback (most recent call last):
  File "/Users/jianfezhang/github/metadata-repo/data-discovery-exp/.venv/lib/python3.11/site-packages/urllib3/connectionpool.py", line 716, in urlopen
    httplib_response = self._make_request(
                       ^^^^^^^^^^^^^^^^^^^
  File "/Users/jianfezhang/github/metadata-repo/data-discovery-exp/.venv/lib/python3.11/site-packages/urllib3/connectionpool.py", line 404, in _make_request
    self._validate_conn(conn)
  File "/Users/jianfezhang/github/metadata-repo/data-discovery-exp/.venv/lib/python3.11/site-packages/urllib3/connectionpool.py", line 1061, in _validate_conn
    conn.connect()
  File "/Users/jianfezhang/github/metadata-repo/data-discovery-exp/.venv/lib/python3.11/site-packages/urllib3/connection.py", line 419, in connect
    self.sock = ssl_wrap_socket(
                ^^^^^^^^^^^^^^^^
  File "/Users/jianfezhang/github/metadata-repo/data-discovery-exp/.venv/lib/python3.11/site-packages/urllib3/util/ssl_.py", line 458, in ssl_wrap_socket
    ssl_sock = _ssl_wrap_socket_impl(
               ^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jianfezhang/github/metadata-repo/data-discovery-exp/.venv/lib/python3.11/site-packages/urllib3/util/ssl_.py", line 502, in _ssl_wrap_socket_impl
    return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/[email protected]/3.11.11/Frameworks/Python.framework/Versions/3.11/lib/python3.11/ssl.py", line 517, in wrap_socket
    return self.sslsocket_class._create(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/[email protected]/3.11.11/Frameworks/Python.framework/Versions/3.11/lib/python3.11/ssl.py", line 1104, in _create
    self.do_handshake()
  File "/usr/local/Cellar/[email protected]/3.11.11/Frameworks/Python.framework/Versions/3.11/lib/python3.11/ssl.py", line 1382, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate in certificate chain (_ssl.c:1006)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/jianfezhang/github/metadata-repo/data-discovery-exp/.venv/lib/python3.11/site-packages/requests/adapters.py", line 667, in send
    resp = conn.urlopen(
           ^^^^^^^^^^^^^
  File "/Users/jianfezhang/github/metadata-repo/data-discovery-exp/.venv/lib/python3.11/site-packages/urllib3/connectionpool.py", line 802, in urlopen
    retries = retries.increment(
              ^^^^^^^^^^^^^^^^^^
  File "/Users/jianfezhang/github/metadata-repo/data-discovery-exp/.venv/lib/python3.11/site-packages/urllib3/util/retry.py", line 594, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='openaipublic.blob.core.windows.net', port=443): Max retries exceeded with url: /encodings/cl100k_base.tiktoken (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate in certificate chain (_ssl.c:1006)')))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/jianfezhang/github/metadata-repo/data-discovery-exp/dde/llm/knowledge/glossary_term_extractor.py", line 4, in <module>
    from adalflow import DataClassParser, GeneratorOutput
  File "/Users/jianfezhang/github/metadata-repo/data-discovery-exp/.venv/lib/python3.11/site-packages/adalflow/__init__.py", line 67, in <module>
    from adalflow.components.data_process.text_splitter import TextSplitter
  File "/Users/jianfezhang/github/metadata-repo/data-discovery-exp/.venv/lib/python3.11/site-packages/adalflow/components/data_process/__init__.py", line 3, in <module>
    from .text_splitter import TextSplitter
  File "/Users/jianfezhang/github/metadata-repo/data-discovery-exp/.venv/lib/python3.11/site-packages/adalflow/components/data_process/text_splitter.py", line 46, in <module>
    tokenizer = Tokenizer()
                ^^^^^^^^^^^
  File "/Users/jianfezhang/github/metadata-repo/data-discovery-exp/.venv/lib/python3.11/site-packages/adalflow/core/tokenizer.py", line 25, in __init__
    self.tokenizer = tiktoken.get_encoding(name)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jianfezhang/github/metadata-repo/data-discovery-exp/.venv/lib/python3.11/site-packages/tiktoken/registry.py", line 73, in get_encoding
    enc = Encoding(**constructor())
                     ^^^^^^^^^^^^^
  File "/Users/jianfezhang/github/metadata-repo/data-discovery-exp/.venv/lib/python3.11/site-packages/tiktoken_ext/openai_public.py", line 72, in cl100k_base
    mergeable_ranks = load_tiktoken_bpe(
                      ^^^^^^^^^^^^^^^^^^
  File "/Users/jianfezhang/github/metadata-repo/data-discovery-exp/.venv/lib/python3.11/site-packages/tiktoken/load.py", line 147, in load_tiktoken_bpe
    contents = read_file_cached(tiktoken_bpe_file, expected_hash)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jianfezhang/github/metadata-repo/data-discovery-exp/.venv/lib/python3.11/site-packages/tiktoken/load.py", line 64, in read_file_cached
    contents = read_file(blobpath)
               ^^^^^^^^^^^^^^^^^^^
  File "/Users/jianfezhang/github/metadata-repo/data-discovery-exp/.venv/lib/python3.11/site-packages/tiktoken/load.py", line 25, in read_file
    resp = requests.get(blobpath)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jianfezhang/github/metadata-repo/data-discovery-exp/.venv/lib/python3.11/site-packages/requests/api.py", line 73, in get
    return request("get", url, params=params, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jianfezhang/github/metadata-repo/data-discovery-exp/.venv/lib/python3.11/site-packages/requests/api.py", line 59, in request
    return session.request(method=method, url=url, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jianfezhang/github/metadata-repo/data-discovery-exp/.venv/lib/python3.11/site-packages/requests/sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jianfezhang/github/metadata-repo/data-discovery-exp/.venv/lib/python3.11/site-packages/requests/sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jianfezhang/github/metadata-repo/data-discovery-exp/.venv/lib/python3.11/site-packages/requests/adapters.py", line 698, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='openaipublic.blob.core.windows.net', port=443): Max retries exceeded with url: /encodings/cl100k_base.tiktoken (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate in certificate chain (_ssl.c:1006)')))

Process finished with exit code 1

Environment

  • OS: [macOS]

More info

No response

@zjffdu zjffdu added the bug Something isn't working, either in /adalflow, /tutorials, or /use cases... label Jan 23, 2025
@zjffdu zjffdu linked a pull request Jan 23, 2025 that will close this issue
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working, either in /adalflow, /tutorials, or /use cases...
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant