andre-martins / AD3

Alternating Directions Dual Decomposition
GNU Lesser General Public License v3.0
68 stars 38 forks source link

Error installing on Mac Mavericks (virtualenv update from Mountain Lion) #10

Open aurora1625 opened 11 years ago

aurora1625 commented 11 years ago

Hi, I have trouble install ad3 python on my mac.

I am running Python in virtualenv on Mavericks. I didn't perform a clean install from scratch, just upgraded from Mountain Lion. The Python environment is in a virtualenv, so this probably doesn't have anything to do with OSX.

Below is the output of the compilation.

$ python setup.py install
running install
running build
running build_ext
cythoning factor_graph.pyx to factor_graph.cpp
building 'ad3' extension
creating build
creating build/temp.macosx-10.8-intel-2.7
cc -fno-strict-aliasing -fno-common -dynamic -arch i386 -arch x86_64 -I/usr/local/include -I/usr/local/opt/sqlite/include -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I../ -I/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c factor_graph.cpp -o build/temp.macosx-10.8-intel-2.7/factor_graph.o
In file included from factor_graph.cpp:316:
./../ad3/Factor.h:414:70: warning: control reaches end of non-void function
      [-Wreturn-type]
                  vector<int> *additional_evidence) { assert(false); }
                                                                     ^
In file included from factor_graph.cpp:318:
In file included from ./../ad3/FactorGraph.h:22:
./../ad3/FactorDense.h:167:8: warning: 'AD3::FactorDense::Initialize' hides
      overloaded virtual function [-Woverloaded-virtual]
  void Initialize(const vector<MultiVariable*> &multi_variables) {
       ^
./../ad3/Factor.h:117:16: note: hidden overloaded virtual function
      'AD3::Factor::Initialize' declared here
  virtual void Initialize(const vector<BinaryVariable*> &binary_variables,
               ^
2 warnings generated.
In file included from factor_graph.cpp:316:
./../ad3/Factor.h:414:70: warning: control reaches end of non-void function
      [-Wreturn-type]
                  vector<int> *additional_evidence) { assert(false); }
                                                                     ^
In file included from factor_graph.cpp:318:
In file included from ./../ad3/FactorGraph.h:22:
./../ad3/FactorDense.h:167:8: warning: 'AD3::FactorDense::Initialize' hides
      overloaded virtual function [-Woverloaded-virtual]
  void Initialize(const vector<MultiVariable*> &multi_variables) {
       ^
./../ad3/Factor.h:117:16: note: hidden overloaded virtual function
      'AD3::Factor::Initialize' declared here
  virtual void Initialize(const vector<BinaryVariable*> &binary_variables,
               ^
2 warnings generated.
creating build/lib.macosx-10.8-intel-2.7
c++ -bundle -undefined dynamic_lookup -arch i386 -arch x86_64 -isysroot / -L/usr/local/lib -L/usr/local/opt/sqlite/lib build/temp.macosx-10.8-intel-2.7/factor_graph.o -L../ad3/ -lad3 -o build/lib.macosx-10.8-intel-2.7/ad3.so
ld: warning: ignoring file ../ad3//libad3.a, file was built for archive which is not the architecture being linked (i386): ../ad3//libad3.a
running install_lib
copying build/lib.macosx-10.8-intel-2.7/ad3.so -> /Users/sean/.virtualenvs/mycode/lib/python2.7/site-packages
running install_egg_info
Writing /Users/sean/.virtualenvs/mycode/lib/python2.7/site-packages/UNKNOWN-0.0.0-py2.7.egg-info

Next is the error information from iPython

In [1]: import ad3
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-76c6d01e3bb1> in <module>()
----> 1 import ad3

/Users/sean/github/AD3/python/ad3/__init__.py in <module>()
----> 1 from factor_graph import PBinaryVariable, PFactorGraph, PMultiVariable
      2 from simple_inference import simple_grid, general_graph

ImportError: No module named factor_graph

I did check the __init__.py file, and there is no factor_graph in it, and that UNKNOWN egg in site-package is probably have something to do with the failure.

andre-martins commented 11 years ago

Hi Zhibo,

The first piece of the output are just warnings. I think the problem is revealed in this line:

ld: warning: ignoring file ../ad3//libad3.a, file was built for archive which is not the architecture being linked (i386): ../ad3//libad3.a

It looks there is some mismatch between compiling with 32/64 bits?

Just to make sure, did you manage to compile the C++ lib first by running make in the ad3 folder?

André

2013/11/13 Zhibo Xiao notifications@github.com

Hi, I have trouble install ad3 python on my mac.

I am running Python in virtualenv on Mavericks. I didn't perform a clean install from scratch, just upgraded from Mountain Lion. The Python environment is in a virtualenv, so this probably doesn't have anything to do with OSX.

Below is the output of the compilation.

$ python setup.py installrunning installrunning buildrunning build_extcythoning factor_graph.pyx to factor_graph.cppbuilding 'ad3' extensioncreating buildcreating build/temp.macosx-10.8-intel-2.7cc -fno-strict-aliasing -fno-common -dynamic -arch i386 -arch x86_64 -I/usr/local/include -I/usr/local/opt/sqlite/include -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I../ -I/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c factor_graph.cpp -o build/temp.macosx-10.8-intel-2.7/factor_graph.oIn file included from factor_graph.cpp:316:./../ad3/Factor.h:414:70: warning: control reaches end of non-void function [-Wreturn-type] vector _additional_evidence) { assert(false); } ^In file included from factorgraph.cpp:318:In file included from ./../ad3/FactorGraph.h:22:./../ad3/FactorDense.h:167:8: warning: 'AD3::FactorDense::Initialize' hides overloaded virtual function [-Woverloaded-virtual] void Initialize(const vector<MultiVariable> &multi_variables) { ^./../ad3/Factor.h:117:16: note: hidden overloaded virtual function 'AD3::Factor::Initialize' declared here virtual void Initialize(const vector<BinaryVariable> &binary_variables, ^2 warnings generated.In file included from factor_graph.cpp:316:./../ad3/Factor.h:414:70: warning: control reaches end of non-void function [-Wreturn-type] vector _additional_evidence) { assert(false); } ^In file included from factorgraph.cpp:318:In file included from ./../ad3/FactorGraph.h:22:./../ad3/FactorDense.h:167:8: warning: 'AD3::FactorDense::Initialize' hides overloaded virtual function [-Woverloaded-virtual] void Initialize(const vector<MultiVariable> &multi_variables) { ^./../ad3/Factor.h:117:16: note: hidden overloaded virtual function 'AD3::Factor::Initialize' declared here virtual void Initialize(const vector<BinaryVariable> &binary_variables, ^2 warnings generated.creating build/lib.macosx-10.8-intel-2.7c++ -bundle -undefined dynamic_lookup -arch i386 -arch x86_64 -isysroot / -L/usr/local/lib -L/usr/local/opt/sqlite/lib build/temp.macosx-10.8-intel-2.7/factor_graph.o -L../ad3/ -lad3 -o build/lib.macosx-10.8-intel-2.7/ad3.sold: warning: ignoring file ../ad3//libad3.a, file was built for archive which is not the architecture being linked (i386): ../ad3//libad3.arunning install_libcopying build/lib.macosx-10.8-intel-2.7/ad3.so -> /Users/sean/.virtualenvs/mycode/lib/python2.7/site-packagesrunning install_egg_infoWriting /Users/sean/.virtualenvs/mycode/lib/python2.7/site-packages/UNKNOWN-0.0.0-py2.7.egg-info

Next is the error information from iPython

In [1]: import ad3---------------------------------------------------------------------------ImportError Traceback (most recent call last) in ()----> 1 import ad3 /Users/sean/github/AD3/python/ad3/init.py in ()----> 1 from factor_graph import PBinaryVariable, PFactorGraph, PMultiVariable 2 from simple_inference import simple_grid, general_graph ImportError: No module named factor_graph

I did check the init.py file, and there is no factor_graph in it, and that UNKNOWN egg in site-package is probably have something to do with the failure.

— Reply to this email directly or view it on GitHubhttps://github.com/andre-martins/AD3/issues/10 .

aurora1625 commented 11 years ago

Dear Andrew,

Thank you for the quick reply.

I did manage to compile the C++ lib and I run the test code provided on the github page, and everything works as they suppose to be.

I have no idea on the 32/64 bit stuff. I opened libad3.a and they are just numbers.

On Wed, Nov 13, 2013 at 6:06 PM, Andre Martins notifications@github.comwrote:

Hi Zhibo,

The first piece of the output are just warnings. I think the problem is revealed in this line:

ld: warning: ignoring file ../ad3//libad3.a, file was built for archive which is not the architecture being linked (i386): ../ad3//libad3.a

It looks there is some mismatch between compiling with 32/64 bits?

Just to make sure, did you manage to compile the C++ lib first by running make in the ad3 folder?

André

2013/11/13 Zhibo Xiao notifications@github.com

Hi, I have trouble install ad3 python on my mac.

I am running Python in virtualenv on Mavericks. I didn't perform a clean install from scratch, just upgraded from Mountain Lion. The Python environment is in a virtualenv, so this probably doesn't have anything to do with OSX.

Below is the output of the compilation.

$ python setup.py installrunning installrunning buildrunning build_extcythoning factor_graph.pyx to factor_graph.cppbuilding 'ad3' extensioncreating buildcreating build/temp.macosx-10.8-intel-2.7cc -fno-strict-aliasing -fno-common -dynamic -arch i386 -arch x86_64 -I/usr/local/include -I/usr/local/opt/sqlite/include -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I../ -I/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c factor_graph.cpp -o build/temp.macosx-10.8-intel-2.7/factor_graph.oIn file included from factor_graph.cpp:316:./../ad3/Factor.h:414:70: warning: control reaches end of non-void function [-Wreturn-type] vector _additional_evidence) { assert(false); } ^In file included from factorgraph.cpp:318:In file included from ./../ad3/FactorGraph.h:22:./../ad3/FactorDense.h:167:8: warning: 'AD3::FactorDense::Initialize' hides overloaded virtual function [-Woverloaded-virtual] void Initialize(const vector<MultiVariable> &multi_variables) { ^./../ad3/Factor.h:117:16: note: hidden overloaded virtual function 'AD3::Factor::Initialize' declared here virtual void Initialize(const vector<BinaryVariable> &binary_variables, ^2 warnings generated.In file included from factor_graph.cpp:316:./../ad3/Factor.h:414:70: warning: control reaches end of non-void function [-Wreturn-type] vector _additional_evidence) { assert(false); } ^In file included from factorgraph.cpp:318:In file included from ./../ad3/FactorGraph.h:22:./../ad3/FactorDense.h:167:8: warning: 'AD3::FactorDense::Initialize' hides overloaded virtual function [-Woverloaded-virtual] void Initialize(const vector<MultiVariable> &multi_variables) { ^./../ad3/Factor.h:117:16: note: hidden overloaded virtual function 'AD3::Factor::Initialize' declared here virtual void Initialize(const vector<BinaryVariable> &binary_variables, ^2 warnings generated.creating build/lib.macosx-10.8-intel-2.7c++ -bundle -undefined dynamic_lookup -arch i386 -arch x86_64 -isysroot / -L/usr/local/lib -L/usr/local/opt/sqlite/lib build/temp.macosx-10.8-intel-2.7/factor_graph.o -L../ad3/ -lad3 -o build/lib.macosx-10.8-intel-2.7/ad3.sold: warning: ignoring file ../ad3//libad3.a, file was built for archive which is not the architecture being linked (i386): ../ad3//libad3.arunning install_libcopying build/lib.macosx-10.8-intel-2.7/ad3.so -> /Users/sean/.virtualenvs/mycode/lib/python2.7/site-packagesrunning install_egg_infoWriting /Users/sean/.virtualenvs/mycode/lib/python2.7/site-packages/UNKNOWN-0.0.0-py2.7.egg-info

Next is the error information from iPython

In [1]: import ad3---------------------------------------------------------------------------ImportError Traceback (most recent call last) in

()----> 1 import ad3 /Users/sean/github/AD3/python/ad3/**init**.py in ()----> 1 from factor_graph import PBinaryVariable, PFactorGraph, PMultiVariable 2 from simple_inference import simple_grid, general_graph ImportError: No module named factor_graph I did check the **init**.py file, and there is no factor_graph in it, and that UNKNOWN egg in site-package is probably have something to do with the failure. — Reply to this email directly or view it on GitHub< https://github.com/andre-martins/AD3/issues/10> .

— Reply to this email directly or view it on GitHubhttps://github.com/andre-martins/AD3/issues/10#issuecomment-28382700 .

肖智博 (Zhibo Xiao) / Sean | Ph.D. candidate of Machine Learning & Data Mining

Room 106, Information School, Dalian Maritime University, Dalian, China, 116026

andre-martins commented 11 years ago

Apparently, the lib libad3.a was compiled with 64 bits, but then the python setup is trying to compile with 32 bits (I don't have any clue why) and it fails when it tries to link with the 64 bits lib. I don't use MACOSX, but I find strange these two contradictory flags in the command line:

-arch i386 -arch x86_64

I think this flag -arch is specific to MACOSX. You may try to run those commands removing -arch i386, but they are automatic from the python setup command, right?

Alternatively you may try to add the flag -arch i386 in the Makefile in ad3 and recompile the lib in 32 bits, and then running python setup...

André

2013/11/13 Zhibo Xiao notifications@github.com

Dear Andrew,

Thank you for the quick reply.

I did manage to compile the C++ lib and I run the test code provided on the github page, and everything works as they suppose to be.

I have no idea on the 32/64 bit stuff. I opened libad3.a and they are just numbers.

On Wed, Nov 13, 2013 at 6:06 PM, Andre Martins notifications@github.comwrote:

Hi Zhibo,

The first piece of the output are just warnings. I think the problem is revealed in this line:

ld: warning: ignoring file ../ad3//libad3.a, file was built for archive which is not the architecture being linked (i386): ../ad3//libad3.a

It looks there is some mismatch between compiling with 32/64 bits?

Just to make sure, did you manage to compile the C++ lib first by running make in the ad3 folder?

André

2013/11/13 Zhibo Xiao notifications@github.com

Hi, I have trouble install ad3 python on my mac.

I am running Python in virtualenv on Mavericks. I didn't perform a clean install from scratch, just upgraded from Mountain Lion. The Python environment is in a virtualenv, so this probably doesn't have anything to do with OSX.

Below is the output of the compilation.

$ python setup.py installrunning installrunning buildrunning build_extcythoning factor_graph.pyx to factor_graph.cppbuilding 'ad3' extensioncreating buildcreating build/temp.macosx-10.8-intel-2.7cc -fno-strict-aliasing -fno-common -dynamic -arch i386 -arch x86_64 -I/usr/local/include -I/usr/local/opt/sqlite/include -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I../

-I/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/include/python2.7

-c factor_graph.cpp -o build/temp.macosx-10.8-intel-2.7/factor_graph.oIn file included from factor_graph.cpp:316:./../ad3/Factor.h:414:70: warning: control reaches end of non-void function

[-Wreturn-type] vector _additional_evidence) { assert(false); } ^In file included from factorgraph.cpp:318:In file included from ./../ad3/FactorGraph.h:22:./../ad3/FactorDense.h:167:8: warning: 'AD3::FactorDense::Initialize' hides overloaded virtual function [-Woverloaded-virtual] void Initialize(const vector<MultiVariable> &multi_variables) { ^./../ad3/Factor.h:117:16: note: hidden overloaded virtual function 'AD3::Factor::Initialize' declared here virtual void Initialize(const vector<BinaryVariable> &binary_variables, ^2 warnings generated.In file included from factor_graph.cpp:316:./../ad3/Factor.h:414:70: warning: control reaches end of non-void function [-Wreturn-type] vector _additional_evidence) { assert(false); } ^In file included from factorgraph.cpp:318:In file included from ./../ad3/FactorGraph.h:22:./../ad3/FactorDense.h:167:8: warning: 'AD3::FactorDense::Initialize' hides overloaded virtual function [-Woverloaded-virtual] void Initialize(const vector<MultiVariable> &multi_variables) { ^./../ad3/Factor.h:117:16: note: hidden overloaded virtual function 'AD3::Factor::Initialize' declared here virtual void Initialize(const vector<BinaryVariable> &binary_variables, ^2 warnings generated.creating build/lib.macosx-10.8-intel-2.7c++ -bundle -undefined dynamic_lookup -arch i386 -arch x86_64 -isysroot / -L/usr/local/lib -L/usr/local/opt/sqlite/lib build/temp.macosx-10.8-intel-2.7/factor_graph.o -L../ad3/ -lad3 -o build/lib.macosx-10.8-intel-2.7/ad3.sold: warning: ignoring file ../ad3//libad3.a, file was built for archive which is not the architecture being linked (i386): ../ad3//libad3.arunning install_libcopying build/lib.macosx-10.8-intel-2.7/ad3.so -> /Users/sean/.virtualenvs/mycode/lib/python2.7/site-packagesrunning install_egg_infoWriting

/Users/sean/.virtualenvs/mycode/lib/python2.7/site-packages/UNKNOWN-0.0.0-py2.7.egg-info

Next is the error information from iPython

In [1]: import

ad3---------------------------------------------------------------------------ImportError

Traceback (most recent call last) in

()----> 1 import ad3 > /Users/sean/github/AD3/python/ad3/**init**.py in ()----> 1 > from > factor_graph import PBinaryVariable, PFactorGraph, PMultiVariable > 2 from simple_inference import simple_grid, general_graph > ImportError: No module named factor_graph > > I did check the **init**.py file, and there is no factor_graph in it, > and > that UNKNOWN egg in site-package is probably have something to do with > the failure. > > — > Reply to this email directly or view it on GitHub< > https://github.com/andre-martins/AD3/issues/10> > . — Reply to this email directly or view it on GitHub< https://github.com/andre-martins/AD3/issues/10#issuecomment-28382700> .

肖智博 (Zhibo Xiao) / Sean | Ph.D. candidate of Machine Learning & Data Mining

Room 106, Information School, Dalian Maritime University, Dalian, China, 116026

— Reply to this email directly or view it on GitHubhttps://github.com/andre-martins/AD3/issues/10#issuecomment-28386106 .

aurora1625 commented 11 years ago

I think the 32/64 bit is the problem here. I found out more on this: http://stackoverflow.com/questions/2088569/how-do-i-force-python-to-be-32-bit-on-snow-leopard-and-other-32-bit-64-bit-quest

I will install another python in a virtualenv and try to remove 64bit python and try installing ad3 again.