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

Pillow Python 3 compile error #1679

Closed
homdx opened this issue Feb 5, 2019 · 5 comments
Closed

Pillow Python 3 compile error #1679

homdx opened this issue Feb 5, 2019 · 5 comments

Comments

@homdx
Copy link

homdx commented Feb 5, 2019

Hello

If I use requirements==pillow for python3 api28ndk21, I give error:

[INFO]:    -> directory context /home/userhome/.local/share/python-for-android/build/other_builds/pil-python3/armeabi-v7a__ndk_target_21/pil
[INFO]:    -> running python setup.py build_ext -v
           working: SyntaxError: Missing parentheses in call to 'print'. Did you mean print("--- using Tcl/Tk libraries at", TCL_ROOT)?                    Exception in thread background thread for pid 21013:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 754, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/usr/local/lib/python2.7/dist-packages/sh-1.12.14-py2.7.egg/sh.py", line 1540, in wrap
    fn(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/sh-1.12.14-py2.7.egg/sh.py", line 2459, in background_thread
    handle_exit_code(exit_code)
  File "/usr/local/lib/python2.7/dist-packages/sh-1.12.14-py2.7.egg/sh.py", line 2157, in fn
    return self.command.handle_command_exit_code(exit_code)
  File "/usr/local/lib/python2.7/dist-packages/sh-1.12.14-py2.7.egg/sh.py", line 815, in handle_command_exit_code
    raise exc
ErrorReturnCode_1: 

  RAN: /home/userhome/.local/share/python-for-android/build/other_builds/hostpython3/desktop/hostpython3/native-build/python setup.py build_ext -v

  STDOUT:
  File "setup.py", line 159
    print "--- using Tcl/Tk libraries at", TCL_ROOT
                                        ^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print("--- using Tcl/Tk libraries at", TCL_ROOT)?


  STDERR:


Traceback (most recent call last):                                                                                                                         
  File "/usr/local/bin/p4a", line 11, in <module>
    load_entry_point('python-for-android==0.7.1', 'console_scripts', 'p4a')()
  File "/usr/local/lib/python2.7/dist-packages/python_for_android-0.7.1-py2.7.egg/pythonforandroid/toolchain.py", line 1051, in main
    ToolchainCL()
  File "/usr/local/lib/python2.7/dist-packages/python_for_android-0.7.1-py2.7.egg/pythonforandroid/toolchain.py", line 560, in __init__
    getattr(self, args.subparser_name.replace('-', '_'))(args)
  File "/usr/local/lib/python2.7/dist-packages/python_for_android-0.7.1-py2.7.egg/pythonforandroid/toolchain.py", line 151, in wrapper_func
    build_dist_from_args(ctx, dist, args)
  File "/usr/local/lib/python2.7/dist-packages/python_for_android-0.7.1-py2.7.egg/pythonforandroid/toolchain.py", line 192, in build_dist_from_args
    build_recipes(build_order, python_modules, ctx)
  File "/usr/local/lib/python2.7/dist-packages/python_for_android-0.7.1-py2.7.egg/pythonforandroid/build.py", line 565, in build_recipes
    recipe.build_arch(arch)
  File "/usr/local/lib/python2.7/dist-packages/python_for_android-0.7.1-py2.7.egg/pythonforandroid/recipe.py", line 889, in build_arch
    self.build_compiled_components(arch)
  File "/usr/local/lib/python2.7/dist-packages/python_for_android-0.7.1-py2.7.egg/pythonforandroid/recipe.py", line 901, in build_compiled_components
    _env=env, *self.setup_extra_args)
  File "/usr/local/lib/python2.7/dist-packages/python_for_android-0.7.1-py2.7.egg/pythonforandroid/logger.py", line 178, in shprint
    for line in output:
  File "/usr/local/lib/python2.7/dist-packages/sh-1.12.14-py2.7.egg/sh.py", line 863, in next
    self.wait()
  File "/usr/local/lib/python2.7/dist-packages/sh-1.12.14-py2.7.egg/sh.py", line 792, in wait
    self.handle_command_exit_code(exit_code)
  File "/usr/local/lib/python2.7/dist-packages/sh-1.12.14-py2.7.egg/sh.py", line 815, in handle_command_exit_code
    raise exc
sh.ErrorReturnCode_1: 

  RAN: /home/userhome/.local/share/python-for-android/build/other_builds/hostpython3/desktop/hostpython3/native-build/python setup.py build_ext -v

  STDOUT:
  File "setup.py", line 159
    print "--- using Tcl/Tk libraries at", TCL_ROOT
                                        ^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print("--- using Tcl/Tk libraries at", TCL_ROOT)?


  STDERR:

Env by @Jonast
https://github.com/JonasT/p4a-build-spaces
p4aspaces shell p4a-py3-api28ndk21

#apt list --installed|grep tcl

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

libtcl8.6/bionic,now 8.6.8+dfsg-3 amd64 [installed,automatic]
tcl/bionic,now 8.6.0+9 amd64 [installed,automatic]
tcl-dev/bionic,now 8.6.0+9 amd64 [installed]
tcl8.6/bionic,now 8.6.8+dfsg-3 amd64 [installed,automatic]
tcl8.6-dev/bionic,now 8.6.8+dfsg-3 amd64 [installed,automatic]
# apt list --installed|grep tk 

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

