chaquo / chaquopy

Chaquopy: the Python SDK for Android
https://chaquo.com/chaquopy/
MIT License
797 stars 130 forks source link

Failed to install praat-parselmouth #508

Open emmanuel3wa opened 3 years ago

emmanuel3wa commented 3 years ago

Hello everyone

I will need to use a python script using the imports below.

import parselmouth from parselmouth.praat import call

I first use the code : python { pip { install "parselmouth" } }

Then i understand that parselmouth is not in the list of possible imports by chaquopy that I found at this address :

https://chaquo.com/pypi-7.0/

Do you have a solution to help me solve this problem?

Thank you in advance for the attention paid to my request.

mhsmith commented 3 years ago

Thanks for the report. I assume you mean praat-parselmouth the phonetics library, and not parselmouth the ad services library. This package isn't currently a priority, but I'll update this issue if we add it in the future. And if anyone else wants it too, please click the thumbs-up button above.

mhsmith commented 1 year ago

The package build tool is now open-source, so if you'd like to try building this package 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.

moariyenkhuien commented 1 year ago

hello, i really need use praat-parselmouth and i was unable to build this package with the build tool that you developed. i will be so grateful if you build this package and add it to the public repo.

mhsmith commented 1 year ago

i was unable to build this package with the build tool that you developed.

Please post the error message.

moariyenkhuien commented 1 year ago

when package is building with cmake i get this error:

../../../praat/sys/sendpraat.c:49:11: fatal error: 'X11/Xlib.h' file not found

include <X11/Xlib.h>

             ^~~~~~~~~~~~

1 error generated.

mhsmith commented 1 year ago

OK, please create a fork of this repository and push your meta.yaml file along with any patches, then post the link here.

moariyenkhuien commented 1 year ago

i didnt make any patches just the meta.yaml file

link

mhsmith commented 1 year ago

There's no way that file could work, because there's no such thing as numpy 23.5. Please push the actual file that produced your problem.

And make sure you're using the current version of the build tool, because it's had some fixes in the last few days.

mhsmith commented 1 year ago

OK, I've reproduced your error with the recipe in #961:

[1020/1428] Building C object praat/CMakeFiles/praat.dir/sys/sendpraat.c.o
FAILED: praat/CMakeFiles/praat.dir/sys/sendpraat.c.o   
/home/smith/git/chaquo/chaquopy/server/pypi/packages/praat-parselmouth/build/0.4.2/cp38-cp38-android_21_arm64_v8a/wrappers/aarch64-linux-android21-clang -DFMT_LOCALE -DNO_AUDIO -DNO_GRAPHICS -DNO_GUI -DNO_NETWORK -DPLATFORM_POSIX
 -DUNIX -D_FILE_OFFSET_BITS=64 -Dlinux -I../../../praat/external/clapack -I../../../praat/external/gsl -I../../../praat/external/glpk -I../../../praat/external/mp3 -I../../../praat/external/flac -I../../../praat/external/portaudi
o -I../../../praat/external/espeak -I../../../praat/external/vorbis -I../../../praat/external/opusfile -I../../../praat/kar -I../../../praat/melder -I../../../praat/sys -I../../../praat/dwsys -I../../../praat/stat -I../../../praa
t/fon -I../../../praat/dwtools -I../../../praat/LPC -I../../../praat/EEG -I../../../praat/gram -I../../../praat/FFNet -I../../../praat/artsynth -I../../../praat/external/opusfile/opus -I../../../praat/external/opusfile/opus/celt 
-I../../../praat/external/opusfile/opus/silk -I../../../praat/external/opusfile/opus/silk/float -I../../../extern/fmt/include -I/home/smith/git/chaquo/chaquopy/server/pypi/packages/praat-parselmouth/build/0.4.2/cp38-cp38-android_
21_arm64_v8a/requirements/chaquopy/include -idirafter /home/smith/git/chaquo/chaquopy/server/pypi/packages/praat-parselmouth/build/0.4.2/cp38-cp38-android_21_arm64_v8a/requirements/chaquopy/include/python3.8 -O3 -DNDEBUG -fPIC -f
visibility=hidden -pthread -Wno-trigraphs -Wno-logical-op-parentheses -Wno-shift-op-parentheses -std=gnu99 -MD -MT praat/CMakeFiles/praat.dir/sys/sendpraat.c.o -MF praat/CMakeFiles/praat.dir/sys/sendpraat.c.o.d -o praat/CMakeFile
s/praat.dir/sys/sendpraat.c.o -c ../../../praat/sys/sendpraat.c
../../../praat/sys/sendpraat.c:49:11: fatal error: 'X11/Xlib.h' file not found
        #include <X11/Xlib.h>
                 ^~~~~~~~~~~~

I don't have time to look into this any further, but obviously there will be no X11 support on Android. So the first question to ask is whether X11 is a core part of this package's functionality, or if it's only included conditionally. If it is conditional, see if you can work out where that condition is being determined, and how it can be fixed to disable the X11 feature.

Separately, the build failed on armeabi-v7a because of a missing ftello symbol. This is probably caused by an incorrect definition of _FILE_OFFSET_BITS, which you can find examples of in the patches of other recipes. Although it may be possible to fix many of these packages at once by editing build-common.sh to add -D_FILE_OFFSET_BITS=32 to the CFLAGS on the 32-bit ABIs.

moariyenkhuien commented 1 year ago

is there any chance that you build this package in future?

mhsmith commented 1 year ago

Only if someone provides a working recipe in a PR, but I don't have time to create one myself. See #961 for a starting point.

boomboompsh commented 1 month ago

I will continue this thread with what I have managed to do. Turns out you can just comment out the line "#include <X11/Xlib.h>" the code doesn't actually use Xlib if it is compiled with the nogui oprion, which it is. Of course then I ran into an issue with linking, it wasn't linking the python library, so I changed this line in setup.py: cmake_args=shlex.split(os.environ.get('PARSELMOUTH_EXTRA_CMAKE_ARGS', ' "')), to: cmake_args=shlex.split(os.environ.get('PARSELMOUTH_EXTRA_CMAKE_ARGS', '-DCMAKE_CXX_STANDARD_LIBRARIES="-L/home/boomboompsh/chaquopy/server/pypi/packages/praat-parselmouth/build/0.4.2/cp38-cp38-android_21_arm64_v8a/requirements/chaquopy/lib/ -lpython3.8"')),

After fixing that there was an error that I fixed by changing line 190 of praat-parselmouth/build/0.4.2/cp38-cp38-android_21_arm64_v8a/env/lib/python3.8/site-packages/skbuild/utils/init.py from old_threshold = distutils_log._global_log.threshold to old_threshold = distutils_log._global_log.level

haven't actually tested to see if it works yet, but at least all the compile time errors are gone. I can't figure out how to turn this into a recipe, I've just been doing manual modifications to the files

boomboompsh commented 1 month ago

Can confirm the wheel does actually work. I 'll slowly work on figuring out how patches are supposed to be made and PR my horrible hacky solution

mhsmith commented 3 weeks ago

To make a patch, see "If any changes are needed to make the build work" in the README. Patch files can be created with the diff tool.