gco_python icon indicating copy to clipboard operation
gco_python copied to clipboard

Unable to compile gco

Open GeorgeCodeHub opened this issue 4 years ago • 14 comments

Hello there,

I'm trying to use pygco and I'm stuck in trying to compile it. I tried compiling in both Windows and Ubuntu but with no luck. Is there a guide on how I should compile the whole folder or which files to compile? I tried starting from GCOptimization but I got too many errors.

Note: I'm using it for a python project where I try to colorize an image by using the graph cut method. My gcc version is 5.4.0

I also tried using pip and it installed pygco=0.0.1 but when I try to import it, it doesn't recognize it.

It gives: No module named 'pygco'

I import it like so: import pygco

GeorgeCodeHub avatar Oct 01 '20 21:10 GeorgeCodeHub

I think using pip will be the easiest method. Make sure that you're using the pip that belongs to the environment you're executing in. If pip throws any errors, please post them here. Also, this code should probably be considered unmaintained, I haven't worked on or with this for several years.

amueller avatar Oct 02 '20 21:10 amueller

I'm getting the same issue as above after installing it using pip.

It gives: No module named 'pygco'

I import it like so: import pygco

leronjulian avatar Dec 09 '20 19:12 leronjulian

are you sure that the executing environment is the same as the environment that pip installed into? Are you executing a script? If so, try which python and which pip. You can also do python -m pip install pygco

amueller avatar Dec 09 '20 20:12 amueller

Yes they are. I am trying to execute example.py. When I try which python and which pip I get:

/Users/Shared/miniconda3/envs/myenv/bin/python and /Users/Shared/miniconda3/envs/myenv/bin/pip

leronjulian avatar Dec 09 '20 20:12 leronjulian

hm that looks ok. what's the output of pip install pygco?

amueller avatar Dec 10 '20 18:12 amueller

Requirement already satisfied: pygco in /Users/Shared/miniconda3/envs/myenv/lib/python3.7/site-packages (0.0.1) Requirement already satisfied: numpy in /Users/Shared/miniconda3/envs/myenv/lib/python3.7/site-packages (from pygco) (1.16.6) Requirement already satisfied: cython in /Users/Shared/miniconda3/envs/myenv/lib/python3.7/site-packages (from pygco) (0.29.21)

leronjulian avatar Dec 10 '20 22:12 leronjulian

and pygco exists in /Users/Shared/miniconda3/envs/myenv/lib/python3.7/site-packages?

amueller avatar Dec 10 '20 22:12 amueller

Screen Shot 2020-12-10 at 5 49 50 PM

Yes it does

leronjulian avatar Dec 10 '20 22:12 leronjulian

There should be a folder that's just called pygco in addition to the dist-info folder. Remove the dist-info folder and do the pip install again. It looks like you did some partial install or uninstall at some point.

amueller avatar Dec 10 '20 22:12 amueller

I did that, now I'm trying to reinstall it using pip and I'm getting the error gco_python.cpp:626:10: fatal error: 'ios' file not found #include "ios"

leronjulian avatar Dec 10 '20 23:12 leronjulian

make sure you have the standard libraries for C++ installed. As a warning the GCO code has been unmaintained for many years so you're mostly on your own there.

amueller avatar Dec 10 '20 23:12 amueller

I got it working. Thanks!

leronjulian avatar Dec 11 '20 00:12 leronjulian

please share how you managed to install this library

hfpro avatar Nov 06 '21 16:11 hfpro

I just got a simple fix and I'm going to let it here for the next people with the same problem.

First explaining, I was with exactly the same problem than in this issue, that is, I installed pygco with:

$ pip install pygco

But when running a script the result was:

No module named 'pygco'

Then running pip install pygco again I got into the site-packages folder and could find the pygco-0.0.1.dist-info sub-folder.

Then to solve I simply ran:

$ pip install -U pygco

Which upgraded pygco version from 0.0.1 to 0.0.16 and the problem was solved.

Hope that it helps someone! 😊

rfmac-perceptus avatar Jan 18 '23 15:01 rfmac-perceptus