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

P4D in android platform module pip #53

Open
Walid-alg opened this issue Oct 12, 2024 · 7 comments
Open

P4D in android platform module pip #53

Walid-alg opened this issue Oct 12, 2024 · 7 comments
Assignees

Comments

@Walid-alg
Copy link

Walid-alg commented Oct 12, 2024

I have an issue with installing any external Python library; the pip module does not work on the Android platform. Is there a solution for this?

I try import pip module,
The message error is
"ModuleNotFoundError :No module named 'pip'"

https://en.delphipraxis.net/uploads/monthly_2024_10/Screenshot_20241001-194724.jpg.897cd6975d33ef829fe5d280707834d0.jpg
The module pip is working on fmx Windows plate-forme but not work in android platform

Thank you

@lmbelo
Copy link
Member

lmbelo commented Oct 12, 2024

Hello @Walid-alg, you must install pip before using it. There are two different components you can choose to install Pip: "GetPip" and "EnsurePip". You can find them alongside other PythonEnvironment components. Have in mind that non-pure Python packages won't be available to be installed using Pip.

@Walid-alg
Copy link
Author

bandicam.2024-10-12.20-30-06-265.mp4
SVID_20241013_044558_1.mp4

I have done this, but the PyTorch library was not downloaded, and also the code import pip module did not work.

@Walid-alg
Copy link
Author

Walid-alg commented Oct 13, 2024

I try install PyTorch library by code, I have this error :

SVID_20241013_194440_1.mp4
SVID_20241014_073407_1.mp4

@lmbelo
Copy link
Member

lmbelo commented Oct 15, 2024

PyTorch can't be installed from PIP on Android as there's no distribution. You must compile Torch for Android by yourself and distribute the result of your compilation alongside your app.

@lmbelo lmbelo self-assigned this Oct 15, 2024
@Walid-alg
Copy link
Author

PyTorch can't be installed from PIP on Android as there's no distribution. You must compile Torch for Android by yourself and distribute the result of your compilation alongside your app.

Thank you. I want to understand the role of general packages for Delphi, including MoviePy and others, such as the data science ecosystem libraries like numpy, pandas, etc. Do I need to compile each library, and what is the role of addOnGetPip?
Again, I appreciate it and send my regards to you.

@lmbelo
Copy link
Member

lmbelo commented Oct 21, 2024

@Walid-alg,

As I said, many packages distributed on PIP have not Android support, specially extension modules. Extension modules are C/C++ packages compiled against Python's interpreter. When you install this sort of packages, they are automatically compiled during installation, but this is not the case for Android. If you need to install a Python extension module on Android, you need to compile it agains a Python bundle compiled with Androids's toolchain, and then distribute it alongside your application.
We provide Python bundles for Android and also iOS. You can use them to compile your extension modules.

Note: This might be a complex task. Many extension modules like TensorFlow provide a guide and a version of the library to compile for Android.

@Walid-alg
Copy link
Author

you need to compile it agains a Python bundle compiled with Androids's toolchain, and then distribute it alongside your application.
How ti do it ?
What is the method? Thank you.

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

No branches or pull requests

2 participants