juancarlospaco / faster-than-requests

Faster requests on Python 3
https://gist.github.com/juancarlospaco/37da34ed13a609663f55f4466c4dbc3e
MIT License
1.09k stars 91 forks source link

[bug] faster-than-requests doesn't work on Apple Silicon #213

Closed srijanshetty closed 1 year ago

srijanshetty commented 1 year ago

Architecture

arm64 (Apple Silicon)

Operating System

MacOS

Disk

SSD (Solid)

Memory

16 Gigabytes

CPU Cores

16 CPU Cores

Internet Connection

Optical Fiber (very fast)

What is your web browser?

Chromium

Device

Desktop PC

Where are you from?

India

What happened?

Tried to install using pip install faster_than_requests but it failed for Apple Silicon.

Standard Output Logs

Collecting faster_than_requests
  Using cached faster_than_requests-21.03.03.zip (4.9 MB)

  Preparing metadata (setup.py)
 ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [103 lines of output]
      /Users/USER/.pyenv/versions/3.11.2/envs/local-env/lib/python3.11/site-packages/setuptools/config/setupcfg.py:508: SetuptoolsDeprecationWarning: The license_file parameter is deprecated,
 use license_files instead.
        warnings.warn(msg,
 warning_class)
      /Users/USER/.pyenv/versions/3.11.2/envs/local-env/lib/python3.11/site-packages/setuptools/installer.py:27: SetuptoolsDeprecationWarning: setuptools.installer is deprecated. Requirements should be satisfied by a PEP 517 installer.
        warnings.warn(
        error: subprocess-exited-with-error

        × python setup.py bdist_wheel did not run successfully.
        │ exit code: 1
        ╰─> [53 lines of output]
            running bdist_wheel
            running build
            /Users/USER/.pyenv/versions/3.11.2/envs/local-env/lib/python3.11/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
              warnings.warn(
            installing to build/bdist.macosx-13.1-arm64/wheel
            running install
            running install_egg_info
            running egg_info
            writing choosenim_install.egg-info/PKG-INFO
            writing dependency_links to choosenim_install.egg-info/dependency_links.txt
            deleting choosenim_install.egg-info/requires.txt
            writing top-level names to choosenim_install.egg-info/top_level.txt
            writing manifest file 'choosenim_install.egg-info/SOURCES.txt'
            reading manifest file 'choosenim_install.egg-info/SOURCES.txt'
            writing manifest file 'choosenim_install.egg-info/SOURCES.txt'
            Copying choosenim_install.egg-info to build/bdist.macosx-13.1-arm64/wheel/choosenim_install-0.5.5-py3.11.egg-info
            running install_scripts
            /bin/sh: choosenim: command not found
            choosenim-init: Error: Sorry,
 your platform (macosx_arm) is not supported by choosenim.
            choosenim-init: Error: You will need to install Nim using an alternative method.
            choosenim-init: Error: See the following link for more info: https://nim-lang.org/install.html
            /private/var/folders/ch/mh2yq97d4mgfg34w39py67j00000gn/T/pip-wheel-2uql96sl/choosenim-install_bde1b8a49dc845bf8e525a7e6620d948/setup.py:107: UserWarning: Failed to run sh init.sh -y
              warnings.warn("Failed to run " + choosenim_cmd)

            Traceback (most recent call last)
:
              File "<string>",
 line 2, in <module>
              File "<pip-setuptools-caller>",
 line 34, in <module>
              File "/private/var/folders/ch/mh2yq97d4mgfg34w39py67j00000gn/T/pip-wheel-2uql96sl/choosenim-install_bde1b8a49dc845bf8e525a7e6620d948/setup.py",
 line 210, in <module>
                setuptools.setup(
              File "/Users/USER/.pyenv/versions/3.11.2/envs/local-env/lib/python3.11/site-packages/setuptools/__init__.py",
 line 87, in setup
                return distutils.core.setup(**attrs)

                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
              File "/Users/USER/.pyenv/versions/3.11.2/envs/local-env/lib/python3.11/site-packages/setuptools/_distutils/core.py",
 line 185, in setup
                return run_commands(dist)

                       ^^^^^^^^^^^^^^^^^^
              File "/Users/USER/.pyenv/versions/3.11.2/envs/local-env/lib/python3.11/site-packages/setuptools/_distutils/core.py",
 line 201, in run_commands
                dist.run_commands()

              File "/Users/USER/.pyenv/versions/3.11.2/envs/local-env/lib/python3.11/site-packages/setuptools/_distutils/dist.py",
 line 968, in run_commands
                self.run_command(cmd)

              File "/Users/USER/.pyenv/versions/3.11.2/envs/local-env/lib/python3.11/site-packages/setuptools/dist.py",
 line 1217, in run_command
                super()
.run_command(command)
              File "/Users/USER/.pyenv/versions/3.11.2/envs/local-env/lib/python3.11/site-packages/setuptools/_distutils/dist.py",
 line 987, in run_command
                cmd_obj.run()

              File "/Users/USER/.pyenv/versions/3.11.2/envs/local-env/lib/python3.11/site-packages/wheel/bdist_wheel.py",
 line 360, in run
                self.run_command("install")

              File "/Users/USER/.pyenv/versions/3.11.2/envs/local-env/lib/python3.11/site-packages/setuptools/_distutils/cmd.py",
 line 319, in run_command
                self.distribution.run_command(command)

              File "/Users/USER/.pyenv/versions/3.11.2/envs/local-env/lib/python3.11/site-packages/setuptools/dist.py",
 line 1217, in run_command
                super()
.run_command(command)
              File "/Users/USER/.pyenv/versions/3.11.2/envs/local-env/lib/python3.11/site-packages/setuptools/_distutils/dist.py",
 line 987, in run_command
                cmd_obj.run()

              File "/private/var/folders/ch/mh2yq97d4mgfg34w39py67j00000gn/T/pip-wheel-2uql96sl/choosenim-install_bde1b8a49dc845bf8e525a7e6620d948/setup.py",
 line 208, in run
                raise Exception(IOError,
 "Failed to install choosenim")
            Exception: (<class 'OSError'>,
 'Failed to install choosenim')
            [end of output]

        note: This error originates from a subprocess,
 and is likely not a problem with pip.
        ERROR: Failed building wheel for choosenim_install
      ERROR: Failed to build one or more wheels
      Traceback (most recent call last)
:
        File "/Users/USER/.pyenv/versions/3.11.2/envs/local-env/lib/python3.11/site-packages/setuptools/installer.py",
 line 82, in fetch_build_egg
          subprocess.check_call(cmd)

        File "/Users/USER/.pyenv/versions/3.11.2/lib/python3.11/subprocess.py",
 line 413, in check_call
          raise CalledProcessError(retcode,
 cmd)
      subprocess.CalledProcessError: Command '['/Users/USER/.pyenv/versions/3.11.2/envs/local-env/bin/python3.11',
 '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/var/folders/ch/mh2yq97d4mgfg34w39py67j00000gn/T/tmpf5e1g9vw', '--quiet', 'choosenim_install']' 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 2, in <module>
        File "<pip-setuptools-caller>",
 line 34, in <module>
        File "/private/var/folders/ch/mh2yq97d4mgfg34w39py67j00000gn/T/pip-install-4_u3a0e0/faster-than-requests_ea4b74a42c994d0c9c0e47398cfb107d/setup.py",
 line 2, in <module>
          setuptools.setup(package_data = {"": ["*.nim",
 "*.nims", "*.cfg", "*.dll", "*.so", "*.h", "*.hpp"]})
        File "/Users/USER/.pyenv/versions/3.11.2/envs/local-env/lib/python3.11/site-packages/setuptools/__init__.py",
 line 86, in setup
          _install_setup_requires(attrs)

        File "/Users/USER/.pyenv/versions/3.11.2/envs/local-env/lib/python3.11/site-packages/setuptools/__init__.py",
 line 80, in _install_setup_requires
          dist.fetch_build_eggs(dist.setup_requires)

        File "/Users/USER/.pyenv/versions/3.11.2/envs/local-env/lib/python3.11/site-packages/setuptools/dist.py",
 line 875, in fetch_build_eggs
          resolved_dists = pkg_resources.working_set.resolve(
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/Users/USER/.pyenv/versions/3.11.2/envs/local-env/lib/python3.11/site-packages/pkg_resources/__init__.py",
 line 789, in
resolve
          dist = best[req.key] = env.best_match(
                                 ^^^^^^^^^^^^^^^
        File "/Users/USER/.pyenv/versions/3.11.2/envs/local-env/lib/python3.11/site-packages/pkg_resources/__init__.py",
 line 1075, in best_match
          return self.obtain(req,
 installer)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/Users/USER/.pyenv/versions/3.11.2/envs/local-env/lib/python3.11/site-packages/pkg_resources/__init__.py",
 line 1087, in obtain
          return installer(requirement)

                 ^^^^^^^^^^^^^^^^^^^^^^
        File "/Users/USER/.pyenv/versions/3.11.2/envs/local-env/lib/python3.11/site-packages/setuptools/dist.py",
 line 945, in fetch_build_egg
          return fetch_build_egg(self,
 req)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/Users/USER/.pyenv/versions/3.11.2/envs/local-env/lib/python3.11/site-packages/setuptools/installer.py",
 line 84, in fetch_build_egg
          raise DistutilsError(str(e)
) from e
      distutils.errors.DistutilsError: Command '['/Users/USER/.pyenv/versions/3.11.2/envs/local-env/bin/python3.11',
 '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/var/folders/ch/mh2yq97d4mgfg34w39py67j00000gn/T/tmpf5e1g9vw', '--quiet', 'choosenim_install']' returned non-zero exit status 1.
      [end of output]

  note: This error originates from a subprocess,
 and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.
github-actions[bot] commented 1 year ago

Welcome srijanshetty

BEP20 Binance Smart Chain Network BSC

0xb78c4cf63274bb22f83481986157d234105ac17e

BTC Bitcoin Network

1Pnf45MgGgY32X4KDNJbutnpx96E4FxqVi

Lightning Network

juancarlospaco@bitrefill.me

Ethereum ETH Dai DAI Uniswap UNI Axie Infinity AXS Smooth Love Potion SLP **BEP20 Binance Smart Chain Network BSC** ``` 0xb78c4cf63274bb22f83481986157d234105ac17e ``` **ERC20 Ethereum Network** ``` 0xb78c4cf63274bb22f83481986157d234105ac17e ```
Tether USDT **BEP20 Binance Smart Chain Network BSC** ``` 0xb78c4cf63274bb22f83481986157d234105ac17e ``` **ERC20 Ethereum Network** ``` 0xb78c4cf63274bb22f83481986157d234105ac17e ``` **TRC20 Tron Network** ``` TWGft53WgWvH2mnqR8ZUXq1GD8M4gZ4Yfu ```
Solana SOL **BEP20 Binance Smart Chain Network BSC** ``` 0xb78c4cf63274bb22f83481986157d234105ac17e ``` **SOL Solana Network** ``` FKaPSd8kTUpH7Q76d77toy1jjPGpZSxR4xbhQHyCMSGq ```
Cardano ADA **BEP20 Binance Smart Chain Network BSC** ``` 0xb78c4cf63274bb22f83481986157d234105ac17e ``` **ADA Cardano Network** ``` DdzFFzCqrht9Y1r4Yx7ouqG9yJNWeXFt69xavLdaeXdu4cQi2yXgNWagzh52o9k9YRh3ussHnBnDrg7v7W2hSXWXfBhbo2ooUKRFMieM ```
Sandbox SAND Decentraland MANA **ERC20 Ethereum Network** ``` 0xb78c4cf63274bb22f83481986157d234105ac17e ```
Algorand ALGO **ALGO Algorand Network** ``` WM54DHVZQIQDVTHMPOH6FEZ4U2AU3OBPGAFTHSCYWMFE7ETKCUUOYAW24Q ```
Binance [https://pay.binance.com/en/checkout/e92e536210fd4f62b426ea7ee65b49c3](https://pay.binance.com/en/checkout/e92e536210fd4f62b426ea7ee65b49c3 "Send via Binance Pay")
juancarlospaco commented 1 year ago

We do not have any Apple hardware to work with, sorry. 😐

srijanshetty commented 1 year ago

@juancarlospaco let me know how I can package this repository for Apple, I'll try my best and raise a PR for you all.

Please keep doing the good work!

juancarlospaco commented 1 year ago

Git clone and compile basically, there are instructions on the Readme, should be 2 commands: https://github.com/juancarlospaco/faster-than-requests#windows

I think on Apple the file extension should be .dynlib instead of .pyd.

alecglen commented 1 year ago

Don't know if you made any changes since the last update, but FWIW I was able to install without issue on my M1 Mac just now. Subsequently however, upon import I encounter the error below:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/alecostrander/opt/anaconda3/envs/fpelo/lib/python3.11/site-packages/faster_than_requests/__init__.py", line 7, in <module>
    from . faster_than_requests import *
  File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1140, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1080, in _find_spec
  File "/Users/alecostrander/opt/anaconda3/envs/fpelo/lib/python3.11/site-packages/nimporter.py", line 1269, in find_spec
    return Nimporter.import_nim_code(fullname, path, library=False)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/alecostrander/opt/anaconda3/envs/fpelo/lib/python3.11/site-packages/nimporter.py", line 944, in import_nim_code
    NimCompiler.compile_nim_code(
  File "/Users/alecostrander/opt/anaconda3/envs/fpelo/lib/python3.11/site-packages/nimporter.py", line 705, in compile_nim_code
    cls.check_compile_errors(errors, library, nim_args, output, tmp_cwd, warnings)
  File "/Users/alecostrander/opt/anaconda3/envs/fpelo/lib/python3.11/site-packages/nimporter.py", line 492, in check_compile_errors
    raise NimCompileException(errors[0])
nimporter.NimCompileException: std/asyncmacro(42, 5) Warning: The bare except clause is deprecated; use `except CatchableError:` instead [BareExcept]

Edit: following up per an old issue stating the package is not compatible with Anaconda - I confirmed the error persists on my base Python installation, as well as in an x86-64 ubuntu Docker instance.

juancarlospaco commented 1 year ago

It is compatible with the official CPython only.

alecglen commented 1 year ago

That is what I'm using, yes?

juancarlospaco commented 1 year ago

Official CPython installed via the official way using PIP etc. Some alternative Pythons have custom "patches" that remove features and sometimes add bugs.

tn-17 commented 1 year ago

@alecglen did you manage to fix the issue that you mentioned above?