Closed michiel5342 closed 3 years ago
You need to build and install the entire package — make install should do it if you’re in a virtualenv, otherwise some combination of python setup.py build and however you do your installs.
There’s a version tag in the c extension added by setup that must match the python code, or it won’t load. This prevents people from running with all forms of mismatched python and c extensions.
I studied setup.py and its options. I then tried to run "python3 setup.py build develop --user" and, hey, "python3 selftest.py" succeeds. Here the result of running selftest.py:
michiel@odin:~/Source/python/Pillow-master$ python3 selftest.py
--------------------------------------------------------------------
Pillow 8.3.0.dev0
Python 3.6.9 (default, Jan 26 2021, 15:33:00)
[GCC 8.4.0]
--------------------------------------------------------------------
Python modules loaded from /home/michiel/Source/python/Pillow-master/src/PIL
Binary modules loaded from /home/michiel/Source/python/Pillow-master/src/PIL
--------------------------------------------------------------------
--- PIL CORE support ok, compiled for 8.3.0.dev0
--- TKINTER support ok, loaded 8.6
--- FREETYPE2 support ok, loaded 2.8.1
--- LITTLECMS2 support ok, loaded 2.9
--- WEBP support ok, loaded 0.6.1
--- WEBP Transparency support ok
--- WEBPMUX support ok
--- WEBP Animation support ok
--- JPEG support ok, compiled for libjpeg-turbo 1.5.2
--- OPENJPEG (JPEG2000) support ok, loaded 2.2.0
--- ZLIB (PNG/ZIP) support ok, loaded 1.2.11
--- LIBTIFF support ok, loaded 4.0.9
*** RAQM (Bidirectional Text) support not installed
*** LIBIMAGEQUANT (Quantization method) support not installed
--- XCB (X protocol) support ok
--------------------------------------------------------------------
Running selftest:
--- 58 tests passed.
Nevertheless, after running "python3 setup.py install --user", which finished OK, running "python3 selftest.py" still gave the error.
After some hopeless fiddling I studied how selftest.py was using the built library, which was from the src/PIL project directory. That contained the built extension libs, which selftest.py found OK. So I decided to do an awful kludge, which I use to "install" my own projects: I copied the whole PIL directory, with python files and *.so's into my home local python lib, and look at that, my enhancement is running and testable ! I still have no idea, why setup does not succeed in installing. Anyhow, "works for me" so I am closing this issue. Please feel free to use the enhancement if you find it useful. My first testing results are very promising.
Develop is a misfeature for complicated projects, because it pollutes the paths and pulls in items which may or may not be part of the actual installed package.
I think you can make a bdist_wheel (to get a binary wheel) and then install that as a —user or otherwise.
What did you do?
I was trying to implement an imho trivial enhancement of the ModeFilter, which I would find useful for my use-case: despeckling of geography map scans. The enhancement consists of adding a second int arg: numpix, which decides how many same pixel values exist in the size box. This is hard coded as 2 in the existing filter, and could be altered up to 8 to prevent the filter obliterating map details. A value of 8 should only remove isolated pixels.
What did you expect to happen?
I expected a working and testable ModeFilter and Imaging library
What actually happened?
My code compiled all-right, but on running selftest.py I got an Import error saying the extension library did not have a PILLOW_VERSION attribute, and so the Pillow library cannot be imported.
What are your OS, Python and Pillow versions?