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

gl-client #971

Open
adi-shankara opened this issue Sep 21, 2023 · 3 comments
Open

gl-client #971

adi-shankara opened this issue Sep 21, 2023 · 3 comments
Labels

Comments

@adi-shankara
Copy link

adi-shankara commented Sep 21, 2023

Chaquopy version

14.0.2

Relevant parts of your build.gradle file

App-level build.gradle file:

plugins {
    id 'com.android.application'
    id 'org.jetbrains.kotlin.android'
    id 'com.chaquo.python'
}

android {
    namespace 'com.example.myapp'
    compileSdk 33

    defaultConfig {
        applicationId "com.example.myapp"
        minSdk 21
        targetSdk 33
        versionCode 1
        versionName "1.0"
        ndk {
            abiFilters "x86", "arm64-v8a"
        }
        python {
            version "3.8"
            pip {
                install "setuptools"
                install "maturin"
            }
        }
    }
}

Project-level build.gradle file:

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        google()
        mavenCentral()
        maven { url "https://chaquo.com/maven" }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:8.1.1'
        classpath 'com.chaquo.python:gradle:14.0.2'
    }
}

plugins {
    id 'com.android.application' version '8.1.1' apply false
    id 'org.jetbrains.kotlin.android' version '1.8.10' apply false
    id 'com.chaquo.python' version '14.0.2' apply false
}

allprojects {
    repositories {
        google()
        mavenCentral()
    }
}

Describe your issue

The build fails with ModuleNotFoundError: No module named 'setuptools' error, even though it appears that setuptools module is available with chaquopy package repository? I already tried it with different python versions, but the build fails with the same error.

Build log:

> Task :app:generateDebugPythonRequirements
Chaquopy: Installing for arm64-v8a
Looking in indexes: https://pypi.org/simple, https://chaquo.com/pypi-7.0, https://chaquo.com/pypi-13.1
Collecting setuptools
  Using cached setuptools-68.2.2-py3-none-any.whl (807 kB)
Collecting maturin
  Using cached maturin-1.2.3.tar.gz (175 kB)
  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
  Getting requirements to build wheel: started
  Getting requirements to build wheel: finished with status 'done'
ERROR: Exception:
Traceback (most recent call last):
  File "/Users/User/AndroidStudioProjects/MyApp/app/build/generated/python/bp/pip/_internal/cli/base_command.py", line 188, in _main
    status = self.run(options, args)
             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/User/AndroidStudioProjects/MyApp/app/build/generated/python/bp/pip/_internal/cli/req_command.py", line 185, in wrapper
    return func(self, options, args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/User/AndroidStudioProjects/MyApp/app/build/generated/python/bp/pip/_internal/commands/install.py", line 335, in run
    requirement_set = resolver.resolve(
                      ^^^^^^^^^^^^^^^^^
  File "/Users/User/AndroidStudioProjects/MyApp/app/build/generated/python/bp/pip/_internal/resolution/legacy/resolver.py", line 179, in resolve
    discovered_reqs.extend(self._resolve_one(requirement_set, req))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/User/AndroidStudioProjects/MyApp/app/build/generated/python/bp/pip/_internal/resolution/legacy/resolver.py", line 362, in _resolve_one
    abstract_dist = self._get_abstract_dist_for(req_to_install)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/User/AndroidStudioProjects/MyApp/app/build/generated/python/bp/pip/_internal/resolution/legacy/resolver.py", line 314, in _get_abstract_dist_for
    abstract_dist = self.preparer.prepare_linked_requirement(req)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/User/AndroidStudioProjects/MyApp/app/build/generated/python/bp/pip/_internal/operations/prepare.py", line 433, in prepare_linked_requirement
    abstract_dist = _get_prepared_distribution(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/User/AndroidStudioProjects/MyApp/app/build/generated/python/bp/pip/_internal/operations/prepare.py", line 86, in _get_prepared_distribution
    abstract_dist.prepare_distribution_metadata(finder, build_isolation)
  File "/Users/User/AndroidStudioProjects/MyApp/app/build/generated/python/bp/pip/_internal/distributions/sdist.py", line 38, in prepare_distribution_metadata
    self._setup_isolation(finder)
  File "/Users/User/AndroidStudioProjects/MyApp/app/build/generated/python/bp/pip/_internal/distributions/sdist.py", line 97, in _setup_isolation
    reqs = backend.get_requires_for_build_wheel()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/User/AndroidStudioProjects/MyApp/app/build/generated/python/bp/pip/_vendor/pep517/wrappers.py", line 160, in get_requires_for_build_wheel
    return self._call_hook('get_requires_for_build_wheel', {
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/User/AndroidStudioProjects/MyApp/app/build/generated/python/bp/pip/_vendor/pep517/wrappers.py", line 265, in _call_hook
    raise BackendUnavailable(data.get('traceback', ''))
pip._vendor.pep517.wrappers.BackendUnavailable: Traceback (most recent call last):
  File "/Users/User/AndroidStudioProjects/MyApp/app/build/generated/python/bp/pip/_vendor/pep517/_in_process.py", line 86, in _build_backend
    obj = import_module(mod_path)
          ^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/[email protected]/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1126, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1140, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'setuptools'
@mhsmith
Copy link
Member

mhsmith commented Sep 21, 2023

Maturin is a build system for Rust. Since you won't actually be building any Rust code on an Android device, there's no useful purpose in adding it to your app.

Are you doing this because you actually want some other package? If so, please let me know which one.

@mhsmith mhsmith changed the title ModuleNotFoundError: No module named 'setuptools Maturin install fails: No module named 'setuptools' Sep 21, 2023
@adi-shankara
Copy link
Author

Indeed, I want to use the gl-client package. Had it there until it complained about maturin not found, and then setuptools not found. I removed gl-client package to narrow down on the culprit, but it seems you're suggesting that it is actually maturin that is causing this issue? What is the solution in that case? Please advise. Thanks for your prompt response.

@mhsmith
Copy link
Member

mhsmith commented Sep 22, 2023

gl-client contains Rust code, so it would have to be built into a wheel file.

If you'd like to try doing this yourself, the instructions are here. However, our package build tool doesn't currently have working support for Rust – see #1030 for details.

Or maybe you could use something else instead of gl-client, but since I don't see any documentation explaining what this package is or what it's for, I can't advise you on that.

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

@mhsmith mhsmith changed the title Maturin install fails: No module named 'setuptools' gl-client Sep 23, 2023
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

2 participants