Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Gimp, python, and numpy
#11
If numpy is installed, don't bother with that. Just check that Gimp sees numpy by going to Filters>Python fu>Console and do:
Code:
import numpy
dir(numpy)

It should look like:

   
Reply
#12
(12-07-2017, 12:57 PM)Ofnuts Wrote: If numpy is installed, don't bother with that. Just check that Gimp sees numpy by going to Filters>Python fu>Console and do:
Code:
import numpy
dir(numpy)

It should look like:

No, I get this:

   

Sad 

Also, the Python version^ for Gimp looks older (than yours)  (my system-wide python is 2.7.14) - maybe that's the problem?
Reply
#13
Might be easier to install linux than get anything working in Windows Wink

In the spirit of always willing to try, this using Win7 (a bit faster than my Win10 VM)

First which 'flavour' of python. The Win installers have both 32 and 64 bit versions. I have tried both with the same result. The Python in a 64 bit Windows Gimp 2.8.22 is 32 bit, so this example using 32 bit for the screenshots.

Installing Python, easy enough. The only option to enable is adding python to the windows path. https://i.imgur.com/PINkYFd.jpg other wise everything is default.

Using pip to install numpy. Again there are 32/64 bit versions of the numpy .whl file

Lots in this screenshot of the windows terminal https://i.imgur.com/9yMZ8C9.jpg
1. the python version
2. installing numpy - that added the f2py files to the Python 27\Scripts folder
3. A check that python has been added to the path.
4. The Python command and import numpy, no error messages.

A restart of Win, just in case and onto Gimp

Starting Gimp in a terminal with the verbose switch all the usual, nothing special. https://i.imgur.com/1yMRV2G.jpg

The Gimp 2.8.22 Python console with import numpy - not found https://i.imgur.com/QdyfC2h.jpg

So, that is me finished. quote from the stackoverflow thread ..Can't believe there are so many lengthy (perhaps outdated?) answers out there..
Reply
#14
I guess the problem is the same as of Zero01: those procedures install not under Gimp 2/Python... but under the standalone C/Python 27

anyhow, Rich, thanks for your try
Reply
#15
Well it looks impossible (or highly unlikely) to me... Yep, think I'll install linux in a VM and take it from there - thank you.
Reply
#16
(12-07-2017, 10:24 AM)dinasset Wrote: Ofnuts, I asked for an installation in Windows 10, I know you hate Windows; not me.

It's not hatred, it's a mere allergy Big Grin
Reply
#17
(12-07-2017, 12:29 PM)Zero01 Wrote:
(12-06-2017, 11:26 PM)Ofnuts Wrote: Normally you should be able to

  1. Add the python executable which comes with Gimp to your general Windows path (once this is done you have a "python" command available in the command prompt.
  2. Install PIP s indicated there:  (AFAIK Gimp's Python should be >= 2.7.9 so PIP could there already, otherwise, follow the indications).
  3. Download Numpy as indicated there.

My problem is I don't really know what I'm doing, well, i tried putting the path to the Gimp python executable in my "User variables" - (see pic) is that right or what should it be?
 Also is the numpy version I have correct? I have (installed with pip):- numpy-1.13.3 and it's in "C:\Python27\Lib\site-packages\.. " is that right? Or should I install it with pip via the wheel i.e. '"numpy-1.13.3+mkl-cp27-cp27m-win_amd64.whl'? Thanks.

Did you install Python separately by any chance? In which case you installed numpy for that Python, and not for the one used by Gimp.
Reply
#18
Right, Python has been installed for some time now (months), so I didn't know how to specifically install numpy for the Python that GIMP uses, I thought that was what I was doing!
Reply
#19
Here's what I've just done:
  • From this page: https://stackoverflow.com/questions/4750...on-windows download get-pip.py and put it into your GIMP Python folder (C:\Program Files\GIMP-2.8.22\Python)
  • From a Windows Command Prompt Window cd to the GIMP Python folder:  cd C:\Program Files\GIMP-2.8.22\Python
  • Run the get-pip.py script using the GIMP version of Python:  .\python.exe get-pip.py
  • You now have pip installed in the GIMP version of Python
  • Now you can run the command to download and install numpy:  .\python.exe -m pip install --user numpy
  • Start GIMP
  • In the Python Console (Filters>>Python-Fu>>Console) import numpy then dir(numpy) you should get the screen-shot shown by Ofnuts.
Reply
#20
(12-07-2017, 03:09 PM)Kevin Wrote: Here's what I've just done:
  • From this page: https://stackoverflow.com/questions/4750...on-windows download get-pip.py and put it into your GIMP Python folder (C:\Program Files\GIMP-2.8.22\Python)
  • From a Windows Command Prompt Window cd to the GIMP Python folder:  cd C:\Program Files\GIMP-2.8.22\Python
  • Run the get-pip.py script using the GIMP version of Python:  .\python.exe get-pip.py
  • You now have pip installed in the GIMP version of Python
  • Now you can run the command to download and install numpy:  .\python.exe -m pip install --user numpy
  • Start GIMP
  • In the Python Console (Filters>>Python-Fu>>Console) import numpy then dir(numpy) you should get the screen-shot shown by Ofnuts.
Kevin, At step 3 I got this error
   

(12-07-2017, 03:42 PM)dinasset Wrote:
(12-07-2017, 03:09 PM)Kevin Wrote: Here's what I've just done:
  • From this page: https://stackoverflow.com/questions/4750...on-windows download get-pip.py and put it into your GIMP Python folder (C:\Program Files\GIMP-2.8.22\Python)
  • From a Windows Command Prompt Window cd to the GIMP Python folder:  cd C:\Program Files\GIMP-2.8.22\Python
  • Run the get-pip.py script using the GIMP version of Python:  .\python.exe get-pip.py
  • You now have pip installed in the GIMP version of Python
  • Now you can run the command to download and install numpy:  .\python.exe -m pip install --user numpy
  • Start GIMP
  • In the Python Console (Filters>>Python-Fu>>Console) import numpy then dir(numpy) you should get the screen-shot shown by Ofnuts.
Kevin, At step 3 I got this error

Sorry, I see my error....

GOT IT ! Many thanks Kevin !

Kevin, may I insert a post in GC copying what you wrote here?
Or will you do it yourself? (even better)
I guess it is a very important mini-tut.
Reply


Forum Jump: