maximkulkin / esp-homekit

Apple HomeKit accessory server library for ESP-OPEN-RTOS
MIT License
1.1k stars 169 forks source link

PIL.Image #87

Closed AchimPieters closed 5 years ago

AchimPieters commented 5 years ago

Hi,

I have a problem when trying to make a QR code for one of my devices. When I run your code as you describe it say's:

Traceback (most recent call last):
  File "tools/gen_qrcode", line 4, in <module>
    import PIL.Image
ImportError: No module named PIL.Image

How can I solve this? Thanks In advance!

AchimPieters commented 5 years ago

okay I found out that I need to install pillow (pil) for this toi work:

However, since my project uses Python 3, No module named PIL error simply tells you that the python3 instance you're using cannot find the PIL library.

I used Homebrew for managing my system packages such as node, python, etc. So what I did was reinstall python3 with Homebrew with:

brew reinstall python, then run pip3 install pillow.

now I have Pillow-6.0.0 installed in the Phyton dir, but it still doesn't work?

maximkulkin commented 5 years ago

I'm also running Python3 installed via Homebrew and it works fine. Make sure that default python executable resolves to that Homebrew Python3 (you might need to update your PATH) or just specify which python you want to use: /usr/local/opt/python/libexec/bin/python tools/gen_qrcode ...

AchimPieters commented 5 years ago

Thank you for your quick reply:

I fixed half of my problem by doing the following:

export PATH="/usr/local/opt/python/libexec/bin:$PATH"

followed by:

brew install python

then I got:

Warning: python 3.7.3 is already installed, it's just not linked
You can use `brew link python` to link this version.

and typed:

brew link python

Installed Pillow:

pip install Pillow

then tried again:

tools/gen_qrcode 1 123-45-678 1QJ8 qrcode.png

now I'm getting:

Traceback (most recent call last):
  File "tools/gen_qrcode", line 7, in <module>
    import qrcode
ModuleNotFoundError: No module named 'qrcode'

so now I getting another error, If you have a pointer It would be welcome ;) Ill keep searching for the solution, keep you updated!

AchimPieters commented 5 years ago

okay that was easy:

pip install qrcode

maximkulkin commented 5 years ago

Hmm.. that's strange, I thought I added requirements.txt. Apparently I didn't.. I will fix that and update documentation.

AchimPieters commented 5 years ago

that's great idea! :smile: see you around when I struggle with something else :wink:

TomKremer commented 4 years ago

did run into the same issue, requirements.txt is still missing. Pillow & qrcode.

maximkulkin commented 4 years ago

Fixed