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

Mac OS Issue #25

Open
dgmclare opened this issue Dec 18, 2016 · 9 comments
Open

Mac OS Issue #25

dgmclare opened this issue Dec 18, 2016 · 9 comments

Comments

@dgmclare
Copy link

Using: from pyminc.volumes.factory import *

Leads to the following issue:
/Users/mclaren/ in ()
----> 1 from pyminc.volumes.factory import *

/usr/local/lib/python2.7/site-packages/pyminc/volumes/factory.py in ()
1 """factories for creating mincVolumes"""
2
----> 3 from .volumes import mincException,mincVolume
4
5 def volumeFromFile(filename, dtype="float", readonly=True, labels=False):

/usr/local/lib/python2.7/site-packages/pyminc/volumes/volumes.py in ()
----> 1 from .libpyminc2 import *
2 from .hyperslab import HyperSlab
3 import operator
4 import os
5 import sys

/usr/local/lib/python2.7/site-packages/pyminc/volumes/libpyminc2.py in ()
107 # argument declarations - not really necessary but does make

108 # segfaults a bit easier to avoid.

--> 109 libminc.miopen_volume.argtypes = [c_stringy, c_int, POINTER(mihandle)]
110 libminc.miget_real_value.argtypes = [mihandle, location, c_int, POINTER(voxel)]
111 libminc.miget_volume_dimensions.argtypes = [mihandle, c_int, c_int, c_int,

/Library/Frameworks/EPD64.framework/Versions/7.3/lib/python2.7/ctypes/init.pyc in getattr(self, name)
376 if name.startswith('') and name.endswith(''):
377 raise AttributeError(name)
--> 378 func = self.getitem(name)
379 setattr(self, name, func)
380 return func

/Library/Frameworks/EPD64.framework/Versions/7.3/lib/python2.7/ctypes/init.pyc in getitem(self, name_or_ordinal)
381
382 def getitem(self, name_or_ordinal):
--> 383 func = self._FuncPtr((name_or_ordinal, self))
384 if not isinstance(name_or_ordinal, (int, long)):
385 func.name = name_or_ordinal

AttributeError: dlsym(0x102fdc290, miopen_volume): symbol not found

@mcvaneede
Copy link
Member

Hi,

Apologies for the late response. I've tested the import on OS X 10.11.5 using python 3.5.1 (pyminc has been made Python3 compatible) using the minc-toolkit packages from here:

http://bic-mni.github.io
More specifically:
http://packages.bic.mni.mcgill.ca/minc-toolkit/MacOSX/minc-toolkit-1.9.11-20160202-Darwin-10.11-x86_64.dmg

and am not seeing the same issues. The LD_LIBRARY_PATH for the above package is:

/opt/minc-itk4/lib

So exporting the LD_LIBRARY_PATH as follows:

export LD_LIBRARY_PATH=/opt/minc-itk4/lib:$LD_LIBRARY_PATH

should do the trick. Can I ask how you've installed the MINC libraries?

@bcdarwin
Copy link
Member

My impression was that this wouldn't work anymore on macs ... @cfhammill ?

@mcvaneede
Copy link
Member

I worked when I just tried it... :-) Perhaps because it's a slightly outdated version of the Mac OS?

@cfhammill
Copy link
Member

Did the issue happen before you set the LD_LIBRARY_PATH Matthijs? LD_LIBRARY_PATH shouldn't
do anything on MacOS, it's DYLD_LIBRARY_PATH and even that is now purged when running programs by the mac security settings.

@mcvaneede
Copy link
Member

Before setting the LD_LIBRARY_PATH I got the error:

OSError: dlopen(libminc2.so, 6): image not found

Afterwards I had no errors at all loading pyminc.volumes.factory

@dgmclare
Copy link
Author

I think I've made some progress. I can now run "from pyminc.volumes.factory import *"; however, this only works from within python.

If I generate a python script, which works on linux without any issues, then run it on my local machine -- using minctools installed as described above. I've also set the LD_LIBRARY_PATH in bash.

File "./create_noise.py", line 7, in
from pyminc.volumes.factory import *
File "/usr/local/lib/python2.7/site-packages/pyminc/volumes/factory.py", line 3, in
from .volumes import mincException,mincVolume
File "/usr/local/lib/python2.7/site-packages/pyminc/volumes/volumes.py", line 1, in
from .libpyminc2 import *
File "/usr/local/lib/python2.7/site-packages/pyminc/volumes/libpyminc2.py", line 18, in
libminc = cdll.LoadLibrary("libminc2.so")
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ctypes/init.py", line 443, in LoadLibrary
return self._dlltype(name)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ctypes/init.py", line 365, in init
self._handle = _dlopen(self._name, mode)
OSError: dlopen(libminc2.so, 6): image not found

I am running on 10.12, which may be the issue.

@mcvaneede
Copy link
Member

What did you set your LD_LIBRARY_PATH to? And what is the full name of the MINC library you have installed on the Mac?

@dgmclare
Copy link
Author

dgmclare commented Feb 10, 2017 via email

@mcvaneede
Copy link
Member

I'm getting the same kinds of errors when I'm using python 2.7. However, using python 3.5.1 resolves them. Can you give that a try?

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

4 participants