Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when import figtree module in Python [Mac OS X Yosemite] #2

Open
DSamuylov opened this issue May 13, 2015 · 4 comments
Open

Error when import figtree module in Python [Mac OS X Yosemite] #2

DSamuylov opened this issue May 13, 2015 · 4 comments

Comments

@DSamuylov
Copy link

Hello,

I had been using your library mostly through Python wrapper without any problem on Ubuntu 12.04 and Ubuntu 14.10. Now I migrated to Mac (OS X Yosemite). I am doing exactly the same steps I did with Ubuntu, but there is an error when I import figtree module:

Python 2.7.9 |Anaconda 2.2.0 (x86_64)| (default, Dec 15 2014, 10:37:34) 
>>> import figtree
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: dlopen(/Users/denis/Documents/code/figtree/python/figtree.so, 2): Library not loaded: ../lib/libfigtree.so
  Referenced from: /Users/denis/Documents/code/figtree/python/figtree.so
  Reason: image not found

The most weird thing for me is that it seems libfigtree.so exists at that location:

denis@DeSaMac:lib$ pwd
/Users/denis/Documents/code/figtree/lib
denis@DeSaMac:lib$ ls
libann_figtree_version.so   libfigtree.so 

I asked my colleague to install figtree on his laptop (also Mac, OS X Yosemite) without telling him how I did it, and he got the same error. So I might guess there is a problem with installation on OS X or Mac in general. Do you have an idea what can be a reason? I tried to check Makefiles, but I don't have enough experience to spot if there is a problem there...

All the best,
Denis

@gadomski
Copy link

Hi Denis,

figtree at this point is set up only to build out on Unix style systems, as it only builds libraries with a *.so extension.

I've put together one solution to the problem in my own fork of figree, on the cmakeify branch: https://github.com/gadomski/figtree/tree/cmakeify. It uses CMake instead of plain makefiles for many-platform building.

To get set up:

git remote add gadomski https://github.com/gadomski/figtree
git fetch gadomski
git checkout gadomski/cmakify
mkdir build && cd build
cmake ..
make

You of course have to have cmake installed on your system — if you don't, I recommend using homebrew to get it.

HTH.

@vmorariu
Copy link
Owner

Hi Denis,

I agree with Pete--most likely, your problems are due to the fact that when I initially wrote the code, I was not yet using CMake, and Mac was not one of my target platforms. I plan to replace the Visual Studio projects and Unix/Linux makefiles with CMake files, but for now see if Pete's gadomski/cmakify branch fixes your problem.

Vlad

@DSamuylov
Copy link
Author

Dear Pete and Vlad,

Thank you a lot for your prompt reply! I managed to make the python wrapper work.

Just to let you know, before I call

python setup.py build_ext --inplace

I had to copy the compiled libraries into lib folder manually

figtree/lib/libann_figtree_version.dylib
figtree/lib/libfigtree.dylib

Otherwise it cannot find them and gives an error during the python module compilation.

Also if I follow Pete's steps on the third one I have a problem:

$ git checkout gadomski/cmakify
error: pathspec 'gadomski/cmakify' did not match any file(s) known to git.

I found that I could call

$ git show-ref

And then use reference to checkout. But I guess I miss an easier correct way...

@gadomski
Copy link

Sorry @DSamuylov typo in my instructions, should be gadomski/cmakeify.

@vmorariu let me know if you'd like me to clean up my cmake branch and open a pull request — could be an easy way to offer support for more platforms out of the box.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants