It is currently 24 Jan 2022, 23:14

• Featuring Members' Images •
Could be related to 'Installing libraries for GIMP\'s Python'
tim
tim
tim
tim
tim

GIMP/GL:  Tutorials | Tips | Questions | 🡆 Interests | Script Requests
Recommendations:  Index | Top 10
Resources:  Python-Fu Plug-ins | Scheme-Fu Scripts | GIMP
Python:  Lessons | Questions | Exercises
The Arts:  GIMPed | GIMPed Photos | Other | Contests | Public Domain Images | Isolated Images | Blender
Inkscape
Social:  Say Hello | Anything Goes | Shares | FCSP

Installing libraries for GIMP's Python

GIMP or GIMP LEARN Forum Interests
tim
GL Blogger
1st Place
5775 Post(s)

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.
aka Tin
World Food Program | Good Deeds Forum

         

dinasset_1
Script Coder
16th Place
844 Post(s)

Post#2 by dinasset_1 » 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
download.jpg
download.jpg # (4.18 KiB) Viewed 5699 times (Thumbnail | Recognize | Sq Tile | LNFI)

tim
GL Blogger
1st Place
5775 Post(s)

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


you have to download that get-pip.py first
aka Tin
World Food Program | Good Deeds Forum

         

dinasset_1
Script Coder
16th Place
844 Post(s)

Post#4 by dinasset_1 » 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

tim
GL Blogger
1st Place
5775 Post(s)

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/
aka Tin
World Food Program | Good Deeds Forum

         

dinasset_1
Script Coder
16th Place
844 Post(s)

Post#6 by dinasset_1 » 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".

rubenrcs
Forum Member
83rd Place
5 Post(s)

Post#7 by rubenrcs » 04 Jan 2022, 02:06


Following you I got py2 in Gimp and pip working, not in program files seems denied access but c\users\.gimp2.8 instead , created a folder " python2.7" and worked nice pip already downloaded pandas . Python didn't even gave Appdata a chance doesn't show at install time... just for the record if someone wants to know. Thanks a lot guys
GIMP Learn rocks...


GIMP/GL:  Tutorials | Tips | Questions | 🡆 Interests | Script Requests
Recommendations:  Index | Top 10
Resources:  Python-Fu Plug-ins | Scheme-Fu Scripts | GIMP
Python:  Lessons | Questions | Exercises
The Arts:  GIMPed | GIMPed Photos | Other | Contests | Public Domain Images | Isolated Images | Blender
Inkscape
Social:  Say Hello | Anything Goes | Shares | FCSP

Post Reply New Topic
  • Similar Topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: No registered users and 2 guests