PILLOW issues

Posted on
Mon Sep 25, 2017 10:28 pm
bkmar1192 offline
Posts: 274
Joined: Sep 12, 2015

PILLOW issues

My Security Camera plugin uses the PILLOW module. A couple of people that are doing fresh installs are having issues getting the plugin to see the PILOW module. I am relatively new to Python so not sure how some of the backend stuff works. Any help would be appreciated...

When they run the plugin they get the following:

Code: Select all
2017-09-25 11:37:02.781   Application   Installing and enabling plugin Security Camera v2.0
2017-09-25 11:37:02.782   Application   Loading plugin "Security Camera 2.0"
2017-09-25 11:37:02.784   Application   Starting plugin "Security Camera 2.0" (pid 31740)
2017-09-25 11:37:03.187   Security Camera Error   Error in plugin execution InitializeMain:

Traceback (most recent call last):
  File "plugin.py", line 22, in <module>
ImportError: No module named PIL


But re-installing PILLOW gets this:

Code: Select all
sudo -H pip install Pillow
Requirement already satisfied: Pillow in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
Requirement already satisfied: olefile in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from Pillow)

Posted on
Wed Sep 27, 2017 7:16 am
siclark offline
Posts: 1960
Joined: Jun 13, 2017
Location: UK

Re: PILLOW issues

I'm having PILLOW issues with the iTravel plugin as well, so interested in this one but nothing to add other than hours of effort for no results in making it work.

Posted on
Wed Sep 27, 2017 8:46 am
DaveL17 offline
User avatar
Posts: 6742
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: PILLOW issues

I am by no means an expert, but this may help. I recall having a similar issue and, if I remember correctly, this is how I reconciled it.

Short answer: try the following steps from terminal:
Code: Select all
brew uninstall Pillow

You may have to use:
Code: Select all
brew uninstall Pillow --force

Then:
Code: Select all
sudo pip install Pillow

You may need to enter your administrator password. Note that you would need to adjust the pip command to target another version of Python (depending on your Indigo and OS versions -- but it seems like you are on Indigo 7 and therefore Python 2.7).

Long answer:
I believe that Homebrew installs its site packages to /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (where yours are currently) whereas Indigo wants them to be in /Library/Python/2.7/site-packages which is where I believe pip defaults to. I made the mistake of using Homebrew early on and ran into similar problems. Once I started using pip exclusively (or as much as possible anyway), I haven't had these kinds of problems. There are other ways around the challenge such as changing the locations that are included in the bash profile, BUT I WOULDN'T RECOMMEND MESSING WITH THAT UNLESS YOU KNOW WHAT YOU ARE DOING.

Hope this helps.

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Wed Sep 27, 2017 9:38 am
jay (support) offline
Site Admin
User avatar
Posts: 18199
Joined: Mar 19, 2008
Location: Austin, Texas

Re: PILLOW issues

DaveL17 wrote:
I believe that Homebrew installs its site packages to /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (where yours are currently) whereas Indigo wants them to be in /Library/Python/2.7/site-packages which is where I believe pip defaults to.


Slight correction: /Library/Python/2.7/site-packages are where the built-in Python interpreter on macOS wants them to be (Indigo doesn't specify any custom paths beyond the one we add to include modules that we add). I'm pretty sure the path above is where Homebrew installs it's own version of Python when you install via Homebrew. That directory doesn't exist on standard macOS installs.

A similar directory does exist:

Code: Select all
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7


This is where macOS installs it's built-in Python 2.7 version, but note there is no site-packages directory there because it expects it to be in

Code: Select all
/Library/Python/2.7/site-packages

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Wed Sep 27, 2017 1:32 pm
CliveS offline
Posts: 761
Joined: Jan 10, 2016
Location: Medomsley, County Durham, UK

Re: PILLOW issues

I am having the Pillow install problem, is the problem that Python being used is in a different directory to where Pillow installed?

Last login: Wed Sep 27 04:14:28 on console
Indigo-Sierra:~ Indigo$ brew uninstall Pillow
-bash: brew: command not found
Indigo-Sierra:~ Indigo$ which python
/Library/Frameworks/Python.framework/Versions/2.7/bin/python
Indigo-Sierra:~ Indigo$ sudo pip install Pillow
Password:
The directory '/Users/Indigo/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/Indigo/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Requirement already satisfied: Pillow in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
Requirement already satisfied: olefile in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from Pillow)
Indigo-Sierra:~ Indigo$ sudo -H pip install Pillow
Requirement already satisfied: Pillow in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
Requirement already satisfied: olefile in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from Pillow)
Indigo-Sierra:~ Indigo$

Anything I can try?

CliveS

CliveS

Indigo 2023.2.0 : macOS Ventura 13.6.3 : Mac Mini M2 : 8‑core CPU and 10‑core GPU : 8 GB : 256GB SSD
----------------------------------------------------------------------------------
The best way to get the right answer on the Internet is not to ask a question, it's to post the wrong answer

Posted on
Thu Sep 28, 2017 11:27 am
jay (support) offline
Site Admin
User avatar
Posts: 18199
Joined: Mar 19, 2008
Location: Austin, Texas

Re: PILLOW issues

CliveS wrote:
I am having the Pillow install problem, is the problem that Python being used is in a different directory to where Pillow installed?

Last login: Wed Sep 27 04:14:28 on console
Indigo-Sierra:~ Indigo$ brew uninstall Pillow
-bash: brew: command not found
Indigo-Sierra:~ Indigo$ which python
/Library/Frameworks/Python.framework/Versions/2.7/bin/python
Indigo-Sierra:~ Indigo$ sudo pip install Pillow
Password:
The directory '/Users/Indigo/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/Indigo/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Requirement already satisfied: Pillow in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
Requirement already satisfied: olefile in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from Pillow)
Indigo-Sierra:~ Indigo$ sudo -H pip install Pillow
Requirement already satisfied: Pillow in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
Requirement already satisfied: olefile in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from Pillow)


Yeah, you've got a bit of a mess there... ;)

After some research, I've found the issue. If you have this directory:

Code: Select all
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/


Then you (or perhaps some other app installer) installed Python from the installer from python.org. Indigo uses the built in Python install, but when you run the installer from python.org then it modifies things such that typing python in a shell executes the one installed by their installer, bypassing Apple's built-in install. Further, pip was likely either installed with the 3rd party python install or it was installed using the 3rd party python - either case will cause the problem you're seeing.

I would highly recommend uninstalling the 3rd party python as it will not work with Indigo and will continually cause issues like this.

This should be what you see when looking at which python command is being used:

Code: Select all
FatBook:~ jay$ which python
/usr/bin/python

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Thu Sep 28, 2017 12:20 pm
jay (support) offline
Site Admin
User avatar
Posts: 18199
Joined: Mar 19, 2008
Location: Austin, Texas

Re: PILLOW issues

I just wrote up a forum post that describes what's going on. Hopefully it will help everyone identify these issues early on and solve them quickly.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Thu Sep 28, 2017 5:49 pm
bkmar1192 offline
Posts: 274
Joined: Sep 12, 2015

Re: PILLOW issues

Thanks for the info. I'll add a link to your forum post to my manuals. Is there a way in code to determine where it is running Python before import? Could make the error a bit more friendly.


Sent from my iPhone using Tapatalk

Posted on
Fri Sep 29, 2017 12:15 pm
jay (support) offline
Site Admin
User avatar
Posts: 18199
Joined: Mar 19, 2008
Location: Austin, Texas

Re: PILLOW issues

bkmar1192 wrote:
Thanks for the info. I'll add a link to your forum post to my manuals. Is there a way in code to determine where it is running Python before import? Could make the error a bit more friendly.


Where what is running? From the plugin's standpoint, it's always running the preinstalled Python because it's not possible for it to use anything else.

In your plugin, you might be able to check for the other 3rd party Python install directories and if one is present then throw up a warning that users may run into trouble.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Sat Sep 30, 2017 5:39 am
CliveS offline
Posts: 761
Joined: Jan 10, 2016
Location: Medomsley, County Durham, UK

Re: PILLOW issues

Thank you Jay.....

Finally after two days of torture I finally have Pillow installed and Security Camera Plugin working.
As Jay so rightly pointed out to me

jay (support) wrote:
Yeah, you've got a bit of a mess there... ;)


Fix was backup the 'Perceptive Automation' directory, remove 'High Sierra', install 'Sierra', install Indigo 7 and then restore the 'Perceptive Automation' directory.
Well that was the shortened version but killing the new Apple File System from the SSD was fun, anyone trying to revert from High Sierra back to Sierra on a machine that did not come with Sierra as default (i.e. not my Mac mini 2011) is in for a shock, Sierra is no longer downloadable from the App Store so unless you have a local copy, tough!
I then went through Jay's post at http://forums.indigodomo.com/viewtopic.php?f=108&t=19126 and checked my directories and all matched his, installed Pip and then Pillow, started Security Plugin and up came the Configuration screen........ Finally

Thank you again Jay

CliveS

CliveS

Indigo 2023.2.0 : macOS Ventura 13.6.3 : Mac Mini M2 : 8‑core CPU and 10‑core GPU : 8 GB : 256GB SSD
----------------------------------------------------------------------------------
The best way to get the right answer on the Internet is not to ask a question, it's to post the wrong answer

Posted on
Sat Sep 30, 2017 8:50 am
jay (support) offline
Site Admin
User avatar
Posts: 18199
Joined: Mar 19, 2008
Location: Austin, Texas

Re: PILLOW issues

Glad you got it working.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Sat Sep 30, 2017 10:28 am
bkmar1192 offline
Posts: 274
Joined: Sep 12, 2015

Re: PILLOW issues

Great to hear. Let me know if you need help or have any issues with the plugin.


Sent from my iPhone using Tapatalk

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest

cron