Psyntax
Psyntax

Reputation: 23

Trouble importing third party Python packages to GIMP 2.10 so that they can be used to write GIMP plugins

My goal is to import a couple third party Python packages for use with my GIMP installation. This will allow me to use these packages when developing a GIMP plugin. I noticed a few directories that may be of use. They are as follows:

C:\Program Files\GIMP 2\32\lib\python2.7

This directory contains a site-packages folder which contains packages such as requests and pip.

C:\Program Files\GIMP 2\32\bin

This directory contains a python.exe. When I run python --version in an elevated cmd at this directory path, the output is Python 2.7.16, which I assume is GIMP 2.10's version of Python. This is important because I have my own installation of Python 3.8.0 in my Program Files. If I'm anywhere outside of this path in the cmd, the version that outputs is 3.8.0.

I have added these directories to my PATH system variable and tried running pip install but the output tells me I have already installed the requested third party packages. The problem is that they are installed to my Python 3.8.0 installation. I'm trying to run pip install in the context of GIMP's Python environment.

Any advice would be much appreciated.

Upvotes: 0

Views: 1450

Answers (2)

Psyntax
Psyntax

Reputation: 23

Turns out the package I was trying install had dependencies that required a higher version of Python than the one GIMP comes with. Thanks to those whom responded.

Upvotes: 0

xenoid
xenoid

Reputation: 8914

  • Grab get-pip.py here
  • Put it into your GIMP Python directory (C:\Program Files\GIMP 2\Python)
  • From a Windows Command Prompt Window cd to that directory
  • Run get-pip with this python instance: .\python.exe get-pip.py. You now have pip installed in the GIMP version of Python.
  • You can now use this pip instance with Gimp's Python runtime: .\python.exe -m pip install --user <package>

Uplifted/adapted from here

Upvotes: 1

Related Questions