Shubhashish Dixit
Shubhashish Dixit

Reputation: 55

how to import gimp in python3 script?

Sorry for a noob question, but I can't seem to find gimp's install command.

$ pip3 install pgimp

throws the below error

 ERROR: Command errored out with exit status 1:
     command: /usr/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-tt98fv7k/pgimp/setup.py'"'"'; __file__='"'"'/tmp/pip-install-tt98fv7k/pgimp/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base pip-egg-info
         cwd: /tmp/pip-install-tt98fv7k/pgimp/
    Complete output (7 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-tt98fv7k/pgimp/setup.py", line 42, in <module>
        check_python2_installation()
      File "/tmp/pip-install-tt98fv7k/pgimp/setup.py", line 38, in check_python2_installation
        'At least one of the following packages is missing in the python2 installation: ' + ', '.join(requirements)
    __main__.GimpInstallationException: At least one of the following packages is missing in the python2 installation: numpy, typing
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

Upvotes: 2

Views: 943

Answers (1)

Nicola Landro
Nicola Landro

Reputation: 406

I do not know if it is possible to add Gimp into python, but if you have installed gimp beta with flatpack (I tried it on Ubuntu and OpenSuse) you can run a interactive bash or python shell in witch you can find gimp:

flatpak run --command=python org.gimp.GIMP//beta

In this way it open a python shell that can import gimp like into a plugin.

If you want to run a script you can use a bash shell inside it you can run for example python -m ensurepip and start to install with pip your dependencies:

flatpak run --command=bash org.gimp.GIMP//beta

I find more information about that on Create Python3 Plugin for GIMP: The basics and on Some ideas and tools to develop Python 3.8 plugins for GIMP 2.99.4

Upvotes: 2

Related Questions