xtekky / gpt4free

The official gpt4free repository | various collection of powerful language models
https://g4f.ai
GNU General Public License v3.0
59.16k stars 13.18k forks source link

Can't pip install curl_cffi - Getting Unsupported arch error #2098

Open plia7 opened 3 days ago

plia7 commented 3 days ago

Hello,

I have iSH version 1.3.2 (Alpine Linux x86 emulator) on my iPhone along with python and pip installed in it. Which I used to install the g4f python package - The official gpt4free repository | various collection of powerful language models. They recently upgraded to version 0.3.2.1 and it appears to use the curl_cffi python package.

I tried to install it in this order:

apk add gcc musl-dev libffi-dev libcurl libcurl-dev pip install --upgrade pip setuptools wheel pip install curl_cffi

When I try to install it, I get an error:

pip install curl_cffi
Collecting curl_cffi
  Downloading curl_cffi-0.7.0.tar.gz (132 kB)
     ━━━━━━━━━━━━━ 132.9/132.9   430.3 kB/s eta 0:00:00
                   kB                                  
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [37 lines of output]
      Traceback (most recent call last):
        File "/usr/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/usr/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/usr/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
        File "/tmp/pip-build-env-vjq7x6k4/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 327, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=[])
        File "/tmp/pip-build-env-vjq7x6k4/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 297, in _get_build_requires
          self.run_setup()
        File "/tmp/pip-build-env-vjq7x6k4/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 313, in run_setup
          exec(code, locals())
        File "<string>", line 16, in <module>
        File "/tmp/pip-build-env-vjq7x6k4/overlay/lib/python3.9/site-packages/setuptools/__init__.py", line 103, in setup

return distutils.core.setup(**attrs)
        File "/tmp/pip-build-env-vjq7x6k4/overlay/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 146, in setup
          _setup_distribution = dist = klass(attrs)
        File "/tmp/pip-build-env-vjq7x6k4/overlay/lib/python3.9/site-packages/setuptools/dist.py", line 307, in _init_
          _Distribution.__init__(self, dist_attrs)
        File "/tmp/pip-build-env-vjq7x6k4/overlay/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 286, in _init_
          self.finalize_options()
        File "/tmp/pip-build-env-vjq7x6k4/overlay/lib/python3.9/site-packages/setuptools/dist.py", line 659, in finalize_options
          ep(self)
        File "/tmp/pip-build-env-vjq7x6k4/overlay/lib/python3.9/site-packages/setuptools/dist.py", line 679, in _finalize_setup_keywords
          ep.load()(self, ep.name, value)
        File "/tmp/pip-build-env-vjq7x6k4/overlay/lib/python3.9/site-packages/cffi/setuptools_ext.py", line 216, in cffi_modules
          add_cffi_module(dist, cffi_module)
        File "/tmp/pip-build-env-vjq7x6k4/overlay/lib/python3.9/site-packages/cffi/setuptools_ext.py", line 49, in add_cffi_module
          execfile(build_file_name, mod_vars)
        File "/tmp/pip-build-env-vjq7x6k4/overlay/lib/python3.9/site-packages/cffi/setuptools_ext.py", line 25, in execfile
          exec(code, glob, glob)
        File "scripts/build.py", line 47, in <module>
          arch = detect_arch()
        File "scripts/build.py", line 44, in detect_arch
          raise Exception(f"Unsupported arch: {uname}")
      Exception: Unsupported arch: uname_result(system='Linux', node='iPhone', release='4.20.69-ish', version='SUPER AWESOME May 20 2023 23:41:32', machine='i686')
      [end of output]

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

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

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

Which error is basically this: Exception: Unsupported arch: uname_result(system='Linux', node='iPhone', release='4.20.69-ish', version='SUPER AWESOME May 20 2023 23:41:32', machine='i686')

I also tried to set export ARCHFLAGS="-arch i686" before installing it and trying to install an older version pip install curl_cffi==0.6.4 but I still get the same error.

So I can't run g4f anymore in the latest version. Is there a way to install curl_cffi python package without getting this error in iSH or is there a way to still install and run an older version of g4f where this package is not required?

Thanks.

gamelist1990 commented 3 days ago

I think the problem is that I'm trying to run it on an iPhone, but I'll think about it for a bit.

gamelist1990 commented 3 days ago

Try this command.

pip install curl_cffi>=0.6.2

