xtekky / gpt4free

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

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

Open plia7 opened 2 weeks ago

plia7 commented 2 weeks 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.

plia7 commented 1 week ago

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

I think that's too complicated? I rather just use the official Gemini web version which works fine in my iOS 14 webkit.

gamelist1990 commented 1 week ago

https://apps.apple.com/us/app/a-shell/id1473805438?uo=4

https://apps.apple.com/us/app/blink-shell-build-code/id1594898306

I've been researching since yesterday and it seems there is an app that offers similar functionality to ish!

gamelist1990 commented 1 week ago

https://testflight.apple.com/join/WUdKe3f4

testFlight version [ish]

plia7 commented 1 week ago

https://testflight.apple.com/join/WUdKe3f4

testFlight version [ish]

Thanks, the question will g4f will work there in the two apps you found? I think "Blink Shell. Build & Code" won't work on iOS 14 as it appears to require iOS 16.1 (unless there is a lower version where it will work there). A-Shell need to see but I think it might be limited in terms of what python packages you can install on it.

Is the Test Flight link for a newer version of iSH? Won't it have the same issue?

gamelist1990 commented 1 week ago

i will try

plia7 commented 1 week ago

i will try

Thanks. I was researching too at the time and found these:

Those with lower iOS like 11-14, you might be able to use these apps (if compatible with your iOS) instead of iSH to achieve something similar (I haven’t tried):

gamelist1990 commented 1 week ago

I think it's good, but I think file operations are difficult.

plia7 commented 1 week ago

I think it's good, but I think file operations are difficult.

Which one of them? That's what I like about iSH you can mount it to an iOS folder and then if your iOS is jailbroken you can use Filza to browse to the folder where you can drop your py files. Some of them are probably sandboxed and very limited restricting you what python packages you can download or install.

gamelist1990 commented 1 week ago

I can tell you that ashell also got the same error as ish.

plia7 commented 1 week ago

I can tell you that ashell also got the same error as ish.

FYI the creator of curl_cffi said he will try to add i686 musl build of curl-impersonate for Linux in the future: https://github.com/yifeikong/curl_cffi/issues/344#issuecomment-2213570254

But would be nice if we could find an app where it will work in the interim.

gamelist1990 commented 1 week ago

There are some apps that can be used on iOS 16 and later.

gamelist1990 commented 1 week ago

But when it comes to iOS 14, I think the only option is ish.

plia7 commented 1 week ago

But when it comes to iOS 14, I think the only option is ish.

What about

Pythonista 3 Pyto - Python 3

?

gamelist1990 commented 1 week ago

Python3

plia7 commented 1 week ago

Python3

Have you succeeded?

gamelist1990 commented 1 week ago

yes

plia7 commented 1 week ago

yes

Please share the details. Do you have screenshots or video? What's the link to the app?

plia7 commented 1 week ago

yes

@gamelist1990 Hello?

gamelist1990 commented 1 week ago

sry https://apps.apple.com/app/id6444809156

I was able to use this app, but you're on iOS 14 and this probably means you can't use it, so I'm looking for it.

github-actions[bot] commented 2 days ago

Bumping this issue because it has been open for 7 days with no activity. Closing automatically in 7 days unless it becomes active again.

plia7 commented 1 day ago

sry https://apps.apple.com/app/id6444809156

I was able to use this app, but you're on iOS 14 and this probably means you can't use it, so I'm looking for it.

Can't download it, it's targeting ios 16 and above.

gamelist1990 commented 1 day ago

Can't download it, it's targeting ios 16 and above.

Oh really