gtk-update-icon-cache/bionic,now 3.22.30-1ubuntu1 amd64 [installed,automatic]
libatk-bridge2.0-0/bionic,now 2.26.2-1 amd64 [installed,automatic]
libatk-wrapper-java/bionic,bionic,now 0.33.3-20ubuntu0.1 all [installed,automatic]
libatk-wrapper-java-jni/bionic,now 0.33.3-20ubuntu0.1 amd64 [installed,automatic]
libatk1.0-0/bionic,now 2.28.1-1 amd64 [installed,automatic]
libatk1.0-data/bionic,bionic,now 2.28.1-1 all [installed,automatic]
libgtk-3-0/bionic,now 3.22.30-1ubuntu1 amd64 [installed,automatic]
libgtk-3-bin/bionic,now 3.22.30-1ubuntu1 amd64 [installed,automatic]
libgtk-3-common/bionic,bionic,now 3.22.30-1ubuntu1 all [installed,automatic]
libtk8.6/bionic,now 8.6.8-4 amd64 [installed,automatic]
tk/bionic,now 8.6.0+9 amd64 [installed,automatic]
tk-dev/bionic,now 8.6.0+9 amd64 [installed]
tk8.6/bionic,now 8.6.8-4 amd64 [installed,automatic]
tk8.6-dev/bionic,now 8.6.8-4 amd64 [installed,automatic]
@AndreMiras
Copy link
Member

Your log doesn't provide enough context to really help. Could you share the entire compilation log, including the command line you typed?

@homdx
Copy link
Author

homdx commented Feb 6, 2019

@AndreMiras another error(

[INFO]:    Dist can be found at (for now) /home/userhome/.local/share/python-for-android/dists/unnamed_dist_4
[INFO]:    No existing dists meet the given requirements!
Traceback (most recent call last):
  File "/home/userhome/.local/bin/p4a", line 10, in <module>
    sys.exit(main())
  File "/home/userhome/.local/lib/python3.6/site-packages/pythonforandroid/toolchain.py", line 1051, in main
    ToolchainCL()
  File "/home/userhome/.local/lib/python3.6/site-packages/pythonforandroid/toolchain.py", line 560, in __init__
    getattr(self, args.subparser_name.replace('-', '_'))(args)
  File "/home/userhome/.local/lib/python3.6/site-packages/pythonforandroid/toolchain.py", line 152, in wrapper_func
    func(self, args)
  File "/home/userhome/.local/lib/python3.6/site-packages/pythonforandroid/toolchain.py", line 811, in apk
    build = imp.load_source('build', join(dist.dist_dir, 'build.py'))
  File "/usr/lib/python3.6/imp.py", line 172, in load_source
    module = _load(spec)
  File "<frozen importlib._bootstrap>", line 684, in _load
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 674, in exec_module
  File "<frozen importlib._bootstrap_external>", line 780, in get_code
  File "/usr/lib/python3.6/imp.py", line 158, in get_data
    return super().get_data(path)
  File "<frozen importlib._bootstrap_external>", line 832, in get_data
FileNotFoundError: [Errno 2] No such file or directory: '/home/userhome/.local/share/python-for-android/dists/unnamed_dist_5/build.py'

fulllog2.txt

For reproduce:
p4aspaces shell p4a-py3-api28ndk21
$git clone https://github.com/HeaTTheatR/KivyMD.git
$cd KivyMD/demos/kitchen_sink
$cat .p4a
--arch=armeabi-v7a
--name test
--package com.example.test
--version 1
--requirements kivy==1.10.1,python3,pillow,git+https://github.com/HeaTTheatR/KivyMD.git
--private .
$time -p p4a apk 

@AndreMiras
Copy link
Member

It's pretty weird, the full log doesn't seem to show the same error as the one you shared initiall 🤔
Maybe it's related to p4spaces and you should check with @Jonast in this case.
I've tried compiling Pillow in the Docker env and it seemed to work just fine. The command was:

python setup_testapp_python3.py apk --sdk-dir $ANDROID_SDK_HOME --ndk-dir $ANDROID_NDK_HOME --bootstrap sdl2 --requirements python3,kivy,Pillow

Maybe you could try again with a clean env?

@RobertFlatt
Copy link
Contributor

I compiled Pillow with python-for-android (master) installed 2/2/2019

In general, for me, recipe builds depend on:
sudo apt-get install -y autoconf libtool cmake libffi-dev pkg-config libjpeg9-dev python3-pil

Pillow puts the following in the apk:

   assets/_python_bundle/site-packages/easy_install.pyc
   assets/_python_bundle/site-packages/jnius_config.pyc
   assets/_python_bundle/site-packages/PIL/*
   assets/_python_bundle/site-packages/setup.pyc
   assets/_python_bundle/site-packages/six.pyc
   lib/armeabi-v7a/libhidapi.so
   assets/_python_bundle/modules/_sysconfigdata_m_linux_.pyc

The error message you post seems to imply a Python2 pil, no idea if that is real or relevant.

@inclement
Copy link
Member

inclement commented Feb 10, 2019

other_builds/pil-python3

The log seems to indicate pil is being built, not pillow. If the error still occurs with python-for-android master after cleaning everything, please post the full build log.

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

4 participants