Closed Rudloff closed 8 years ago
You need to have the headers for the libraries as well, and more importantly, Pillow has to be able to find them. I'm not aware of Pillow being built for Android before, so it's entirely possible that the libraries/headers are not in the usual places.
There's a reasonable amount of information about how to install in the documentation, you're going to be in the building from source on linux section.
I do have the headers at /data/data/com.termux/files/usr/include/zlib.h
but it does not find them even if I specify the path manually with CFLAGS="-I/data/data/com.termux/files/usr/include/" pip install Pillow
.
Everything else seems to build correctly if I do python setup.py build_ext --disable-zlib
Then it's not finding the library. You should try installing from master, with python setup.py build_ext --debug
, which will show where it's looking for libraries and headers.
You were right, it was not looking in the right directory.
I had to run with LDFLAGS="-L/system/lib/"
and it worked.
Thanks for your help!
I have the same problem. but I did not understand how to solve.
I installed it like this:
LDFLAGS="-L/system/lib/" pip install Pillow
sorry. I'm starting developer. I'm in this directory /data/data/com.termux/files/usr/lib/python3.5/site-packages insert string LDFLAGS = "- L / system / lib /" pip install Pillow but I get the same error
Воскресенье, 7 августа 2016, 21:11 +04:00 от Pierre Rudloff notifications@github.com:
I installed it like this: LDFLAGS="-L/system/lib/" pip install Pillow — You are receiving this because you commented. Reply to this email directly, view it on GitHub , or mute the thread .
In my case, I had to install Pillow using the following command:
LDFLAGS="-L/system/lib/ -lm -lcompiler_rt" pip2 install Pillow --global-option="build_ext" --global-option="--disable-jpeg"
For this to work, you'll need to apt install python2-dev
first, if you haven't installed it already.
Notes:
Also, note that you don't really need to --disable-jpeg
(which disables JPEG support). You can just apt install libjpeg-turbo-dev
(or openjpeg-dev
), and it should be good to go :)
After trying a lot of solutions, the one which works for me was
LDFLAGS="-L/system/lib/" CFLAGS="-I/data/data/com.termux/files/usr/include/" pip install Pillow
But I don't know yet if it's only due to it or caused by a combination... Anyway if it can help!
I don't have "/data/data/com.termux/files/usr/include/zlib.h" on my Zenfone 2. Is that possible to install Pillow on a Zenfone 2?
@biazzotto I think you need to install the ndk-sysroot
package in Termux.
It does the trick:
$ pkg install python libjpeg-turbo libcrypt ndk-sysroot clang zlib
$ LDFLAGS="-L${PREFIX}/lib/" CFLAGS="-I${PREFIX}/include/" pip install --upgrade wheel pillow
Thank you, @Russell-Jones-OxPhys, for the fixes...
install successfully when i tried other devices it fail with pip2
Guys!!! I don't have zlib.h in my Android... How can I get this file???
@mAfnanm You need to install the ndk-sysroot
package (if you are using Termux, if not you need to manually get it from the Android NDK).
Using this command It works properly!
LDFLAGS="-L/system/lib/ -lm -lcompiler_rt" pip2 install Pillow --global-option="build_ext" --global-option="--disable-jpeg"
Thanks haha but i have another arror,my module requests is missing Can anyone tell me what is it?
@XSecr3t https://pypi.org/project/requests/
@radarHere i already installed pillow But new error show up
Requests module not found,otherwise i already installed too in my termux Clarifai not found Grpcio not found
@XSecr3t I'm having a bit of trouble understanding you. You say that you have installed Pillow successfully. You then asked what the 'requests' module was, to which I have linked. If you're asking what 'clarifai' and 'grpcio' are, they also look like modules - https://pypi.org/project/clarifai/ and https://pypi.org/project/grpcio/. None of these have to do with Pillow however, so they are requirements from another part of your program.
@radarhere but it should be installed on my termux,cause the program that i want installed need that both of modules. That's why i need both of that modules
So what i gonna do?
Hello, I'm trying to install Pillow on Termux (current F-Droid version) for Lineage 15.1 (not rooted). I installed the following packages without problem:
pkg install python python-dev libjpeg-turbo-dev libcrypt-dev ndk-sysroot clang
Then I tried the following:
LDFLAGS="-L/system/lib/" CFLAGS="-I/data/data/com.termux/files/usr/include/" pip install wheel pillow
I still get the error:
The headers or library files could
not be found for zlib,
a required dependency
when compiling Pillow from source.
When I add the" disable-zlib" option, pillow is installed successfully.. But that's no solution as I want to work with png files.
Inside the folder /data/data/com.termux/files/usr/lib I can find the file libz.so.1.2.11 As well as two symlinks to it libz.so libz.so.1
I checked the folder /data/data/com.termux/files/usr/include, there are no zlib related files inside. Shouldn't the zlib.h file be here? what else could be going wrong?
I think you need to install zlib-dev
.
Thanks for the quick answer! :-)
zlib.h now exists in the include folder and installation worked without problems.
how to install zlib-dev?
pkg install zlib-dev
Together with the other dependencies that would be:
pkg install python python-dev libjpeg-turbo-dev libcrypt-dev ndk-sysroot clang zlib-dev
(although it seems that libcrypt-dev is not mandatory for installation)
And also I did not need all the pip flags anymore, simply pip install pillow
did it.
I've the same problem,finally I try: pkg install libcrypt libjpeg-turbo clang then: pip install Pillow , all is ok,good luck
Looks like termux has changed the arrangement of files, at least for some Android versions/ARM CPU versions.
I needed pkg install libjpeg-turbo clang ndk-root libcrypt zlib python
(no -dev packages) then
export LDFLAGS='-L/data/data/com.termux/files/usr/lib/'
export CFLAGS='-I/data/data/com.termux/files/usr/include/'
not /system/lib
(which caused linking problems? it contains 32-bit binaries, anyway) or /system/lib64/
Then I was able to pip install Pillow.
I can't install Pillow on my termux, some of the errors:
ERROR: Exception:
Traceback (most recent call last):
File "/data/data/com.termux/files/usr/lib/python3.7/site-packages/pip/_vendor/urllib3/response.py", line 397, in _error_catcher yield
File "/data/data/com.termux/files/usr/lib/python3.7/site-packages/pip/_vendor/urllib3/response.py", line 479, in read data = self._fp.read(amt)
File "/data/data/com.termux/files/usr/lib/python3.7/site-packages/pip/_vendor/cachecontrol/filewrapper.py", line 62, in read data = self.__fp.read(amt)
File "/data/data/com.termux/files/usr/lib/python3.7/http/client.py", line 457, in read n = self.readinto(b)
File "/data/data/com.termux/files/usr/lib/python3.7/http/client.py", line 501, in readinto n = self.fp.readinto(b)
File "/data/data/com.termux/files/usr/lib/python3.7/socket.py", line 589, in readinto return self._sock.recv_into(b)
File "/data/data/com.termux/files/usr/lib/python3.7/ssl.py", line 1071, in recv_into return self.read(nbytes, buffer)
File "/data/data/com.termux/files/usr/lib/python3.7/ssl.py", line 929, in read return self._sslobj.read(len, buffer) socket.timeout: The read operation timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/data/data/com.termux/files/usr/lib/python3.7/site-packages/pip/_internal/cli/base_command.py", line 188, in main status = self.run(options, args) File "/data/data/com.termux/files/usr/lib/python3.7/site-packages/pip/_internal/commands/install.py", line 345, in run resolver.resolve(requirement_set)
File "/data/data/com.termux/files/usr/lib/python3.7/site-packages/pip/_internal/legacy_resolve.py", line 196, in resolve self._resolve_one(requirement_set, req)
File "/data/data/com.termux/files/usr/lib/python3.7/site-packages/pip/_internal/legacy_resolve.py", line 359, in _resolve_one abstract_dist = self._get_abstract_dist_for(req_to_install)
File "/data/data/com.termux/files/usr/lib/python3.7/site-packages/pip/_internal/legacy_resolve.py", line 307, in _get_abstract_dist_for self.require_hashes
File "/data/data/com.termux/files/usr/lib/python3.7/site-packages/pip/_internal/operations/prepare.py", line 199, in prepare_linked_requirement progress_bar=self.progress_bar
File "/data/data/com.termux/files/usr/lib/python3.7/site-packages/pip/_internal/download.py", line 1064, in unpack_url progress_bar=progress_bar
File "/data/data/com.termux/files/usr/lib/python3.7/site-packages/pip/_internal/download.py", line 924, in unpack_http_url progress_bar)
install micro and try again
install successfully when i tried other devices it fail with pip2
Sorry for the totally out of topic, but I couldn't find any other way than this one to contact you... what is your keyboard application ??? I looked the whole web and didnt found ! I'm interested ^^ thank you by advance
pkg install zlib-dev
Together with the other dependencies that would be:
pkg install python python-dev libjpeg-turbo-dev libcrypt-dev ndk-sysroot clang zlib-dev
(although it seems that libcrypt-dev is not mandatory for installation)
And also I did not need all the pip flags anymore, simply
pip install pillow
did it.
Thanks. Worked for me 😁
Looks like termux has changed the arrangement of files, at least for some Android versions/ARM CPU versions. I needed
pkg install libjpeg-turbo clang ndk-root libcrypt zlib python
(no -dev packages) thenexport LDFLAGS='-L/data/data/com.termux/files/usr/lib/' export CFLAGS='-I/data/data/com.termux/files/usr/include/'
not
/system/lib
(which caused linking problems? it contains 32-bit binaries, anyway) or/system/lib64/
Then I was able to pip install Pillow.
Just tried this again with my new 3.8.0 virtualenv, and it still works. This is on a Moto G7 which uname -a
indicates is aarch64
Pixel 3a XL running Android 10. As mentioned above, the -dev packages don't seem to be necessary anymore to get Pillow to install. I got mine installed with just:
pkg install python libjpeg-turbo libcrypt ndk-sysroot clang zlib
Some of these were redundant and already installed, but afterwards Pillow no longer threw a fit.
The docs have just been updated in https://github.com/python-pillow/Pillow/pull/4209 to remove mention of the dev packages.
@crtrue Your solution fixed it for me :))
actual on 7 July 2020,
pkg install python libjpeg-turbo libcrypt ndk-sysroot clang zlib
pip install pillow
thanks @crtrue
Try this, if wheel problem arise:
pip install wheel
pkg install libjpeg-turbo LDFLAGS="-L/system/lib/" CFLAGS="-I/data/data/com.termux/files/usr/include/" pip install Pillow
Credit: 💻Stackoverflow
@zexxxer-prog & @alexdeathway None of your trick works for me. See :
-- EDIT --
Okay sorry, this was GCC related in my case ! I used gcc latest (v10) instead of gcc-8, and the install of pillow worked like a charm with pip install pillow
:D so thank you !
What did you do?
I'm running Python on Android (with Termux). I'm trying to install Pillow by running
pip install Pillow
.What did you expect to happen?
Install Pillow.
What actually happened?
What versions of Pillow and Python are you using?
I'm running Python 3.5.1. I'm trying to install Pillow 3.2.0.
From what I understand, zlib is already included in Android so I shouldn't need to install it.