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

Unable to follow chaquopy-getting-started guide #164

Closed
Raghu17s opened this issue Nov 8, 2019 · 22 comments
Closed

Unable to follow chaquopy-getting-started guide #164

Raghu17s opened this issue Nov 8, 2019 · 22 comments

Comments

@Raghu17s
Copy link

Raghu17s commented Nov 8, 2019

Hi,

I am following the steps provided at https://chaquopy-getting-started.readthedocs.io/index.html
but I am getting multiple errors while running the app. The screenshot of error is attached.

image

@mhsmith
Copy link
Member

mhsmith commented Nov 8, 2019

https://chaquopy-getting-started.readthedocs.io is an unofficial guide written by someone else, and is now well out of date. I suggest you work from the official documentation instead.

If you still have issues, please post the full build log. You can switch the Build window to text mode by clicking the "toggle view" button (below the green "build" button on the left side of your screenshot).

@mhsmith mhsmith mentioned this issue Nov 8, 2019
@Raghu17s
Copy link
Author

Raghu17s commented Nov 12, 2019 via email

@mhsmith
Copy link
Member

mhsmith commented Nov 12, 2019

We don't have any video tutorials. But if you're a beginner, then rather than creating a new app from scratch, the easiest way for you to get started would be to copy one of the open-source example apps linked here.

@mhsmith mhsmith closed this as completed Nov 12, 2019
@Raghu17s
Copy link
Author

Raghu17s commented Nov 16, 2019 via email

@mhsmith
Copy link
Member

mhsmith commented Nov 16, 2019

You can't send images to GitHub via email. Upload them on the website by dragging them into the text box.

@mhsmith mhsmith reopened this Nov 16, 2019
@Raghu17s
Copy link
Author

have downloaded chaquopy-hello and imported it in an android studio. I have installed python plugin too. While running the app it shows en error Excetutable is not specified.

The following error shows in "edit configuration" whale running.

image

@mhsmith
Copy link
Member

mhsmith commented Nov 18, 2019

The Python plugin in Android Studio will only provide basic syntax highlighting, and internal navigation within a file. It can't be used to actually run your code. Since the project is an Android app, you'll have to run it by installing that app on a device or emulator.

Normally this would be done using a run configuration with the type "Android app" and the name "app", but this isn't showing in your screenshot, so I think you must have opened the project in the wrong way. Specifically, the root directory of your project should be the root directory of the Git repository, but your screenshot is showing one level above that.

Just choose File > Open and select the root directory of the repository (the directory immediately above "app" and "gradle").

@Raghu17s
Copy link
Author

Raghu17s commented Nov 19, 2019

Hi Smith,

Great!
Yes, It's working now. I have installed it on my device.
My aim is to load the .csv file and do some feature extraction and a bit of machine learning (SVM) using the app and display the results. I have the working model written in python.

I tried steps discussed at chaquo/chaquopy-hello#2
but I am unable to find MainActivity.java. to call my python file.
The one which is under "build" shows "files under the build folder are generated and should not be edited.

TIA

@mhsmith
Copy link
Member

mhsmith commented Nov 19, 2019

If you have an existing text-based Python script, then it would be easier to start with the console template instead. In fact, from your screenshot above, it looks like you were already doing that before.

@Raghu17s
Copy link
Author

Raghu17s commented Nov 19, 2019

Great, it's working now.
I hope this will solve my need.

I have few more quaries

  1. How can I make a push button to load csv file from the folder? And I need to access that data into my Python file.

  2. When I do install "scikit-learn" in pip, I am getting this error.
    ERROR: Process 'command 'py'' finished with non-zero exit value 1. For full details, open the 'Build' window and switch to text mode with the 'Toggle view' button on the left.

@mhsmith
Copy link
Member

mhsmith commented Nov 20, 2019

How can I make a push button to load csv file from the folder?

You'd have to create an Android activity, for which there are many tutorials elsewhere. I recommend you program the UI in Java or Kotlin and access Python through the PyObject API, as demonstrated here. However, if you wish, you can also write the whole activity in Python, as demonstrated here.

And I need to access that data into my Python file.

See #144.

When I do install "scikit-learn" in pip, I am getting this error.
ERROR: Process 'command 'py'' finished with non-zero exit value 1. For full details, open the 'Build' window and switch to text mode with the 'Toggle view' button on the left.

Please provide the "full details" as the message says.

@Raghu17s
Copy link
Author

Raghu17s commented Nov 21, 2019

I am following #144 and using Chaquopy 6.3.0
I have placed the graph1.txt file in chaquopy-console-master\app\src\main\python.
My code is
from os.path import dirname, join
f = open(join(dirname('src/main/python'),'graph1.txt'))