If this doesn't work, then I don't know.

@plia7

plia7 commented 3 days ago

image

pip curl_cffi>=0.6.2

If this doesn't work, then I don't know.

@plia7

Sorry not sure I follow what are you trying to say in this screenshot or comment, are you suggesting for me to try something? Because as I mentioned I tried to run the command pip install curl_cffi==0.6.4 and it didn't work (got the same error).

And I just tried it with 0.6.2:

^CERROR: Operation cancelled by user
iPhone:~# pip install curl_cffi==0.6.2
Collecting curl_cffi==0.6.2
  Downloading curl_cffi-0.6.2.tar.gz (122 kB)
     ━━━━━━━━━━━━━ 122.3/122.3   365.5 kB/s eta 0:00:00
                   kB                                  
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [37 lines of output]
      Traceback (most recent call last):
        File "/usr/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/usr/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/usr/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
        File "/tmp/pip-build-env-qot974yn/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 327, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=[])
        File "/tmp/pip-build-env-qot974yn/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 297, in _get_build_requires
          self.run_setup()
        File "/tmp/pip-build-env-qot974yn/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 313, in run_setup
          exec(code, locals())
        File "<string>", line 16, in <module>
        File "/tmp/pip-build-env-qot974yn/overlay/lib/python3.9/site-packages/setuptools/__init__.py", line 103, in setup 

return distutils.core.setup(**attrs)
        File "/tmp/pip-build-env-qot974yn/overlay/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 146, in setup
          _setup_distribution = dist = klass(attrs)
        File "/tmp/pip-build-env-qot974yn/overlay/lib/python3.9/site-packages/setuptools/dist.py", line 307, in __init__
          _Distribution.__init__(self, dist_attrs)
        File "/tmp/pip-build-env-qot974yn/overlay/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 286, in __init__
          self.finalize_options()
        File "/tmp/pip-build-env-qot974yn/overlay/lib/python3.9/site-packages/setuptools/dist.py", line 659, in finalize_options
          ep(self)
        File "/tmp/pip-build-env-qot974yn/overlay/lib/python3.9/site-packages/setuptools/dist.py", line 679, in _finalize_setup_keywords
          ep.load()(self, ep.name, value)
        File "/tmp/pip-build-env-qot974yn/overlay/lib/python3.9/site-packages/cffi/setuptools_ext.py", line 216, in cffi_modules
          add_cffi_module(dist, cffi_module)
        File "/tmp/pip-build-env-qot974yn/overlay/lib/python3.9/site-packages/cffi/setuptools_ext.py", line 49, in add_cffi_module
          execfile(build_file_name, mod_vars)
        File "/tmp/pip-build-env-qot974yn/overlay/lib/python3.9/site-packages/cffi/setuptools_ext.py", line 25, in execfile
          exec(code, glob, glob)
        File "scripts/build.py", line 31, in <module>
          arch = detect_arch()
        File "scripts/build.py", line 28, in detect_arch
          raise Exception(f"Unsupported arch: {uname}")
      Exception: Unsupported arch: uname_result(system='Linux', node='iPhone', release='4.20.69-ish', version='SUPER AWESOME May 20 2023 23:41:32', machine='i686')
      [end of output]

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

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

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

Thanks.

gamelist1990 commented 3 days ago

@plia7

I would like you to try pip install curl_cffi>=0.6.2. Also, please tell me what iPhone emulator you are using.

In my previous comment, it was 12:32 AM Japan time, and I was very sleepy, so my mind wasn’t working well. Sorry about that.

plia7 commented 3 days ago

@plia7

I would like you to try pip install curl_cffi>=0.6.2. Also, please tell me what iPhone emulator you are using.

It's the middle of the night (0:28 AM Japan time) and I'm very sleepy, so I made a mistake in my last comment.

"pip install curl_cffi>=0.6.2" is not a valid command?

I'm using an app I downloaded from the app store that's called iSH. It's an Alpine Linux x86 emulator that runs on iPhone iOS.

Thanks.

gamelist1990 commented 3 days ago

I've tried ish and found that it doesn't work with the pip command in its initial state.

plia7 commented 3 days ago

I've tried ish and found that it doesn't work with the pip command in its initial state.

Yes, you need to run these commands first:

apk add build-base

apk add clang

apk add clang-doc

apk add nasm

apk add nasm-doc

apk add python3

apk add --update py-pip

apk add python3-dev

Then try again to run:

pip install curl_cffi

Thanks.

gamelist1990 commented 3 days ago

I get the same error as you

plia7 commented 2 days ago

I get the same error as you

Yes, now the question is how can we fix it or can we run an older g4f version that doesn't require this package or is there a way to modify it so it doesn't rely on this package?

@xtekky @hlohaus

Thanks.

gamelist1990 commented 2 days ago

I found the cause. It seems that the architecture i686 used by ish is not supported by curl_cffi, so an error is returned. I think the only solution is to use another app.

@plia7

gamelist1990 commented 2 days ago

Not using curl_cffi may be very difficult. Even older g4f versions use curl_cffi.

plia7 commented 2 days ago

It seems that the architecture i686 used by ish is not supported by curl_cffi, so an error is returned.

This is the only app that you could run g4f on. I don't know any others.

Thanks.

plia7 commented 2 days ago

Not using curl_cffi may be very difficult. Even older g4f versions use curl_cffi.

But older versions didn't have this problem. I.e. g4f version 0.3.0.6 used to work fine.

gamelist1990 commented 2 days ago

umm

gamelist1990 commented 2 days ago

Providers that do not use curl_cffi should work.

plia7 commented 2 days ago

Providers that do not use curl_cffi should work.

Well I'm using OpenAI ChatGPT. Does it require curl_cffi?

gamelist1990 commented 2 days ago

I don't think I can.

gamelist1990 commented 2 days ago

curl_cffi is currently required for definitive [If you had a previous version that worked, we recommend downgrading to that version and updating the code as needed.

plia7 commented 2 days ago

curl_cffi is currently required for definitive [If you had a previous version that worked, we recommend downgrading to that version and updating the code as needed.

If I downgrade to a previous version I don't think it will be able to parse the HAR file since it keeps getting updated?

gamelist1990 commented 2 days ago

Try updating openAI's harfile.py and OpenAIchat.py to the current code.

plia7 commented 2 days ago

Try updating openAI's harfile.py and OpenAIchat.py to the current code.

Not sure if it will work?

gamelist1990 commented 2 days ago

To be honest: .... I don't know... Maybe it will work out.

gamelist1990 commented 2 days ago

Can you tell me which version of g4f works well?

gamelist1990 commented 2 days ago

I'm just guessing, but pip install curl-cffi==0.5.10 probably doesn't have the OScheck functionality, so you should be able to use the function

plia7 commented 2 days ago

I'm just guessing, but pip install curl-cffi==0.5.10 probably doesn't have the OScheck functionality, so you should be able to use the function

Just tried it, doesn't work:


Collecting curl-cffi==0.5.10
  Downloading curl_cffi-0.5.10.tar.gz (35 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting cffi>=1.12.0 (from curl-cffi==0.5.10)
  Using cached cffi-1.16.0-cp39-cp39-musllinux_1_1_i686.whl.metadata (1.5 kB)
Collecting pycparser (from cffi>=1.12.0->curl-cffi==0.5.10)
  Using cached pycparser-2.22-py3-none-any.whl.metadata (943 bytes)
Using cached cffi-1.16.0-cp39-cp39-musllinux_1_1_i686.whl (435 kB)
Using cached pycparser-2.22-py3-none-any.whl (117 kB)
Building wheels for collected packages: curl-cffi
  Building wheel for curl-cffi (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for curl-cffi (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [91 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-i686-cpython-39
      creating build/lib.linux-i686-cpython-39/curl_cffi
      copying curl_cffi/build.py -> build/lib.linux-i686-cpython-39/curl_cffi
      copying curl_cffi/curl.py -> build/lib.linux-i686-cpython-39/curl_cffi
      copying curl_cffi/__init__.py -> build/lib.linux-i686-cpython-39/curl_cffi
      copying curl_cffi/__version__.py -> build/lib.linux-i686-cpython-39/curl_cffi
      copying curl_cffi/aio.py -> build/lib.linux-i686-cpython-39/curl_cffi
      copying curl_cffi/const.py -> build/lib.linux-i686-cpython-39/curl_cffi
      creating build/lib.linux-i686-cpython-39/curl_cffi/requests
      copying curl_cffi/requests/cookies.py -> build/lib.linux-i686-cpython-39/curl_cffi/requests
      copying curl_cffi/requests/models.py -> build/lib.linux-i686-cpython-39/curl_cffi/requests 

copying curl_cffi/requests/session.py -> build/lib.linux-i686-cpython-39/curl_cffi/requests
      copying curl_cffi/requests/__init__.py -> build/lib.linux-i686-cpython-39/curl_cffi/requests
      copying curl_cffi/requests/errors.py -> build/lib.linux-i686-cpython-39/curl_cffi/requests
      copying curl_cffi/requests/headers.py -> build/lib.linux-i686-cpython-39/curl_cffi/requests
      running egg_info
      writing curl_cffi.egg-info/PKG-INFO
      writing dependency_links to curl_cffi.egg-info/dependency_links.txt
      writing requirements to curl_cffi.egg-info/requires.txt
      writing top-level names to curl_cffi.egg-info/top_level.txt
      reading manifest file 'curl_cffi.egg-info/SOURCES.txt'
      reading manifest template 'MANIFEST.in'
      warning: no files found matching 'curl_cffi/cacert.pem'
      warning: no files found matching 'curl_cffi/_wrapper.*'
      warning: no files found matching 'curl_cffi/include/curl/*'
      adding license file 'LICENSE'
      writing manifest file 'curl_cffi.egg-info/SOURCES.txt'
      /tmp/pip-build-env-r6gyozz7/overlay/lib/python3.9/site-packages/setuptools/command/build_py.py:215: _Warning: Package 'curl_cffi.ffi' is absent from the `packages` configuration.
      !!

              ********************************************************************************
              ############################
              # Package would be ignored #
              ############################
              Python recognizes 'curl_cffi.ffi' as an importable package[^1],
              but it is absent from setuptools' `packages` configuration.

              This leads to an ambiguous overall configuration. If you want to distribute this
              package, please make sure that 'curl_cffi.ffi' is explicitly added
              to the `packages` configuration field. Alternatively, you can also rely on setuptools' discovery methods
              (for example by using `find_namespace_packages(...)`/`find_namespace:`
              instead of `find_packages(...)`/`find:`).

              You can read more about "package discovery" on setuptools documentation page:

              - https://setuptools.pypa.io/en/latest/userguide/package_discovery.html

              If you don't want 'curl_cffi.ffi' to be distributed and are
              already explicitly excluding 'curl_cffi.ffi' via
              `find_namespace_packages(...)/find_namespace` or `find_packages(...)/find`,
              you can try to use `exclude_package_data`, or `include-package-data=False` in
              combination with a more fine grained `package-data` configuration.

              You can read more about "package data files" on setuptools documentation page:

              - https://setuptools.pypa.io/en/latest/userguide/datafiles.html

              [^1]: For Python, any directory (with suitable naming) can be imported,
                    even if it does not contain any `.py` files.
                    On the other hand, currently there is no concept of package data
                    directory, all directories are treated like packages.
              ********************************************************************************

      !!
        check.warn(importable)
      creating build/lib.linux-i686-cpython-39/curl_cffi/ffi
      copying curl_cffi/ffi/cdef.c -> build/lib.linux-i686-cpython-39/curl_cffi/ffi
      copying curl_cffi/ffi/shim.c -> build/lib.linux-i686-cpython-39/curl_cffi/ffi copying curl_cffi/ffi/shim.h -> build/lib.linux-i686-cpython-39/curl_cffi/ffi
      running build_ext
      generating cffi module 'build/temp.linux-i686-cpython-39/curl_cffi._wrapper.c'
      creating build/temp.linux-i686-cpython-39
      building 'curl_cffi._wrapper' extension
      creating build/temp.linux-i686-cpython-39/build
      creating build/temp.linux-i686-cpython-39/build/temp.linux-i686-cpython-39
      creating build/temp.linux-i686-cpython-39/curl_cffi
      creating build/temp.linux-i686-cpython-39/curl_cffi/ffi
      gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fomit-frame-pointer -g -fno-semantic-interposition -fomit-frame-pointer -g -fno-semantic-interposition -fomit-frame-pointer -g -fno-semantic-interposition -DTHREAD_STACK_SIZE=0x100000 -fPIC -Icurl_cffi/include -Icurl_cffi/ffi -I/usr/include/python3.9 -c build/temp.linux-i686-cpython-39/curl_cffi._wrapper.c -o build/temp.linux-i686-cpython-39/build/temp.linux-i686-cpython-39/curl_cffi._wrapper.o
      In file included from build/temp.linux-i686-cpython-39/curl_cffi._wrapper.c:570:
      curl_cffi/ffi/shim.h:5:10: fatal error: curl/curl.h: No such file or directory
          5 | #include "curl/curl.h"
            |          ^~~~~~~~~~~~~
      compilation terminated.
      error: command '/usr/bin/gcc' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for curl-cffi
Failed to build curl-cffi
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (curl-cffi) ```
gamelist1990 commented 2 days ago

At least we know that it wasn't rejected by OScheck.

gamelist1990 commented 2 days ago

How about finding a version that can be built? It's below 0.5.

plia7 commented 2 days ago

At least we know that it wasn't rejected by OScheck.

What was the reason it was rejected this time?

plia7 commented 2 days ago

How about finding a version that can be built? It's below 0.5.

You mean to try to install a lower version? Like what version?

gamelist1990 commented 2 days ago

aa

gamelist1990 commented 2 days ago

If you check the error content, it seems that something is missing, so please try the following code.

How to Fix the curl/curl.h Not Found Error When Building curl-cffi on Lumix If you encounter the error fatal error: curl/curl.h: No such file or directory while building curl-cffi, follow these steps to resolve it: Install libcurl: For Linux: sudo apt-get install libcurl4-openssl-dev

For macOS (using Homebrew): brew install curl

Set Environment Variables: After installing libcurl, set the CFLAGS and LDFLAGS environment variables to ensure the compiler can find the correct paths. export CFLAGS="-I/usr/local/opt/curl/include" export LDFLAGS="-L/usr/local/opt/curl/lib"

Retry Installing curl-cffi: With the environment variables set, try installing curl-cffi again.

gamelist1990 commented 2 days ago

I think we can work this out.

plia7 commented 2 days ago

I think we can work this out.

Are you able to do this in your environment and get this to work?

gamelist1990 commented 2 days ago

ok

plia7 commented 2 days ago

ok

Any luck?

gamelist1990 commented 2 days ago

No, it's difficult because curl_cffi uses a library internally that cannot be used with ish. I'm trying to compile it from source but it doesn't work.

gamelist1990 commented 2 days ago

You might want to give up on this. Even when building from source code, errors occur. The content is OS-related.

plia7 commented 1 day ago

No, it's difficult because curl_cffi uses a library internally that cannot be used with ish. I'm trying to compile it from source but it doesn't work.

What about patching the error that it throws that the arch is missing? ChatGPT suggested to do that, but not sure if it will work?

plia7 commented 1 day ago

You might want to give up on this. Even when building from source code, errors occur. The content is OS-related.

Thanks. So it's hopeless?

gamelist1990 commented 1 day ago

I'll take a look.

gamelist1990 commented 1 day ago

arch Error?Can you give me the error details?

plia7 commented 1 day ago

arch Error?Can you give me the error details?

Yes:

pip install curl_cffi
Collecting curl_cffi
  Downloading curl_cffi-0.7.0.tar.gz (132 kB)
     ━━━━━━━━━━━━━ 132.9/132.9   430.3 kB/s eta 0:00:00
                   kB                                  
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [37 lines of output]
      Traceback (most recent call last):
        File "/usr/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/usr/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/usr/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
        File "/tmp/pip-build-env-vjq7x6k4/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 327, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=[])
        File "/tmp/pip-build-env-vjq7x6k4/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 297, in _get_build_requires
          self.run_setup()
        File "/tmp/pip-build-env-vjq7x6k4/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 313, in run_setup
          exec(code, locals())
        File "<string>", line 16, in <module>
        File "/tmp/pip-build-env-vjq7x6k4/overlay/lib/python3.9/site-packages/setuptools/__init__.py", line 103, in setup

return distutils.core.setup(**attrs)
        File "/tmp/pip-build-env-vjq7x6k4/overlay/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 146, in setup
          _setup_distribution = dist = klass(attrs)
        File "/tmp/pip-build-env-vjq7x6k4/overlay/lib/python3.9/site-packages/setuptools/dist.py", line 307, in _init_
          _Distribution.__init__(self, dist_attrs)
        File "/tmp/pip-build-env-vjq7x6k4/overlay/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 286, in _init_
          self.finalize_options()
        File "/tmp/pip-build-env-vjq7x6k4/overlay/lib/python3.9/site-packages/setuptools/dist.py", line 659, in finalize_options
          ep(self)
        File "/tmp/pip-build-env-vjq7x6k4/overlay/lib/python3.9/site-packages/setuptools/dist.py", line 679, in _finalize_setup_keywords
          ep.load()(self, ep.name, value)
        File "/tmp/pip-build-env-vjq7x6k4/overlay/lib/python3.9/site-packages/cffi/setuptools_ext.py", line 216, in cffi_modules
          add_cffi_module(dist, cffi_module)
        File "/tmp/pip-build-env-vjq7x6k4/overlay/lib/python3.9/site-packages/cffi/setuptools_ext.py", line 49, in add_cffi_module
          execfile(build_file_name, mod_vars)
        File "/tmp/pip-build-env-vjq7x6k4/overlay/lib/python3.9/site-packages/cffi/setuptools_ext.py", line 25, in execfile
          exec(code, glob, glob)
        File "scripts/build.py", line 47, in <module>
          arch = detect_arch()
        File "scripts/build.py", line 44, in detect_arch
          raise Exception(f"Unsupported arch: {uname}")
      Exception: Unsupported arch: uname_result(system='Linux', node='iPhone', release='4.20.69-ish', version='SUPER AWESOME May 20 2023 23:41:32', machine='i686')
      [end of output]

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

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

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

And this is what ChatGPT suggests:

ChatGPT
The issue is caused by the uname function in the scripts/build.py file of curl_cffi, which doesn't recognize your specific architecture and fails with an "Unsupported arch" error. Here are a couple of steps you can take to address this:

Set the Architecture Manually:
You can try setting the architecture manually in the environment before running the pip install command.

sh
Copy code
export ARCHFLAGS="-arch i386"
pip install curl_cffi
Install an Older Version:
If the architecture issue persists, you can try installing an older version of curl_cffi, such as version 0.6.4, which might not have this specific check.

sh
Copy code
pip install curl_cffi==0.6.4
Patch the Build Script:
As a last resort, you can download the source, patch the build script to bypass the architecture check, and then install it manually.

sh
Copy code
# Download the source code
wget https://files.pythonhosted.org/packages/6b/5f/69d6e11e72f4b7a1b5f6dc992f0a1b1ef0658dcd52274a845747ae3d5c3c/curl_cffi-0.7.0.tar.gz
tar -xzf curl_cffi-0.7.0.tar.gz
cd curl_cffi-0.7.0

# Patch the build script
sed -i 's/raise Exception(f"Unsupported arch: {uname}")/# raise Exception(f"Unsupported arch: {uname}")/' scripts/build.py

# Install manually
pip install .

@gamelist1990 Do you think patching the build script might be a legit way to workaround the issue or unlikely?

Thanks.

gamelist1990 commented 1 day ago

Since the OS used by ISH is not a normal Linux, even if the arch error is resolved, other problems will appear, so it may be very difficult.

gamelist1990 commented 1 day ago

I personally find it very difficult to use, but this app can be installed https://apps.apple.com/app/id6444809156

plia7 commented 1 day ago

I personally find it very difficult to use, but this app can be installed https://apps.apple.com/app/id6444809156

I'm on iOS 14, so can't really use it (it requires iOS 16). Plus I doubt this will allow you to install g4f? Are you actually able to run it? Plus if I had iOS 16 I would just download the the official ChatGPT app.

gamelist1990 commented 1 day ago

I'd like to know what you'd like to do. Do you want to run g4f on the iPhone or is that too much to ask?

plia7 commented 1 day ago

I'd like to know what you'd like to do. Do you want to run g4f on the iPhone or is that too much to ask?

I'm trying to run ChatGPT on an older iOS version (14.4.1) since the official app requires iOS 16+. I was able to do that by using iSH with g4f, until this issue I'm having now.

gamelist1990 commented 1 day ago

If you publish a webapi and connect to it, you can do it on IOS14, but you don't want to do it that way?

plia7 commented 1 day ago

If you publish a webapi and connect to it, you can do it on IOS14, but you don't want to do it that way?

You mean using g4f web api mode? I tried it, but iOS 14 Safari webkit is not able to run that webpage properly.

gamelist1990 commented 1 day ago

You can do it that way, but you have to build and use your own webapi.