mlpy install macosx

1,689 views
Skip to first unread message

Guillaume Chanel

unread,
Mar 16, 2011, 4:28:48 AM3/16/11
to mlpy-general
Hi all,

It seems I have troubles answering messages of others, anyone has the
same problem? I tried to reply to Hana without success, so this post
is related to mlpy install on macosx.

I also got this problem. Some paths to the headers are missing is the
setup.py I manage to compile after a few modifications:
- add gsl include directory path in the variable base_path
- add the base_path where it is missing

I can send you the new setup.py file if you want, give me you e-mail.

But now I have this error when running in netbeans:
Traceback (most recent call last):
File "/Users/chanel/Dropbox/work/Codes/Python/EmoPlay/src/
emoplay.py", line 15, in <module>
import mlpy
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
python2.6/site-packages/mlpy/__init__.py", line 29, in <module>
from _dwt import *
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
python2.6/site-packages/mlpy/_dwt.py", line 20, in <module>
import dwt as dwt_c
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.6/
lib/python2.6/site-packages/mlpy/dwt.so, 2): Symbol not found:
_gsl_wavelet_bspline
Referenced from: /Library/Frameworks/Python.framework/Versions/2.6/
lib/python2.6/site-packages/mlpy/dwt.so
Expected in: dynamic lookup

Any idea on this one ?

Guillaume

Guillaume Chanel

unread,
Mar 17, 2011, 11:00:14 AM3/17/11
to mlpy-general
Ok I found it !

the problem came that for an unknown reason the libs where compiled on
the wrong platform (probably 64bits or something else). Anyway I
needed to recompile gsl with the following configuration:

./configure CC="gcc -arch i386" CXX="g++ -arch i386"

Do not forget to make clean first, then the configure line above then
make and finally make install. You can then recompile MLPY without the
warnings and compile your own script safely.

I have seen several post about this problem. Hope this will help you
all !

Guillaume

Gergely Juhasz

unread,
Mar 10, 2012, 1:49:25 PM3/10/12
to mlpy-g...@googlegroups.com
Thanks, 
I have tried your advice about the new gsl configure, but it still does not work. It is not clear for me, should I still edit setp.py with the path to difference gsl include files?
If yes, how should I do that? (sorry, I am a very beginner in python and mlpy)

Yotam G.

unread,
Mar 26, 2012, 4:43:52 PM3/26/12
to mlpy-g...@googlegroups.com
Hi,

I also had a problem with missing GSL on Mac OS X.  To fix it I installed GSL via macports:
    $ sudo port install gsl
and then modified mlpy's setup.py (see attached) to reference macports's GSL.  Then I could build and install mlpy:
    $ python2.7 setup.py build
    $ sudo python2.7 setup.py install

Hope this helps,
Yotam


The day Saturday, March 10, 2012 13:49:25 UTC-5, Gergely Juhasz wrote:
Thanks, 
I have tried your advice about the new gsl configure, but it still does not work. It is not clear for me, should i still edit setp.py difference with the path to gsl include files?
If yes, how should i do that? (Sorry, I am a very beginner in python and mlpy) On Friday, March 18, 2011 12:00:14 AM UTC +9, Guillaume Chanel wrote:

Ok I found it! CAME That the problem for an unknown reason the libs where compiled on the wrong platform (probably 64bit or something else). Anyway I needed to recompile gsl with The following configuration: . / configure CC = "gcc-arch i386" CXX = "g + +-arch i386" Do not forget to make clean first, then the configure line above then make and finally make install. You can then recompile MLPY without the warnings and compile your own scripts safely. Several post I have seen about this problem. Hope this will help you all! Guillaume On Mar 16, 09:28, Guillaume Chanel < guillaume.cha unige.ch @ ... > wrote: > Hi all, > > It Seems I have troubles answering messages of others, has anyone the > same problem? I tried to reply to Hana without success, I know this post > is related to mlpy install on macosx. > > Also I got this problem. Some paths to the headers are missing is the > setup.py I manage to compile after A Few modifications: > - gsl add in the include directory path base_path variable > - add the base_path where it is missing > > I can send you the new setup.py file if you want, give me you e-mail. > > But now I have this error When running in netbeans: > Traceback (most recent call last): > File "/ Users / chanel / Dropbox / work / Codes / Python / EmoPlay / src / > emoplay.py ", line 15, in <module> > import mlpy > File "/ Library / Frameworks / Python. framework/Versions/2.6/lib / > python2.6/site-packages / mlpy / _ _init__.py ", line 29, in <module> > _dwt from import * > File "/ Library / Frameworks / Python. framework/Versions/2.6/lib / > python2.6/site-packages/mlpy/_ dwt.py ", line 20, in <module> > import dwt as dwt_c > ImportError: dlopen (/ Library / Frameworks / Python.framework/Versions/2.6 / > lib/python2.6/site-packages / mlpy / dwt. I, 2): Symbol not found: > _gsl_wavelet_bspline > Referenced from: / Library / Frameworks / Python. framework/Versions/2.6 / > lib/python2.6/site-packages / mlpy / dwt.so > Expected in: dynamic lookup > > Any idea on this one? > > Guillaume


















