It throws a following error in the device after running
Exception in thread Thread-1:
Traceback (most recent call last):
  File "stdlib/threading.py", line 916, in _bootstrap_inner
  File "stdlib/threading.py", line 864, in run
  File "/data/user/0/com.chaquo.python.console/files/chaquopy/AssetFinder/app/chaquopy/utils/console.py", line 14, in
  File "class.pxi", line 695, in java.chaquopy.JavaMethod.get.lambda2
  File "class.pxi", line 715, in java.chaquopy.JavaMethod.call
  File "class.pxi", line 805, in java.chaquopy.JavaMethod.call_nonvirtual_method
  File "env.pxi", line 242, in java.chaquopy.CQPEnv.CallNonvirtualVoidMethodA
  File "env.pxi", line 484, in java.chaquopy.CQPEnv.check_exception
com.chaquo.python.PyException: FileNotFoundError: [Errno 2] No such file or directory: 'src/main/graph1.txt'
at .main.main(main.py:13)
at .chaquopy_java.call(chaquopy_java.pyx:283)
at .chaquopy_java.Java_com_chaquo_python_PyObject_callAttrThrows(chaquopy_java.pyx:255)
at com.chaquo.python.PyObject.callAttrThrows(Native Method)
at com.chaquo.python.PyObject.callAttr(PyObject.java:207)
at com.chaquo.python.console.MainActivity$Task.run(MainActivity.java:18)
at com.chaquo.python.utils.ConsoleActivity$Task$1.run(ConsoleActivity.java:352)

@mhsmith
Copy link
Member

mhsmith commented Nov 21, 2019

You should be using __file__. Please read #144 more carefully.

@Raghu17s
Copy link
Author

I have used install "scikit-learn==0.21.2" in pip

I am getting following error.

Could not install packages due to an EnvironmentError: [Errno 2] No such file or directory: 'G:\PhD UM 2017-2019\Programs\Objective 2\Python\chaquopy-console-master\chaquopy-console-master\app\build\generated\python\requirements\debug\armeabi-v7a\sklearn\datasets\tests\data\openml\1119\api-v1-json-data-list-data_name-adult-census-limit-2-data_version-1.json.gz'

Chaquopy: Exit status 1

Task :app:generateDebugPythonRequirements FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':app:generateDebugPythonRequirements'.

Process 'command 'py'' finished with non-zero exit value 1. For full details, open the 'Build' window and switch to text mode with the 'Toggle view' button on the left.

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 1m 18s
4 actionable tasks: 1 executed, 3 up-to-date

@mhsmith
Copy link
Member

mhsmith commented Nov 22, 2019

You've encountered the Windows 260-character filename limit (pypa/pip#6279).

Try moving your project from G:\PhD UM 2017-2019\Programs\Objective 2\Python\chaquopy-console-master\chaquopy-console-master to somewhere with a shorter path. Even just removing the redundant chaquopy-console-master might be good enough.

@mhsmith
Copy link
Member

mhsmith commented Nov 22, 2019

Please create separate GitHub issues for separate problems in future.

@mhsmith mhsmith closed this as completed Nov 22, 2019
@Simba167657
Copy link

Simba167657 commented Apr 17, 2020

I have one project including both Python, Android files that have same functions.
I want to compare the results by running the app using Chaquopy with each Python and Android.

image

@mhsmith
Copy link
Member

mhsmith commented Apr 17, 2020

If you have a question or problem, please create a separate issue and explain what it is.

@AbsolutelySaurabh
Copy link

AbsolutelySaurabh commented Jul 26, 2020

            pip {
                install "numpy"
                install "imutils"
                install "opencv-python"
                install "pickle-mixin"
                install "scikit-learn==0.22.1"
            }

For chaquopy version 8.0.0 this is the latest version of scikit-learn supported.

@mhsmith
Copy link
Member

mhsmith commented Jul 26, 2020

0.22.1 is the scikit-learn version for the current version of Chaquopy (7.x or newer). For Chaquopy 6.x and older, the version was 0.21.2.

@dasprasky
Copy link

dasprasky commented Jan 13, 2021

I am trying to use Chaquopy in multiple android projects but I always get the following error:

Build file 'C:\Users\prase\AndroidStudioProjects\TWSDemo\app\build.gradle' line: 4

A problem occurred evaluating project ':app'.
> No signature of method: build_19w8as9b2aebodjaw1i39scyz.android() is applicable for argument types: (build_19w8as9b2aebodjaw1i39scyz$_run_closure1) values: [build_19w8as9b2aebodjaw1i39scyz$_run_closure1@5f245830]

I followed the documentation till the ABI selection part and tried to build the project. What am I doing wrong?

@mhsmith
Copy link
Member

mhsmith commented Jan 13, 2021

Please create a new issue and include your app\build.gradle file.

@mhsmith mhsmith changed the title Unable to run the app in android studio using Chaquopy Unable to follow chaquopy-getting-started guide Jan 13, 2021
@chaquo chaquo locked and limited conversation to collaborators Jan 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants