python-pillow / Pillow

Python Imaging Library (Fork)
https://python-pillow.org
Other
12.24k stars 2.23k forks source link

cannot import name '_imagingft' from 'PIL' #8433

Closed Gamerns10s closed 1 month ago

Gamerns10s commented 1 month ago

What did you do?

Running a bit to post images to twitter

What did you expect to happen?

It should have made images by receiving data from api

What actually happened?

It's receiving data but can't make images

What are your OS, Python and Pillow versions?

Termux with every module at its latest version

Please paste here the output of running:
![IMG_20241001_125812](https://github.com/user-attachments/assets/f1961610-11c4-43b7-90ea-ba68b682c0e4)

python3 -m PIL.report
or
python3 -m PIL --report

Or the output of the following Python code:

from PIL import report
# or
from PIL import features
features.pilinfo(supported_formats=False)
code goes here

Error πŸ‘‡πŸ‘‡ IMG_20240930_125511 Orignal codeπŸ‘‡πŸ‘‡ Screenshot_2024-10-01-12-54-46-922_com termux Screenshot_2024-10-01-12-54-56-569_com termux Screenshot_2024-10-01-12-55-10-225_com termux Screenshot_2024-10-01-12-55-19-797_com termux Screenshot_2024-10-01-12-55-27-590_com termux

radarhere commented 1 month ago

Hi. You do not have FreeType2 support setup for Pillow, on what I believe is your Android device.

How did you install Pillow? I suggest running apt-get install libfreetype6-dev and then installing Pillow again. If that doesn't work, could you copy and paste the command and output when you are installing Pillow?

Gamerns10s commented 1 month ago

Pillow was installed automatically because it was mentioned in the requirement file . Now before running the mentioned command I uninstalled pillow and then run the command you told but it gives me this error IMG_20241001_142616

radarhere commented 1 month ago

Ah. Ok, try apt-get install freetype-dev instead.

Gamerns10s commented 1 month ago

IMG_20241001_150927

radarhere commented 1 month ago

Next attempt.

apt-get update
apt-get install freetype-dev
python -m pip install Pillow
Gamerns10s commented 1 month ago

I just uninstalled termux and then reinstalled and cloned the bot once again but still it's the same IMG_20241001_184530 Mere

radarhere commented 1 month ago

Hmm, I think the error message is actually right. Try this?

apt-get install freetype
python -m pip install Pillow
Gamerns10s commented 1 month ago

Freetype was installed but pillow gave another error Screenshot_2024-10-01-19-12-21-150_com termux Screenshot_2024-10-01-19-12-32-010_com termux Screenshot_2024-10-01-19-12-39-982_com termux Screenshot_2024-10-01-19-12-47-613_com termux

radarhere commented 1 month ago

apt-get install libjpeg-turbo zlib

Gamerns10s commented 1 month ago

It was installed successfully what should I do next

Gamerns10s commented 1 month ago

Maybe everything related to pillow is fixed now but got another one which I think is of the main code IMG_20241001_231039

Yay295 commented 1 month ago

That looks like an error in your own code, not Pillow.

radarhere commented 1 month ago

It looks like fortnite-api.com isn't returning the data that the script expects.

If you would like to try and just make this work, you could change line 94 of bot.py to

if i.get('newDisplayAsset') != None:

However, there might be a bigger underlying problem that causes other issues as well. I suggest you update your question at https://github.com/FortniteFevers/Fortnite-Shop-Bot/issues/6

Gamerns10s commented 1 month ago

This above command didn't worked instead in the line 94 their was an extra space before the last bracket I removed it and that error got fixed but another one came stating about image development πŸ˜”

Gamerns10s commented 1 month ago

IMG_20241002_113502

radarhere commented 1 month ago

The key part of your error is

image file could not be identified because WEBP support not installed

Install webp, and then install Pillow again.

python -m pip uninstall Pillow
apt-get install webp
python -m pip install Pillow
Gamerns10s commented 1 month ago

IMG_20241002_164721

radarhere commented 1 month ago

Oh, sorry, libwebp

python -m pip uninstall Pillow
apt-get install libwebp
python -m pip install Pillow
Gamerns10s commented 1 month ago

It's already installed

Gamerns10s commented 1 month ago

When I tried doing pip install webp Screenshot_2024-10-02-16-55-39-242_com termux Screenshot_2024-10-02-16-55-46-983_com termux Screenshot_2024-10-02-16-55-50-561_com termux

radarhere commented 1 month ago

I don't think pip install webp is going to help. Instead, I have three ideas.

  1. Try installing Pillow without the cache - python -m pip install Pillow --no-cache-dir. Clearing the cache worked for someone else at https://github.com/termux/termux-packages/issues/11212

  2. If libwebp is installed, then webp/encode.h and libwebp.so or webp.so should exist on your device, it's just that Pillow can't find them. Can you find them?

If you can find webp/encode.h at /opt/local/include for example, and libwebp.so at /opt/local/lib for example,

then you can run

CFLAGS="-L/opt/local/lib -I/opt/local/include" python -m pip install Pillow
  1. Forget about trying to install through pip, and install just run
    apt-get install python-pillow
Gamerns10s commented 1 month ago

Thank you so much bro I did the first and the third step you stated and everything is working now Thank you so much brother πŸ˜ŠπŸ™