setup.py

Jelena Chuklina

unread,
Jun 3, 2013, 10:28:15 AM6/3/13
to mlpy-g...@googlegroups.com
Hello,
there seems still to be problem with gsl:

Python 2.7.5 (default, Jun  3 2013, 13:31:48)
[GCC 4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.28)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import mlpy

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "mlpy/__init__.py", line 18, in <module>
    import gsl
ImportError: No module named gsl

Would very much appreciate help on how to install gsl correctly. What I did today sudo port install gsl.

понедельник, 26 марта 2012 г., 22:43:52 UTC+2 пользователь Yotam G. написал:

William Groves

unread,
Nov 28, 2013, 3:16:47 AM11/28/13
to mlpy-g...@googlegroups.com
I had a similar issue. The mlpy library cannot find the gsl.so library file that it compiled. The "import gsl" is referring to the gsl connector library that mlpy compiled during the build process. Ensure that the package is being installed to a path that will be searched for shared libraries.

If the /usr/local/lib directory is not being searched for loadable .so files. A possible solution is:

sudo mv /usr/local/lib/python2.7/dist-packages/mlpy /usr/lib/python2.7/dist-packages/

The "import mlpy" was successful after this move.

-Will

hibernado

unread,
Jun 26, 2014, 9:07:02 AM6/26/14
to mlpy-g...@googlegroups.com
I also had the same problem: 

This may help others who are new to python. 

1. I installed GSL 
 I was able to install it with the simple command homebrew install gsl
 You can also use macports or install from source  http://www.gnu.org/software/gsl/ ( see readme and install files ) 

2. I tested GSL 

Create a file call gsltest.c and paste this into it: 
#include <stdio.h>
#include <gsl/gsl_sf_bessel.h>
int
main (void)
{
  double x = 5.0;
  double y = gsl_sf_bessel_J0 (x);
  printf ("J0(%g) = %.18e\n", x, y);
  return 0;
}
Then I ran 
gcc -Wall -c gsltest.c
gcc gsltest.o -lgsl -lgslcblas -lm
./a.out

You should get something like  J0(5) = -1.775967713143382920e-01 returned. 

3. Download and install mlpy
 This is where most of us seem to have had problems. As I'm relatively inexperienced at compiling from scratch I don't like manually editing files as suggested by Yotam. Any time I have tried this I wasted ages and it didn't work. 

The instructions on installing mlpy presume that you have some knowledge of how to compile from scratch. This confused me as the commands are given out of order. 
The part "python setup.py build_ext --include-dirs=/path/to/header --rpath=/path/to/lib" means that you need explain where your blasted GSL installation is ! 
easiest way to find this is to run : 
sudo find / -type f -name "*gsl*"

You will see a folder with lots of .h files fill this path into /path/to/header
The folder with libgsl.a is the /path/to/lib folder 

I ran python setup.pyt build_ext with both these folders. 

Next I ran which python to find where my particular python install was. 
for me i get /Users/USERNAME/venv/base/bin/python
the path I needed is this but with the bin removed --> 

So i ran python setup.py install --prefix=/Users/USERNAME/venv/base

lastly the instructions explain that you need to tell python where to look for this package in order to use it. 
It suggests export PYTHONPATH=$PYTHONPATH:/path/to/modules/lib/python{version}/site-packages
so for me this would be export PYTHONPATH=$PYTHONPATH:/Users/USERNAME/venv/base/lib/python2.7/site-packages

It didn't work. gls is in a folder called mlpy within the site-packages folder. so I actually needed 
PYTHONPATH=$PYTHONPATH:/Users/USERNAME/venv/base/lib/python2.7/site-packages/mlpy. 

It worked . black cloud. 
Reply all
Reply to author
Forward
0 new messages