zhiyiYo / PyQt-Fluent-Widgets

A fluent design widgets library based on C++ Qt/PyQt/PySide. Make Qt Great Again.
https://qfluentwidgets.com
GNU General Public License v3.0
5.68k stars 550 forks source link

[Bug]: Installation problem: Pillow version not compatible with Python version #715

Closed 3rdPix closed 9 months ago

3rdPix commented 9 months ago

What happened?

When trying to install with pip install "PyQt6-Fluent-Widgets[full]" -i https://pypi.org/simple/. It finds an error at the very end with the Pillow library. In requirements it is expressed that pillow version should be <=9.4.0... why do you keep that? Is there a backwards compatibility problem with newer versions? In the pillow site its expressed that newer python versions only work with Pillow >= 10.1. See:

image

On this matter, is there a reason you keep pillow in older versions? Could we just use the newer version?

Operation System

Windows 23H2

Python Version

Python 3.12.1

PyQt/PySide Version

PyQt6

PyQt/PySide-Fluent-Widgets Version

1.4.5

How to Reproduce?

During installation

Minimum code

Does not apply.
3rdPix commented 9 months ago

AUTO-UPDATE

I manually installed the latest versions of all the dependencies. Including Pillow and Frameless-Window. There is no need to add version restriction, newer versions will work just fine. This needs to be updated in the setup and requirements files so that it does not cause wheel errors whilst installing fluent widgets.

Here you can see the version list with pip and the fluent window working normally:

image

The main issue was the Pillow package, but again, there is no need to restrict the requirement to older versions. I suggest to change it, and let it install the latest version.

zhiyiYo commented 9 months ago

See https://github.com/zhiyiYo/PyQt-Fluent-Widgets/issues/376

zhiyiYo commented 9 months ago

Image.fromqpixmap(QPixmap(image)) will raise an exception if the version of pillow >= 9.4.0 and PyQt <= 5.15.10, maybe I should use another way to convert QPixmap to Image

3rdPix commented 9 months ago

You're right! But in this case I was only referring to PyQt6 branch (where obviously PyQt > 5.15.10)... maybe apply the change only on that deployment?

zhiyiYo commented 9 months ago

Sorry, Image.fromqpixmap(QPixmap(image)) will raise an exception if the version of pillow >= 9.4.0 and PyQt > 5.15.2. PyQt6 has not been tested.

zhiyiYo commented 9 months ago

I checked the source code of PIL, and found that high version PIL only supports PyQt6/PySide6. image

zhiyiYo commented 9 months ago

But Pillow 9.4.0 supports all Qt bindings. This is weird. image

This is the deprecate proposal of Pillow: https://github.com/python-pillow/Pillow/pull/6237

zhiyiYo commented 9 months ago

This is the conversion method, I will add it to my repo: image

3rdPix commented 9 months ago

I was just checking the same! Here you can see the exact commit where they stopped supporting PyQt5:

https://github.com/python-pillow/Pillow/commit/59c9d87f8a4d8443a482ca7abb5f1f8d5d970cbd https://github.com/python-pillow/Pillow/commits/main/src/PIL/ImageQt.py

image

I think the solution should be to make a clear differentiation between the PyQt5 and the PyQt6 branch. Modifying the setup.py so that it takes into account that newer versions of Pillow support PyQt6 only instead of PyQt5.

I think that is a better approach than to hard-code by copying the method from Pillow.

zhiyiYo commented 9 months ago

V1.4.6 has removed restrictions on the PIL version

3rdPix commented 9 months ago

Just saw the commit. Installation for PyQt6 now working perfectly with latest version of Pillow:

image

Thanks!