Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems using curl_cffi python library #866

Open
vitalikover opened this issue May 6, 2023 · 14 comments
Open

Problems using curl_cffi python library #866

vitalikover opened this issue May 6, 2023 · 14 comments
Labels

Comments

@vitalikover
Copy link

vitalikover commented May 6, 2023

Chaquopy version

14.0.2

Devices or emulators where the issue happens

All

Relevant parts of your code

python {
            buildPython "C:/Users/User/AppData/Local/Programs/Python/Python310/python.exe"
            pip {
                install "requests==2.28.1"
                install "beautifulsoup4==4.12.0"
                install "websocket_client==1.5.1"
                install "curl_cffi"
            }
        }

Describe your issue

ERROR: Command errored out with exit status 1:
   command: 'C:\Users\User\AppData\Local\Programs\Python\Python310\python.exe' 'C:\Users\User\AndroidStudioProjects\kit\Analyzer\app\build\generated\python\bp\pip\_vendor\pep517\_in_process.py' build_wheel 'C:\Users\USER~1\AppData\Local\Temp\tmphqcrxkjg'
       cwd: C:\Users\User\AppData\Local\Temp\pip-install-b8n6_9ow\curl-cffi
  Complete output (82 lines):
  C:\Users\User\AppData\Local\Temp\pip-build-env-82gwkxnb\overlay\Lib\site-packages\setuptools\config\pyprojecttoml.py:66: _BetaConfiguration: Support for `[tool.setuptools]` in `pyproject.toml` is still *beta*.
    config = read_configuration(filepath, True, ignore_option_errors, dist)
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-cpython-310
  creating build\lib.win-amd64-cpython-310\curl_cffi
  copying curl_cffi\aio.py -> build\lib.win-amd64-cpython-310\curl_cffi
  copying curl_cffi\build.py -> build\lib.win-amd64-cpython-310\curl_cffi
  copying curl_cffi\const.py -> build\lib.win-amd64-cpython-310\curl_cffi
  copying curl_cffi\curl.py -> build\lib.win-amd64-cpython-310\curl_cffi
  copying curl_cffi\__init__.py -> build\lib.win-amd64-cpython-310\curl_cffi
  creating build\lib.win-amd64-cpython-310\curl_cffi\requests
  copying curl_cffi\requests\cookies.py -> build\lib.win-amd64-cpython-310\curl_cffi\requests
  copying curl_cffi\requests\errors.py -> build\lib.win-amd64-cpython-310\curl_cffi\requests
  copying curl_cffi\requests\headers.py -> build\lib.win-amd64-cpython-310\curl_cffi\requests
  copying curl_cffi\requests\session.py -> build\lib.win-amd64-cpython-310\curl_cffi\requests
  copying curl_cffi\requests\__init__.py -> build\lib.win-amd64-cpython-310\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'
  C:\Users\User\AppData\Local\Temp\pip-build-env-82gwkxnb\overlay\Lib\site-packages\setuptools\command\build_py.py:201: _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
  ERROR: Command errored out with exit status 1:

          (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.win-amd64-cpython-310\curl_cffi\ffi
  copying curl_cffi\ffi\cdef.c -> build\lib.win-amd64-cpython-310\curl_cffi\ffi
  copying curl_cffi\ffi\shim.c -> build\lib.win-amd64-cpython-310\curl_cffi\ffi
  copying curl_cffi\ffi\shim.h -> build\lib.win-amd64-cpython-310\curl_cffi\ffi
  running build_ext
  generating cffi module 'build\\temp.win-amd64-cpython-310\\Release\\curl_cffi._wrapper.c'
  creating build\temp.win-amd64-cpython-310
  creating build\temp.win-amd64-cpython-310\Release
  building 'curl_cffi._wrapper' extension
  error: CCompiler.compile: Chaquopy cannot compile native code
  ----------------------------------------
ERROR: Failed to install curl_cffi from https://files.pythonhosted.org/packages/c2/dd/4d9eb70a400d8f083e88721f89f14ce9d0fd6cff1d19191f97c7a595752e/curl_cffi-0.5.5.tar.gz#sha256=db94b8d0ad52f3b5c55d32225c29a8219a19592d882075965a78aa9e1a0dead1.
For assistance, please raise an issue at https://github.com/chaquo/chaquopy/issues.
  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\*'

  error: CCompiler.compile: Chaquopy cannot compile native code

Failed to install curl_cffi from https://files.pythonhosted.org/packages/c2/dd/4d9eb70a400d8f083e88721f89f14ce9d0fd6cff1d19191f97c7a595752e/curl_cffi-0.5.5.tar.gz#sha256=db94b8d0ad52f3b5c55d32225c29a8219a19592d882075965a78aa9e1a0dead1.

Chaquopy: Exit status 1

Cannot install curl_cffi python plugin or library. This allows you to make a request skipping the CloudFlare and the fingerprint.

@mhsmith
Copy link
Member

mhsmith commented May 7, 2023

This package contains native components, so it would have to be built into a wheel file. If you'd like to try doing this yourself, follow the instructions here. And if you're successful, please make a pull request so we can add the package to the public repository.

If anyone else wants this package too, let us know by clicking the thumbs-up button above.

@Randomboiii03
Copy link

Randomboiii03 commented Aug 22, 2023

This package contains native components, so it would have to be built into a wheel file. If you'd like to try doing this yourself, follow the instructions here. And if you're successful, please make a pull request so we can add the package to the public repository.

If anyone else wants this package too, let us know by clicking the thumbs-up button above.

I tried following the instructions, i don't know if I'm doing it right, I get an error when BUILDING PACKAGE, and if I may request if you could add "curl-cffi" package in CHAQUOPY, greatly appreciated and thanks 🎉

image

@mhsmith
Copy link
Member

mhsmith commented Aug 23, 2023

build-wheel doesn't support the complete Conda meta.yaml syntax, only the subset defined in meta-schema.yaml. So you'll have to remove the sha256 line, and in this case you can probably remove the entire source section and let it download the sdist from PyPI automatically.

@Randomboiii03
Copy link

Randomboiii03 commented Aug 23, 2023

build-wheel doesn't support the complete Conda meta.yaml syntax, only the subset defined in meta-schema.yaml. So you'll have to remove the sha256 line, and in this case you can probably remove the entire source section and let it download the sdist from PyPI automatically.

I remove everything except the package section in meta.yaml, below is the result, I'm sorry for inconvenience, as for last time request, if possible can you add this library, I'm still having hard time every time I read documentations😅 I greatly appreciate and thank you very much

image

@mhsmith
Copy link
Member

mhsmith commented Aug 23, 2023

As the README says, the build-wheel tool is only supported on Linux, not Windows. If you don't have a Linux machine available, a cheap virtual server from somewhere like DigitalOcean will do just fine. WSL or Docker may also work, though I haven't tried them myself.

@Randomboiii03
Copy link

Randomboiii03 commented Aug 23, 2023

As the README says, the build-wheel tool is only supported on Linux, not Windows. If you don't have a Linux machine available, a cheap virtual server from somewhere like DigitalOcean will do just fine. WSL or Docker may also work, though I haven't tried them myself.

hello, did I successfully added the library in the package? can you check the image below?😁

image

@mhsmith
Copy link
Member

mhsmith commented Aug 24, 2023

The message is telling you exactly what to check. You probably used a dash in the package name in meta.yaml, where you should have used an underscore.

@Randomboiii03
Copy link

Randomboiii03 commented Aug 24, 2023

The message is telling you exactly what to check. You probably used a dash in the package name in meta.yaml, where you should have used an underscore.

I red the instructions very carefully this time😅, why does it keep creating curl_cffi-0.0.0.dist-info instead of creating curl_cffi-0.5.7.dist-info that build-wheel required, did I miss anything?

image
image
image
image

@Randomboiii03
Copy link

@mhsmith can you check if I'm missing anything? btw this is my meta.yaml, thanks😁

package:
  name: curl_cffi
  version: 0.5.7
  
requirements:
  host:
    - python

@mhsmith
Copy link
Member

mhsmith commented Aug 28, 2023

Sorry for the slow reply. I'll have a look at this tomorrow.

@Randomboiii03
Copy link

Sorry for the slow reply. I'll have a look at this tomorrow.

No problem and thanks, I really need this package for my capstone project🎉

@Randomboiii03
Copy link

I apologize if I am not understanding the additional instructions. I am still a novice in this field, and I am really relying on this Python library for my project. Would you be able to add more details or provide some clarification? I think some people are waiting for this library to be added, so I would be grateful for your help.🎉

@mhsmith
Copy link
Member

mhsmith commented Aug 31, 2023

I'm looking at this issue right now, and I'll post an update in a few hours.

@mhsmith
Copy link
Member

mhsmith commented Aug 31, 2023

I've just pushed some updates to build-wheel which will fix this particular error. However, as the curl_cffi README says, this package is based on the curl-impersonate library, so you would have to build that first.

The relationship between cffi-curl and curl-impersonate would be similar to the existing packages pycurl and chaquopy-curl, so I suggest you look at those recipes.

If you need any more help, please don't post screenshots of text. Instead, copy and paste the text, and surround it with triple backticks as shown here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants