It is currently 22 Feb 2018, 22:15

GIMP/GL InterestsInstalling libraries for GIMP's Python (Showcase | Slideshow)

GIMP or GIMP LEARN Forum Interests
Post Reply
User avatar
tim

Administrator
View: Showcase | Slideshow
Topic Posts: 3/6
Posts: 2180
Joined: 26 Sep 2016, 00:16
Cash on hand: 8,191.32 GLP
Bank: 53,924.25 GLP
Gender: Guy
Location: Victoria, BC
Website: https://gimplearn.net
Operating System: Windows
GIMP Version: 2.8.22
My Personal Blog
My FineArtAmerica
x 1215
x 261
Contact:
Canada

Installing libraries for GIMP's Python

Post#1 by tim » 31 Mar 2017, 20:11


I have Windows 10 (now 7 on an old laptop).
I wanted to be able to use other python libraries (like numpy) for Python that comes with GIMP.
So i went into command window and typed python and it didn't recognize GIMP's python.
So I added the below string to my PATH variable in Environment Variables.

Code: Select all

;C:\Program Files\GIMP 2\Python
Restarted command and typed

Code: Select all

python --version
And this time it showed
Python 2.7.10
so that's good.
Thanks to ofnuts suggestion
I looked at this page https://pip.pypa.io/en/stable/installin ... nstall-pip
I ran command as Admin after saving get-pip.py to desktop.

Code: Select all

python get-pip.py
it said some things were ignored because runtime wasn't a library but installed something.
then i ran in command as Admin (to update the pip I think).
python -m pip install -U pip
then tried to run pip from command but it didn't recognise pip.
So I looked and saw that pip was installed to C:\Program Files\GIMP 2\Python\Scripts
so I set my environments variable PATH (to point) have this string added at the end
;C:\Program Files\GIMP 2\Python\Scripts
Now restarted the command as Admin and typed "pip"
and it complained about syntax so pip is recognized.
I then ran command as Admin and typed.

Code: Select all

pip install numpy
it sucessfully installed but when i ran a test program that simply had

Code: Select all

import numpy
print "Yeah"
It complained about some runtime module not available.
so i ran

Code: Select all

numpy install runtime
And now everything is as should be. I can run test.py from command. And i tried import numpy in a GIMP's py plug-ins and it ran fine.
So we're good now.

Previously I didn't know how to install libraries for GIMP's version of Python, so what i did to play with libraries of Python was I installed my own version of Python outside of GIMP, then it would come with pip, and used pip to install libraries for that version of Python but it had no relation to GIMP's version of Python. Now that this is done, we can play with these libraries inside GIMP's python plug-ins and i don't have to install another separate version of python.
0 x



aka Tin
Image gimplearn.net                                              

Registered members enjoy ads-free content
User avatar
dinasset
Script Coder
View: Showcase | Slideshow
Topic Posts: 3/6
Posts: 720
Joined: 20 Jan 2017, 11:50
Cash on hand: 3,572.02 GLP
Gender: Guy
Location: Roma (Italy)
x 91
x 129
Italy

Post#2 by dinasset » 01 Apr 2017, 08:51


Thanks for your help, but I didn't succeed even with your tutorial (it doesn't "get pip")

Edit: this is what I get when entering the cmd python get-pip.py
Image
0 x




User avatar
tim

Administrator
View: Showcase | Slideshow
Topic Posts: 3/6
Posts: 2180
Joined: 26 Sep 2016, 00:16
Cash on hand: 8,191.32 GLP
Bank: 53,924.25 GLP
Gender: Guy
Location: Victoria, BC
Website: https://gimplearn.net
Operating System: Windows
GIMP Version: 2.8.22
My Personal Blog
My FineArtAmerica
x 1215
x 261
Contact:
Canada

Post#3 by tim » 01 Apr 2017, 17:38


you have to download that get-pip.py first
0 x



aka Tin
Image gimplearn.net                                              

User avatar
dinasset
Script Coder
View: Showcase | Slideshow
Topic Posts: 3/6
Posts: 720
Joined: 20 Jan 2017, 11:50
Cash on hand: 3,572.02 GLP
Gender: Guy
Location: Roma (Italy)
x 91
x 129
Italy

Post#4 by dinasset » 01 Apr 2017, 17:55


tim wrote:
01 Apr 2017, 17:38
you have to download that get-pip.py first
Tin, I posted a screenshot to show you that IT WAS THERE on the desktop
0 x




User avatar
tim

Administrator
View: Showcase | Slideshow
Topic Posts: 3/6
Posts: 2180
Joined: 26 Sep 2016, 00:16
Cash on hand: 8,191.32 GLP
Bank: 53,924.25 GLP
Gender: Guy
Location: Victoria, BC
Website: https://gimplearn.net
Operating System: Windows
GIMP Version: 2.8.22
My Personal Blog
My FineArtAmerica
x 1215
x 261
Contact:
Canada

Post#5 by tim » 01 Apr 2017, 22:14


dinasset wrote:
01 Apr 2017, 17:55
tim wrote:
01 Apr 2017, 17:38
you have to download that get-pip.py first
Tin, I posted a screenshot to show you that IT WAS THERE on the desktop
Then you have to cd (change directory) into Desktop in order for it to see the file. It's saying it's not finding it the way you run it now.
You're running command from C:/Windows/system32
You should cd /Users/[Yourusername]/Desktop/
0 x



aka Tin
Image gimplearn.net                                              

User avatar
dinasset
Script Coder
View: Showcase | Slideshow
Topic Posts: 3/6
Posts: 720
Joined: 20 Jan 2017, 11:50
Cash on hand: 3,572.02 GLP
Gender: Guy
Location: Roma (Italy)
x 91
x 129
Italy

Post#6 by dinasset » 02 Apr 2017, 04:45


tim wrote:
01 Apr 2017, 22:14
dinasset wrote:
01 Apr 2017, 17:55
tim wrote:
01 Apr 2017, 17:38
you have to download that get-pip.py first
Tin, I posted a screenshot to show you that IT WAS THERE on the desktop
Then you have to cd (change directory) into Desktop in order for it to see the file. It's saying it's not finding it the way you run it now.
You're running command from C:/Windows/system32
You should cd /Users/[Yourusername]/Desktop/
Thanks Tin, but by that way it installs pip under ...Appdata.
So this is what I did instead:
- I placed the file get-pip.py under the folder GIMP 2/Python (in order to be "seen")
and I went a step forward:
by this way it installed appropriately numpy under GIMP 2....site-packages
What I can't perform is now: install Runtime, but placing import numpy is now possible in a .py filter. Let me see how I can progress also without the "Runtime".
0 x




Post Reply

Last 20 Members Who Visited This Topic

User avatar Steve Reid (1)

  • Similar Topics
    Replies
    Views
    Last post
• Featuring Members' Works (Image Attachments Only) •
1: Wallace
2: Conbagui
3: david
4: Meemaw
5: Issabella
6: Conbagui
7: tim

Who is online

Users browsing this forum: No registered users and 0 guests