cher-nov / cryptg

Official Telethon extension to provide much faster cryptography for Telegram API requests.
https://pypi.org/project/cryptg/
Creative Commons Zero v1.0 Universal
75 stars 24 forks source link

Unable to install on Termux and Linux Deploy #6

Open Talmio216 opened 3 years ago

Talmio216 commented 3 years ago

Have been using tgcloud on my old computer (Linux Mint Tricia, x86) for a couple of months. For better experience, decided to install it both on my Xiaomi phone (Termux app) and Lenovo tablet (Linux Deploy app). However, the normal installation of cryptg through pip install cryptg failed both times, giving this error log:

Collecting cryptg
  Using cached cryptg-0.2.post0.tar.gz (16 kB)
    ERROR: Command errored out with exit status 1:
     command: /data/data/com.termux/files/usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/data/data/com.termux/files/usr/tmp/pip-install-q9103x19/cryptg/setup.py'"'"'; __file__='"'"'/data/data/com.termux/files/usr/tmp/pip-install-q9103x19/cryptg/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /data/data/com.termux/files/usr/tmp/pip-pip-egg-info-n729x67v
         cwd: /data/data/com.termux/files/usr/tmp/pip-install-q9103x19/cryptg/
    Complete output (46 lines):
    WARNING: The wheel package is not available.
      ERROR: Command errored out with exit status 1:
       command: /data/data/com.termux/files/usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/data/data/com.termux/files/usr/tmp/pip-wheel-pejbf0zb/cffi/setup.py'"'"'; __file__='"'"'/data/data/com.termux/files/usr/tmp/pip-wheel-pejbf0zb/cffi/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /data/data/com.termux/files/usr/tmp/pip-wheel-a82fcu1r
           cwd: /data/data/com.termux/files/usr/tmp/pip-wheel-pejbf0zb/cffi/
      Complete output (6 lines):
      usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
         or: setup.py --help [cmd1 cmd2 ...]
         or: setup.py --help-commands
         or: setup.py cmd --help

      error: invalid command 'bdist_wheel'
      ----------------------------------------
      ERROR: Failed building wheel for cffi
    ERROR: Failed to build one or more wheels
    Traceback (most recent call last):
      File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/setuptools/installer.py", line 126, in fetch_build_egg
        subprocess.check_call(cmd)
      File "/data/data/com.termux/files/usr/lib/python3.9/subprocess.py", line 373, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '['/data/data/com.termux/files/usr/bin/python3', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/data/data/com.termux/files/usr/tmp/tmpk0y57itt', '--quiet', 'cffi>=1.0.0']' returned non-zero exit status 1.

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

    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/data/data/com.termux/files/usr/tmp/pip-install-q9103x19/cryptg/setup.py", line 63, in <module>
        main(sys.argv)
      File "/data/data/com.termux/files/usr/tmp/pip-install-q9103x19/cryptg/setup.py", line 19, in main
        setup(
      File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/setuptools/__init__.py", line 152, in setup
        _install_setup_requires(attrs)
      File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/setuptools/__init__.py", line 147, in _install_setup_requires
        dist.fetch_build_eggs(dist.setup_requires)
      File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/setuptools/dist.py", line 673, in fetch_build_eggs
        resolved_dists = pkg_resources.working_set.resolve(
      File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 764, in resolve
        dist = best[req.key] = env.best_match(
      File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 1049, in best_match
        return self.obtain(req, installer)
      File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 1061, in obtain
        return installer(requirement)
      File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/setuptools/dist.py", line 732, in fetch_build_egg
        return fetch_build_egg(self, req)
      File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/setuptools/installer.py", line 128, in fetch_build_egg
        raise DistutilsError(str(e)) from e
    distutils.errors.DistutilsError: Command '['/data/data/com.termux/files/usr/bin/python3', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/data/data/com.termux/files/usr/tmp/tmpk0y57itt', '--quiet', 'cffi>=1.0.0']' returned non-zero exit status 1.
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

The upgrading of setuptools (with pip install --upgrade setuptools) didn't help. Unfortunately, I'm new to Linux. Thank you very much!

Lonami commented 3 years ago

Did you pip install wheel?

Talmio216 commented 3 years ago

Now I did, and the installation went successfully. Thank you again! ^_^

cher-nov commented 3 years ago

I wonder why it doesn't work, because setuptools should install wheel on bdist_wheel.

https://github.com/pypa/setuptools/blob/c0085e87c69629ec3cf24dfce887c0fb93fa80dd/setup.py#L71-L72 https://github.com/pypa/setuptools/blob/c0085e87c69629ec3cf24dfce887c0fb93fa80dd/setup.py#L188-L189

May be related: https://stackoverflow.com/questions/59104686/wheel-installation-from-within-requirements-txt

Lonami commented 3 years ago

As I understand it, these tools are not required for setup.py but since a lot of projects assume they will be there, they normally end up being installed.

See What the heck is pyproject.toml? and the linked previous article for more on this problem and its solutions.

Talmio216 commented 3 years ago

Managed to make it work on Linux Deploy today! After connecting to the tablet by ssh and trying to install again, I read the log, searched for error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1 on the net, and found the solution here. After running sudo apt-get install gcc libffi-dev libssl-dev python3-dev, I was able to finally install cryptg on the tablet.

cher-nov commented 3 years ago

@Talmio216 Could you provide the whole unsuccessfull log please?

landfillbaby commented 3 years ago

there are no pypi-published source packages for versions 0.2.post1 and 0.2.post2

cher-nov commented 3 years ago

there are no pypi-published source packages for versions 0.2.post1 and 0.2.post2

They're were just releases with tinyaes library updated, so I didn't make source releases, only wheel ones.

landfillbaby commented 3 years ago

this causes problems for platforms other than x86 https://github.com/termux/termux-packages/issues/6664

cher-nov commented 3 years ago

this causes problems for platforms other than x86 termux/termux-packages#6664

https://github.com/cher-nov/cryptg/issues/9#issuecomment-824804650

mrcsmsmsm commented 2 years ago

PIP install pyproject