jacquesfize / GMatch4py

A graph matching library for Python
MIT License
192 stars 41 forks source link

Fresh Install doesn't work #2

Closed daubin427 closed 6 years ago

daubin427 commented 6 years ago

Hello!

I'd love to try this out, but the installation appears to be broken. Using Ubuntu18.04 I

  1. git clone https://github.com/Jacobe2169/GMatch4py.git
  2. cd to GMatch4py
  3. sudo python3 setup.py install
  4. All is well

I build a simple setup.py to test:

from distutils.core import setup
from Cython.Build import cythonize

setup(
    ext_modules = cythonize("simpleGmatch4py.pyx")
)

I create a simpleGmatch4py.pyx:

# Gmatch4py use networkx graph 
import networkx as nx 
# import the GED using the munkres algorithm
import gmatch4py as gm

g1=nx.complete_bipartite_graph(5,4)
g2=nx.complete_bipartite_graph(6,4)

ged=gm.GraphEditDistance(1,1,1,1) # all edit costs are equal to 1
result=ged.compare([g1,g2],None)
print(result)
print("Hello")

I build inplace: python3 setup.py build_ext --inplace

I then try to run it and get an error:

python3
>>import simpleGmatch4py
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "simpleGmatch4py.pyx", line 4, in init simpleGmatch4py
    import gmatch4py as gm
  File "/usr/local/lib/python3.6/dist-packages/gmatch4py/__init__.py", line 4, in <module>
    from .ged.graph_edit_dist import *
  File "gmatch4py/ged/graph_edit_dist.pyx", line 1, in init GMatch4py.gmatch4py.ged.graph_edit_dist
ModuleNotFoundError: No module named 'GMatch4py'

Please help :)

jacquesfize commented 6 years ago

Hi @daubin427,

Did you run this code into the GMatch4py clone directory?

daubin427 commented 6 years ago

Hello! No I ran it in a different directory. I think the problem lies where call it GMatch4py in setup.py, but no where else is that used with that punctuation.

jacquesfize commented 6 years ago

Did you try to run the same code in an Ipython or a python interpreter ?

daubin427 commented 6 years ago

Yes. See in the last line of my post I tried running it from a python3 interpreter.

jacquesfize commented 6 years ago

I mean did you try to execute the code inside simpleGmatch4py.pyx (copy-paste) in an interpreter ?

daubin427 commented 6 years ago

Sadly this too fails in the same maner :(

ipython3 
Python 3.6.5 (default, Apr  1 2018, 05:46:30) 
Type "copyright", "credits" or "license" for more information.

IPython 5.5.0 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: import networkx as nx

In [2]: import gmatch4py as gm
-----------------------------------------------------------------------
ModuleNotFoundError                   Traceback (most recent call last)
<ipython-input-2-789a2ae4f894> in <module>()
----> 1 import gmatch4py as gm

/usr/local/lib/python3.6/dist-packages/gmatch4py/__init__.py in <module>()
      2 
      3 # Graph Edit Distance algorithms import
----> 4 from .ged.graph_edit_dist import *
      5 from .ged.greedy_edit_distance import *
      6 from .ged.bipartite_graph_matching_2 import *

gmatch4py/ged/graph_edit_dist.pyx in init GMatch4py.gmatch4py.ged.graph_edit_dist()

ModuleNotFoundError: No module named 'GMatch4py'
jacquesfize commented 6 years ago

It is really weird oO I tried it on an Ubuntu and it's working oO

I did the same thing you did in VirtualEnv, could you run the following commands :

# if don't have virtualenv, do: sudo pip3 install virtualenv
virtualenv -p python3 test_gmatch4py
cd test_gmatch4py
source bin/activate
pip install numpy networkx scikit-learn ipython cython scipy
mkdir install
cd install
git clone https://github.com/Jacobe2169/GMatch4py.git
cd GMatch4py
python setup.py install
cd ../..
nano setup.py # paste code
nano simpleGmatch4py.pyx # paste code
python setup.py build_ext --inplace
python # execute your script
daubin427 commented 6 years ago

Hi,

I'm behind a proxy and running virtualenv behind it is just not working :(

During the setup is there anything that goes out to the network? Perhaps due to my proxy this is the culprit?

daubin427 commented 6 years ago

I FOUND IT!!!! WHOOT!!!! Issue was not having scikit-learn. Once I pipped that all was good. Odd error to see without it. Thank you for your super prompt and helpful tips to locate it :) So happy!

jacquesfize commented 6 years ago

Great ! ;)

daubin427 commented 6 years ago

I created a setup.py for you so that even lazy eyes can't screw up the install ;) All you have to do is fill out the #List of dependencies section at the top. Thanks again :) setup.py.txt