labteral / chatgpt-python

Unofficial Python SDK for OpenAI's ChatGPT

Home Page:https://labteral.github.io/chatgpt-python/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

OSError

SilkePilon opened this issue · comments

Got the following error when running the example code:
OSError: /usr/local/lib/python3.10/dist-packages/tls_client/dependencies/tls-client-amd64.so: cannot open shared object file: No such file or directory

Traceback (most recent call last):
  File "/usr/lib/python3.10/runpy.py", line 187, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "/usr/lib/python3.10/runpy.py", line 146, in _get_module_details
    return _get_module_details(pkg_main_name, error)
  File "/usr/lib/python3.10/runpy.py", line 110, in _get_module_details
    __import__(pkg_name)
  File "/usr/local/lib/python3.10/dist-packages/chatgpt/__init__.py", line 4, in <module>
    from .chatgpt import *
  File "/usr/local/lib/python3.10/dist-packages/chatgpt/chatgpt.py", line 10, in <module>
    from chatgpt.authentication import OpenAIAuthentication
  File "/usr/local/lib/python3.10/dist-packages/chatgpt/authentication.py", line 4, in <module>
    from chatgpt.sessions import HTTPTLSSession
  File "/usr/local/lib/python3.10/dist-packages/chatgpt/sessions.py", line 2, in <module>
    import tls_client
  File "/usr/local/lib/python3.10/dist-packages/tls_client/__init__.py", line 15, in <module>
    from .sessions import Session
  File "/usr/local/lib/python3.10/dist-packages/tls_client/sessions.py", line 1, in <module>
    from .cffi import request
  File "/usr/local/lib/python3.10/dist-packages/tls_client/cffi.py", line 15, in <module>
    library = ctypes.cdll.LoadLibrary(f'{root_dir}/dependencies/tls-client{file_ext}')
  File "/usr/lib/python3.10/ctypes/__init__.py", line 452, in LoadLibrary
    return self._dlltype(name)
  File "/usr/lib/python3.10/ctypes/__init__.py", line 374, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: /usr/local/lib/python3.10/dist-packages/tls_client/dependencies/tls-client-amd64.so: cannot open shared object file: No such file or directory

note that this is on linux

commented

Getting the same issue with docker python:3.11-slim

commented

I changed my Dockerfile to this and it fixed the issue

# For more information, please refer to https://aka.ms/vscode-docker-python
FROM --platform=linux/amd64 python:3.11

# Keeps Python from generating .pyc files in the container
ENV PYTHONDONTWRITEBYTECODE=1

# Turns off buffering for easier container logging
ENV PYTHONUNBUFFERED=1

# Install pip requirements
COPY requirements.txt .
RUN python -m pip install -r requirements.txt
RUN apt-get update && apt-get install -y --no-install-recommends git vim gnupg wget 

RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
RUN sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
RUN apt-get update -qqy --no-install-recommends && apt-get install -qqy --no-install-recommends google-chrome-stable

WORKDIR /app
COPY . /app

# Creates a non-root user with an explicit UID and adds permission to access the /app folder
# For more info, please refer to https://aka.ms/vscode-docker-python-configure-containers
RUN adduser -u 5678 --disabled-password --gecos "" appuser && chown -R appuser /app
USER appuser

# During debugging, this entry point will be overridden. For more information, please refer to https://aka.ms/vscode-docker-python-debug
CMD ["python", "-m", "app.py"]

I believe this issue comes from not having a browser installed