Installing mahotas

198 views
Skip to first unread message

csilvaab

unread,
Mar 9, 2011, 1:30:55 PM3/9/11
to pythonvision
Hi,

Has anybody installed successfully mahotas (0.6.3) on Mac OSX Snow
using pip ?

It fails with the message (truncated) below.

Thanks,

Carlos Silva.

/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/bits/
locale_facets.h:256: error: ‘__c’ was not declared in this scope

/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/bits/
locale_facets.h: At global scope:

/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/bits/
locale_facets.h:796: error: ‘btowc’ is not a type

/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/bits/
locale_facets.h:813: error: expected ‘;’ before ‘const’

/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/bits/
locale_facets.h:828: error: expected `;' before ‘char_type’

/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/bits/
locale_facets.h:829: error: ‘btowc’ is not a type

/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/bits/
locale_facets.h:846: error: expected ‘;’ before ‘const’

/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/bits/
locale_facets.h:865: error: expected `;' before ‘char_type’

/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/bits/
locale_facets.h: In member function ‘char
std::ctype<char>::towupper(int (*)(char)) const’:

/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/bits/
locale_facets.h:797: error: ‘__c’ was not declared in this scope

/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/bits/
locale_facets.h: In member function ‘char
std::ctype<char>::towlower(int (*)(char)) const’:

/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/bits/
locale_facets.h:830: error: ‘__c’ was not declared in this scope

In file included from /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/
4.2.1/bits/basic_ios.h:44,

from /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/
4.2.1/ios:50,

from /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/
4.2.1/ostream:44,

from /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/
4.2.1/iterator:70,

from mahotas/numpypp/array.hpp:9,

from mahotas/_filters.h:6,

from mahotas/_filters.cpp:35:

/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/bits/
locale_facets.h: At global scope:

/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/bits/
locale_facets.h:4502: error: function definition does not declare
parameters

/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/bits/
locale_facets.h:4520: error: function definition does not declare
parameters

/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/bits/
locale_facets.h:4526: error: function definition does not declare
parameters

/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/bits/
locale_facets.h:4532: error: function definition does not declare
parameters

/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/bits/
locale_facets.h:4556: error: function definition does not declare
parameters

/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/bits/
locale_facets.h:4568: error: function definition does not declare
parameters

/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/bits/
locale_facets.h:4574: error: function definition does not declare
parameters

error: Command "g++ -fno-strict-aliasing -fno-common -dynamic -arch
i386 -isysroot /Developer/SDKs/MacOSX10.5.sdk -DNDEBUG -g -O3 -arch
i386 -isysroot /Developer/SDKs/MacOSX10.5.sdk -I/Library/Frameworks/
Python.framework/Versions/6.3/include -I/Library/Frameworks/
Python.framework/Versions/6.3/lib/python2.6/site-packages/numpy/core/
include -I/Library/Frameworks/Python.framework/Versions/6.3/include/
python2.6 -c mahotas/_filters.cpp -o build/temp.macosx-10.5-i386-2.6/
mahotas/_filters.o" failed with exit status 1

Luis Pedro Coelho

unread,
Mar 9, 2011, 1:34:11 PM3/9/11
to python...@googlegroups.com
If anyone has, can they please tell me how.

Mac OS is always a problematic operating system for me, it seems so
complicated. So, if you figure this out, please let me know what needs
to be changed and I'll include it in the next release.

Thanks
Luis

signature.asc

K.-Michael Aye

unread,
Mar 10, 2011, 11:38:53 AM3/10/11
to python...@googlegroups.com
I'm figting it, but no success so far.
Google says, that it might be caused by a wrong sequence of include statements?
Luis, would you have an idea where to look?

Best regards,
Michael

Jan Erik Solem

unread,
Mar 22, 2011, 7:15:06 PM3/22/11
to pythonvision
Building from source http://www.github.com/luispedro/mahotas works
fine (Mac OS X 10.6.6). Download and then run:

sudo python setup.py install

cheers,
/Jan Erik

On Mar 10, 9:38 am, "K.-Michael Aye" <kmichael....@googlemail.com>
wrote:

Jan Erik Solem

unread,
Mar 22, 2011, 9:17:44 PM3/22/11
to pythonvision
One more thing: Carlos, you have 10.5 in all the paths. Snow Leopard
is 10.6.x. Could be a source of your problems. On my Snow Leopard I
have two SDKs in that folder:
"/Developer/SDKs/MacOSX10.5.sdk/..."
"/Developer/SDKs/MacOSX10.6.sdk/..."

Try the other one.

/Jan Erik

