We're Hiring!

ice for anaconda python on macos

Having a problem deploying OMERO? Please ask new questions at https://forum.image.sc/tags/omero
Please note:
Historical discussions about OMERO. Please look for and ask new questions at https://forum.image.sc/tags/omero

The OMERO.server installation documentation begins here and you can find OMERO.web deployment documentation here.

ice for anaconda python on macos

Postby achessel » Tue Mar 31, 2015 1:41 pm

Hi all,

I would like to use omero.python under mac. I am using the anaconda python distribution, and I am having trouble making ice work with it. The binaries seem to be against the system python with no way to change it, compiling from source is tricky because of various prereqs. I tried tinkering with the homebrew recipe but with no luck so far (i.e. the compiled module does not work under anaconda python, even though it's the one found on the path). Am I missing something, anybody got a solution?

Many thanks...

A.
achessel
 
Posts: 67
Joined: Fri Jan 14, 2011 1:58 pm

Re: ice for anaconda python on macos

Postby rleigh » Tue Mar 31, 2015 3:57 pm

Building Ice from source is probably the way to go here. The main problem is that the upstream Makefiles hardcode stuff for Darwin which mandates the use of system python; you'll probably want to apply the patches at the end of

https://github.com/Homebrew/homebrew/bl ... ula/ice.rb

to make it use another Python. The prereqs to build Ice (openssl mcpp) should all be installable with Homebrew, or by hand if you want to avoid it. I think that so long as you "brew install --with-python" ice from source and have anaconda python on your path, then you should get it built against anaconda python; you might possibly need to be sure that it's linking against the anaconda libpython; maybe you need LDFLAGS to add -L/path/to/anaconda_libs to do that. If you want to build outside homebrew, the steps in the homebrew formula should be sufficient apart from that.

When you say that the compiled module doesn't work under anaconda python, what's failing?
Can you "import IcePy"?
What does "otool -L" on the IcePy module show?


Regards,
Roger
User avatar
rleigh
 
Posts: 217
Joined: Tue Mar 13, 2012 11:45 am

Re: ice for anaconda python on macos

Postby achessel » Wed Apr 01, 2015 4:49 pm

Thanks for answering...

The error is the following, which seem to be typical of compiling and running on different python:
Code: Select all
Python 2.7.9 |Anaconda 2.1.0 (x86_64)| (default, Dec 15 2014, 10:37:34)
[GCC 4.2.1 (Apple Inc. build 5577)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://binstar.org
>>> import IcePy
Fatal Python error: Interpreter not initialized (version mismatch?)
Abort trap: 6


I found one problem, which was the existence of a macport installed python I completely forgot about (and indeed the module would import on that one). I completely removed all macport packages. There is now only two python, anaconda and system (that's what 'type -a python' tells me anyway)

I am using the homebrew formula, which does seem to compile things against the right python (so he does see it, as that is defined at compile time in the make.rules AFAIK):

Code: Select all
clang++  -dynamiclib -Wall -D_REENTRANT -L../../python -Wl,-rpath,/usr/local/Cellar/ice/3.5.1_1/lib -o ../../python/IcePy.3.5.1.dylib -install_name @rpath/IcePy.35.so   Communicator.o Connection.o ConnectionInfo.o Current.o Endpoint.o EndpointInfo.o ImplicitContext.o Init.o Logger.o ObjectAdapter.o ObjectFactory.o Operation.o Properties.o PropertiesAdmin.o Proxy.o Slice.o Thread.o Types.o Util.o -L../../../cpp/lib -lIce -lSlice -lIceUtil -L/Users/achessel/anaconda/lib/python2.7/config -lpython2.7

but still the issue remains, with the module giving the above error for both anaconda python and system python (but then what is it compiled against?). I don't know if it's relevant, but the ice library in the python folder doesn't seem to be linked to any python at all:

Code: Select all
rcssp235anatole:Desktop achessel$ otool -L /usr/local/Cellar/ice/3.5.1_1/lib/python2.7/site-packages/IcePy.so
/usr/local/Cellar/ice/3.5.1_1/lib/python2.7/site-packages/IcePy.so:
   /usr/local/lib/python2.7/site-packages/IcePy.35.so (compatibility version 0.0.0, current version 0.0.0)
   @rpath/libIce.35.dylib (compatibility version 0.0.0, current version 0.0.0)
   @rpath/libSlice.35.dylib (compatibility version 0.0.0, current version 0.0.0)
   @rpath/libIceUtil.35.dylib (compatibility version 0.0.0, current version 0.0.0)
   /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.0.0)
   /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)


Thanks for any help...
achessel
 
Posts: 67
Joined: Fri Jan 14, 2011 1:58 pm

Re: ice for anaconda python on macos

Postby rleigh » Thu Apr 02, 2015 1:31 pm

You are correct that it doesn't seem to be linked against libpython (in contrast to Linux); I have the same:

Code: Select all
% otool -L /usr/local/lib/python2.7/site-packages/IcePy.so
/usr/local/lib/python2.7/site-packages/IcePy.so:
        /usr/local/lib/python2.7/site-packages/IcePy.35.so (compatibility version 0.0.0, current version 0.0.0)
        @rpath/libIce.35.dylib (compatibility version 0.0.0, current version 0.0.0)
        @rpath/libSlice.35.dylib (compatibility version 0.0.0, current version 0.0.0)
        @rpath/libIceUtil.35.dylib (compatibility version 0.0.0, current version 0.0.0)
        /usr/local/Frameworks/Python.framework/Versions/2.7/Python (compatibility version 2.7.0, current version 2.7.0)
        /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.0.0)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)


Looking at the needed symbols, with "nm -u", you can see a bunch of python symbols to be provided by the interpreter. Other than making sure it's built against the correct libpython, to ensure the symbols are all satisfied, it's difficult to see what else is wrong.

One potential thing to check is whether you're building Ice with the same compiler/libstdc++ as was used to build anaconda python. For example, if it's using gcc from MacOS 10.8 (clang wrapper with libstdc++) that's not going to be link-compatible with clang++ with libc++ with MacOS 10.9/10.10. Since Python is C-only, it shouldn't be a problem, but might be something worth checking.

I would also suggest looking at each undefined symbol above, and then comparing with what's defined in the libpython used by your interpreter e.g. with:
Code: Select all

% otool -L /usr/local/bin/python                                                         
/usr/local/bin/python:
        /usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/Python (compatibility version 2.7.0, current version 2.7.0)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)

% nm  /usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/Python


I've seen issues with "import IcePy" before, particularly on Windows, and these were always due to a ABI incompatibility preventing the module load, or the Ice DLLs not being on the search path.

May also be worth checking: are the Ice .dylibs on your DYLD_LIBRARY_PATH if they aren't on the standard search path?


Kind regards,
Roger
User avatar
rleigh
 
Posts: 217
Joined: Tue Mar 13, 2012 11:45 am


Return to Installation and Deployment

Who is online

Users browsing this forum: No registered users and 1 guest