gco_python
gco_python copied to clipboard
Unable to compile gco
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
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.
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
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
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
hm that looks ok. what's the output of pip install pygco
?
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)
and pygco exists in /Users/Shared/miniconda3/envs/myenv/lib/python3.7/site-packages
?

Yes it does
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.
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"
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.
I got it working. Thanks!
please share how you managed to install this library
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! 😊