On Mar 22, 4:15 pm, Jan Erik Solem <jeso...@gmail.com> wrote:
> Building from sourcehttp://www.github.com/luispedro/mahotasworks

K.-Michael Aye

unread,
Mar 23, 2011, 1:12:14 AM3/23/11
to python...@googlegroups.com
Now this is interesting:

Building it with Apple's python works indeed, but it fails with Enthought's python environment, both with the 32-bit and the 64-bit environment!
That's a real pity, because Enthought is great for scientists who just don't want to know about library dependencies and just want a free scientific Python environment.
Guess I will post it in the Enthought dev group, let's see what they say.

Best regards,
Michael

Carlos A. Silva

unread,
Mar 23, 2011, 4:53:33 AM3/23/11
to python...@googlegroups.com
Hi Jan,

I did not considered that since I have been able to compile and install other python packages. As another person have posted I am also using EPD. I will try your suggestion.

Thanks,

Carlos Silva.
--
Carlos A. Silva
University of Minho
Department of Industrial Electronics
Campus de Azurém
4800 - 058 Guimarães
PORTUGAL

Tel: +351 253 510190/1
Fax: +351 253 510189

"Iron sharpens iron, So one man sharpens another." Prov. 27:17.

K.-Michael Aye

unread,
Mar 26, 2011, 3:41:59 PM3/26/11
to python...@googlegroups.com
Hi Luis and others,

I think I have fixed the C++ macro errors at compilation by putting the
Python.h include after the C++ includes.
It compiles fine now, but there is a remaining problem with Python not
finding the _bbox module when I try to import mahotas into iPython.
Maybe one of you know's what to fix?
I have sent Luis a pull request from my fork that is here:
https://github.com/michaelaye/mahotas

Hope we are close to closing this out! ;)

Best regards,
Michael

Carlos A. Silva wrote:
> Hi Jan,
>
> I did not considered that since I have been able to compile and install
> other python packages. As another person have posted I am also using
> EPD. I will try your suggestion.
>
> Thanks,
>
> Carlos Silva.
>
> On Wed, Mar 23, 2011 at 1:17 AM, Jan Erik Solem <jes...@gmail.com
> <mailto:jes...@gmail.com>> wrote:
>
> One more thing: Carlos, you have 10.5 in all the paths. Snow Leopard
> is 10.6.x. Could be a source of your problems. On my Snow Leopard I
> have two SDKs in that folder:
> "/Developer/SDKs/MacOSX10.5.sdk/..."
> "/Developer/SDKs/MacOSX10.6.sdk/..."
>
> Try the other one.
>
> /Jan Erik
>
> On Mar 22, 4:15 pm, Jan Erik Solem <jeso...@gmail.com

> <mailto:jeso...@gmail.com>> wrote:
> > Building from sourcehttp://www.github.com/luispedro/mahotasworks
> <http://www.github.com/luispedro/mahotasworks>
> > fine (Mac OS X 10.6.6). Download and then run:
> >
> > sudo python setup.py install
> >
> > cheers,
> > /Jan Erik
> >
> > On Mar 10, 9:38 am, "K.-Michael Aye" <kmichael....@googlemail.com

> <mailto:kmichael....@googlemail.com>>

> > > >> locale_facets.h:256: error: �__c� was not declared in this scope


> >
> > > >> /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/bits/
> > > >> locale_facets.h: At global scope:
> >
> > > >> /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/bits/

> > > >> locale_facets.h:796: error: �btowc� is not a type
> >
> > > >> /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/bits/
> > > >> locale_facets.h:813: error: expected �;� before �const�
> >
> > > >> /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/bits/
> > > >> locale_facets.h:828: error: expected `;' before �char_type�
> >
> > > >> /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/bits/
> > > >> locale_facets.h:829: error: �btowc� is not a type
> >
> > > >> /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/bits/
> > > >> locale_facets.h:846: error: expected �;� before �const�
> >
> > > >> /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/bits/
> > > >> locale_facets.h:865: error: expected `;' before �char_type�
> >
> > > >> /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/bits/
> > > >> locale_facets.h: In member function �char
> > > >> std::ctype<char>::towupper(int (*)(char)) const�:
> >
> > > >> /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/bits/
> > > >> locale_facets.h:797: error: �__c� was not declared in this scope
> >
> > > >> /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/bits/
> > > >> locale_facets.h: In member function �char
> > > >> std::ctype<char>::towlower(int (*)(char)) const�:
> >
> > > >> /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/bits/
> > > >> locale_facets.h:830: error: �__c� was not declared in this scope

> Campus de Azur�m
> 4800 - 058 Guimar�es

Luis Pedro Coelho

unread,
Mar 27, 2011, 10:52:09 PM3/27/11
to python...@googlegroups.com
Ah, thank you!

