Simatwa / python-tgpt

AI Chat in Terminal + Package + REST-API
https://python-tgpt.onrender.com
MIT License
102 stars 15 forks source link

(Linux) I can't install the deb package and the pip package doesn't work #27

Closed sinuso closed 7 months ago

sinuso commented 7 months ago

I have removed the pip packages, the deb version and tried to install the deb package but it gives me an error

:~$ sudo dpkg -i pytgpt-linux-amd64.deb
(Reading database ... 148587 files and directories currently installed.)
Preparing to unpack pytgpt-linux-amd64.deb ...
The file list /usr/lib/pytgpt/entries.txt does not exist. Nothing to do.
Unpacking pytgpt (0.4.0) over (0.4.0) ...

Submit any bug at <https://github.com/Simatwa/python-tgpt/issues/new>
Setting up pytgpt (0.4.0) ...
To get the most out of this script, install it from pypi <pip install python-tgpt>
Submit any bug at https://github.com/Simatwa/python-tgpt/issues/new
Processing triggers for mime-support (3.64ubuntu1) ...

pip install python-tgpt

:~$ pip install python-tgpt
Defaulting to user installation because normal site-packages is not writeable
Collecting python-tgpt
  Using cached python_tgpt-0.4.0-py3-none-any.whl.metadata (19 kB)
Requirement already satisfied: requests==2.28.2 in ./.local/lib/python3.11/site-packages (from python-tgpt) (2.28.2)
Requirement already satisfied: appdirs==1.4.4 in ./.local/lib/python3.11/site-packages (from python-tgpt) (1.4.4)
Requirement already satisfied: pyyaml==6.0.1 in ./.local/lib/python3.11/site-packages (from python-tgpt) (6.0.1)
Requirement already satisfied: charset-normalizer<4,>=2 in ./.local/lib/python3.11/site-packages (from requests==2.28.2->python-tgpt) (3.3.2)
Requirement already satisfied: idna<4,>=2.5 in /usr/lib/python3/dist-packages (from requests==2.28.2->python-tgpt) (2.8)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in ./.local/lib/python3.11/site-packages (from requests==2.28.2->python-tgpt) (1.26.18)
Requirement already satisfied: certifi>=2017.4.17 in ./.local/lib/python3.11/site-packages (from requests==2.28.2->python-tgpt) (2023.11.17)
Using cached python_tgpt-0.4.0-py3-none-any.whl (55 kB)
Installing collected packages: python-tgpt
Successfully installed python-tgpt-0.4.0

pytgpt -v

:~$ pytgpt -v
Traceback (most recent call last):
  File "/home/test/.local/bin/pytgpt", line 5, in <module>
    from pytgpt.console import main
  File "/home/test/.local/lib/python3.11/site-packages/pytgpt/__init__.py", line 2, in <module>
    import g4f
  File "/home/test/.local/lib/python3.11/site-packages/g4f/__init__.py", line 6, in <module>
    from .models   import Model, ModelUtils
  File "/home/test/.local/lib/python3.11/site-packages/g4f/models.py", line 3, in <module>
    from .Provider   import RetryProvider, ProviderType
  File "/home/test/.local/lib/python3.11/site-packages/g4f/Provider/__init__.py", line 7, in <module>
    from .deprecated      import *
  File "/home/test/.local/lib/python3.11/site-packages/g4f/Provider/deprecated/__init__.py", line 18, in <module>
    from .Aibn          import Aibn
  File "/home/test/.local/lib/python3.11/site-packages/g4f/Provider/deprecated/Aibn.py", line 7, in <module>
    from ...requests import StreamSession
  File "/home/test/.local/lib/python3.11/site-packages/g4f/requests.py", line 6, in <module>
    from curl_cffi.requests import Session
  File "/home/test/.local/lib/python3.11/site-packages/curl_cffi/requests/__init__.py", line 29, in <module>
    from .session import AsyncSession, BrowserType, Session
  File "/home/test/.local/lib/python3.11/site-packages/curl_cffi/requests/session.py", line 30, in <module>
    import eventlet.tpool
  File "/home/test/.local/lib/python3.11/site-packages/eventlet/__init__.py", line 6, in <module>
    from eventlet import convenience
  File "/home/test/.local/lib/python3.11/site-packages/eventlet/convenience.py", line 7, in <module>
    from eventlet.green import socket
  File "/home/test/.local/lib/python3.11/site-packages/eventlet/green/socket.py", line 21, in <module>
    from eventlet.support import greendns
  File "/home/test/.local/lib/python3.11/site-packages/eventlet/support/greendns.py", line 78, in <module>
    setattr(dns, pkg, import_patched('dns.' + pkg))
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/test/.local/lib/python3.11/site-packages/eventlet/support/greendns.py", line 60, in import_patched
    return patcher.import_patched(module_name, **modules)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/test/.local/lib/python3.11/site-packages/eventlet/patcher.py", line 132, in import_patched
    return inject(
           ^^^^^^^
  File "/home/test/.local/lib/python3.11/site-packages/eventlet/patcher.py", line 109, in inject
    module = __import__(module_name, {}, {}, module_name.split('.')[:-1])
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/test/.local/lib/python3.11/site-packages/dns/asyncquery.py", line 38, in <module>
    from dns.query import (
  File "/home/test/.local/lib/python3.11/site-packages/dns/query.py", line 64, in <module>
    import httpcore
  File "/home/test/.local/lib/python3.11/site-packages/httpcore/__init__.py", line 1, in <module>
    from ._api import request, stream
  File "/home/test/.local/lib/python3.11/site-packages/httpcore/_api.py", line 5, in <module>
    from ._sync.connection_pool import ConnectionPool
  File "/home/test/.local/lib/python3.11/site-packages/httpcore/_sync/__init__.py", line 1, in <module>
    from .connection import HTTPConnection
  File "/home/test/.local/lib/python3.11/site-packages/httpcore/_sync/connection.py", line 12, in <module>
    from .._synchronization import Lock
  File "/home/test/.local/lib/python3.11/site-packages/httpcore/_synchronization.py", line 11, in <module>
    import trio
  File "/home/test/.local/lib/python3.11/site-packages/trio/__init__.py", line 20, in <module>
    from ._core import TASK_STATUS_IGNORED as TASK_STATUS_IGNORED  # isort: split
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/test/.local/lib/python3.11/site-packages/trio/_core/__init__.py", line 21, in <module>
    from ._local import RunVar, RunVarToken
  File "/home/test/.local/lib/python3.11/site-packages/trio/_core/_local.py", line 9, in <module>
    from . import _run
  File "/home/test/.local/lib/python3.11/site-packages/trio/_core/_run.py", line 2762, in <module>
    from ._io_epoll import (
  File "/home/test/.local/lib/python3.11/site-packages/trio/_core/_io_epoll.py", line 202, in <module>
    class EpollIOManager:
  File "/home/test/.local/lib/python3.11/site-packages/trio/_core/_io_epoll.py", line 203, in EpollIOManager
    _epoll: select.epoll = attr.ib(factory=select.epoll)
                                           ^^^^^^^^^^^^
AttributeError: module 'eventlet.green.select' has no attribute 'epoll'
sameedzahoor commented 7 months ago

That's strange. The pip package works for me. Did you check for a dependency conflict? Try installing in a virtual environment.

Simatwa commented 7 months ago

Thanks for this. Be informed that the .deb package was created on Ubuntu so there might be issue(s) on non-Ubuntu based distros. Most notably the GLIBC related.

In the case of pypi, I'm unable to reproduce the exception on my side. Despite of that, reinstalling the extra dependencies might be of help.

pip install "python-tgpt[all]"
sinuso commented 7 months ago

Thanks for this. Be informed that the .deb package was created on Ubuntu so there might be issue(s) on non-Ubuntu based distros. Most notably the GLIBC related.

In the case of pypi, I'm unable to reproduce the exception on my side. Despite of that, reinstalling the extra dependencies might be of help.

pip install "python-tgpt[all]"

@Simatwa, I am doing it from Ubuntu 20.04.6 LTS (GNU/Linux 5.4.0-170-generic x86_64.

On a virtual machine it seems to work, but I have to install the package with sudo permissions. Without sudo permissions, this is the result after installing without errors:

 :~$ pytgpt -v
Command 'pytgpt' not found, did you mean:
  command 'pygpt' from snap pygpt (2.0.147)
See 'snap info <snapname>' for additional versions.

After installing with sudo, it works correctly on 3 virtual machines.

:~$ pytgpt -v
pytgpt, version 0.4.0
sameedzahoor commented 7 months ago

I did not mean a virtual machine, I meant a virtual python environment like conda or even pipx. You should be able to install it without sudo permissions completely in userspace as long as you have python installed. In order to run the command pytgpt you will need to activate the venv before proceeding.

Simatwa commented 7 months ago

Thanks for this. Be informed that the .deb package was created on Ubuntu so there might be issue(s) on non-Ubuntu based distros. Most notably the GLIBC related. In the case of pypi, I'm unable to reproduce the exception on my side. Despite of that, reinstalling the extra dependencies might be of help.

pip install "python-tgpt[all]"

@Simatwa, I am doing it from Ubuntu 20.04.6 LTS (GNU/Linux 5.4.0-170-generic x86_64.

On a virtual machine it seems to work, but I have to install the package with sudo permissions. Without sudo permissions, this is the result after installing without errors:

 :~$ pytgpt -v
Command 'pytgpt' not found, did you mean:
  command 'pygpt' from snap pygpt (2.0.147)
See 'snap info <snapname>' for additional versions.

After installing with sudo, it works correctly on 3 virtual machines.

:~$ pytgpt -v
pytgpt, version 0.4.0

Will be fixed in the next release currently the startup binary is symbolically linked to system protected directory i.e /usr/bin next release will be linked to /usr/local/bin

Simatwa commented 7 months ago

Unfortunately, no changes will be made in regard to the .deb package installation.

sinuso commented 7 months ago

@Simatwa, Now I have this problem on all my machines. With recently installed virtual machines it works fine. It only happens to me with python-tgpt.

:~$ pip install "python-tgpt[all]"
Defaulting to user installation because normal site-packages is not writeable
ERROR: Ignored the following versions that require a different python version: 0.0.5 Requires-Python >=3.9; 0.0.6 Requires-Python >=3.9; 0.0.7 Requires-Python >=3.9; 0.0.8 Requires-Python >=3.9; 0.0.9 Requires-Python >=3.9; 0.1.0 Requires-Python >=3.9; 0.1.1 Requires-Python >=3.9; 0.1.2 Requires-Python >=3.9; 0.1.3 Requires-Python >=3.9; 0.1.4 Requires-Python >=3.9; 0.2.0 Requires-Python >=3.9; 0.2.1 Requires-Python >=3.9; 0.2.2 Requires-Python >=3.9; 0.2.3 Requires-Python >=3.9; 0.2.4 Requires-Python >=3.9; 0.2.5 Requires-Python >=3.9; 0.2.6 Requires-Python >=3.9; 0.2.7 Requires-Python >=3.9; 0.2.8 Requires-Python >=3.9; 0.2.9 Requires-Python >=3.9; 0.3.0 Requires-Python >=3.9; 0.3.1 Requires-Python >=3.9; 0.3.2 Requires-Python >=3.9; 0.3.3 Requires-Python >=3.9; 0.3.4 Requires-Python >=3.9; 0.3.5 Requires-Python >=3.9; 0.3.6 Requires-Python >=3.9; 0.3.7 Requires-Python >=3.9; 0.3.8 Requires-Python >=3.9; 0.3.9 Requires-Python >=3.9; 0.4.0 Requires-Python >=3.9; 0.4.1 Requires-Python >=3.9; 0.4.2 Requires-Python >=3.9; 0.4.3 Requires-Python >=3.9; 0.4.4 Requires-Python >=3.9; 0.4.5 Requires-Python >=3.9
ERROR: Could not find a version that satisfies the requirement python-tgpt[all] (from versions: none)
ERROR: No matching distribution found for python-tgpt[all]