I can't believe it was this simple in the end.

(I'll pull from your branch).

Tx
Luis

> > > > >> locale_facets.h:256: error: ‘__c’ was not declared in this


> > > > >> scope
> > > > >>
> > > > >> /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/bits/
> > > > >> locale_facets.h: At global scope:
> > > > >>
> > > > >> /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/bits/

> > > > >> locale_facets.h:796: error: ‘btowc’ is not a type
> > > > >>
> > > > >> /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/bits/
> > > > >> locale_facets.h:813: error: expected ‘;’ before ‘const’
> > > > >>
> > > > >> /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/bits/


> > > > >> locale_facets.h:828: error: expected `;' before ‘char_type’
> > > > >>
> > > > >> /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/bits/

> > > > >> locale_facets.h:829: error: ‘btowc’ is not a type
> > > > >>
> > > > >> /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/bits/
> > > > >> locale_facets.h:846: error: expected ‘;’ before ‘const’
> > > > >>
> > > > >> /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/bits/
> > > > >> locale_facets.h:865: error: expected `;' before ‘char_type’
> > > > >>
> > > > >> /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/bits/


> > > > >> locale_facets.h: In member function ‘char
> > > > >> std::ctype<char>::towupper(int (*)(char)) const’:
> > > > >>
> > > > >> /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/bits/

> > > > >> locale_facets.h:797: error: ‘__c’ was not declared in this
> > > > >> scope
> > > > >>
> > > > >> /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/bits/


> > > > >> locale_facets.h: In member function ‘char
> > > > >> std::ctype<char>::towlower(int (*)(char)) const’:
> > > > >>
> > > > >> /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/bits/

> > > > >> locale_facets.h:830: error: ‘__c’ was not declared in this

> > Campus de Azurém
> > 4800 - 058 Guimarães

signature.asc

Luis Pedro Coelho

unread,
Mar 27, 2011, 11:11:49 PM3/27/11
to python...@googlegroups.com
On Saturday, March 26, 2011 03:41:59 pm K.-Michael Aye wrote:
> It compiles fine now, but there is a remaining problem with Python not
> finding the _bbox module when I try to import mahotas into iPython.
> Maybe one of you know's what to fix?

That's probably because you forgot to build it in development mode.

Try 'python setup.py test' (this only works on fairly current master, but the
most current is yours—which I just merged).

Tx
Luis

signature.asc

K.-Michael Aye

unread,
Mar 28, 2011, 4:25:19 AM3/28/11
to python...@googlegroups.com

Luis Pedro Coelho wrote:
> On Saturday, March 26, 2011 03:41:59 pm K.-Michael Aye wrote:
>> It compiles fine now, but there is a remaining problem with Python not
>> finding the _bbox module when I try to import mahotas into iPython.
>> Maybe one of you know's what to fix?
>
> That's probably because you forgot to build it in development mode.
>

If that's a requirement, it should be mentioned in the INSTALL readme, no?

> Try 'python setup.py test' (this only works on fairly current master, but the
> most current is yours—which I just merged).
>

Tried that, then it complained about freeimage missing.
Is there a proprietary problem with just using PIL? Or does PIL support
less formats?
So, after I installed freeimage on the Mac, the 'test' still could not
find the library, even so I had this in my /usr/local/lib:

libfreeimage.a
libfreeimage-3.15.0.dylib
libfreeimage.3.dylib -> libfreeimage-3.15.0.dylib

available.

I then added a symlink:
libfreeimage.dylib -> libfreeimage.3.dylib

and the start started to execute but crashed:
>> mahotas.tests.test_freeimage.test_freeimage ... Segmentation fault

Any idea? Does it run for you?

Installation and importing mahotas in a Python session works now though. ;)

Best regards,
Michael

Shachar Lerer

unread,
Aug 27, 2014, 6:14:14 AM8/27/14
to python...@googlegroups.com
Hi,

I'm encountering the same problem with the latest version (1.2.1).
Can you please explain what you mean by 'forgot to build it in development mode'?

I get the same result by installing using 'pip install mahotas' and the 'python setup.py build' & 'python setup.py install' options.

Thanks!

Luis Pedro Coelho

unread,
Aug 27, 2014, 7:04:24 AM8/27/14
to python...@googlegroups.com
Hi,

I cannot help you with the specifics of Mac OS X, but is there any
reason why you are using such an old version? (0.6.3 is from February
2011).

Thanks
Luis
--
Luis Pedro Coelho | EMBL | http://luispedro.org
My blog: http://metarabbit.wordpress.com
Reply all
Reply to author
Forward
0 new messages