On Jul 9, 2010, at 8:23 AM, Sebastian Walter wrote:

Hello,
I've managed to install nlopt-2.1.2 with Python bindings
However, there have been some issues.
I'm using Linux (Ubuntu), Python 2.6

The shell command I ran successfully is:
b45...@shlp:/tmp/nlopt-2.1.2$ ./configure
--prefix=/home/b45ch1/workspace/tmp/nlopt-2.1.2 --enable-shared
Python=python && make && sudo make install

Note that Python=python does nothing. It is case-sensitive, so you need PYTHON=python (which also does nothing, since "python" is the default).

1) for some reason I needed root access:
if I run simply

$ make install

I get the error:

Hmm, I can't reproduce (Debian, Python 2.5.2); it works fine for me without sudo. Are you sure you didn't mess up the permissions for your install directory or something, perhaps from a previous "sudo make install"?

(If you also install Octave and Matlab plugins, you have to supply their installation directories manually to install under your home directories, by setting OCT_INSTALL_DIR and MEX_INSTALL_DIR on the configure command line. I just noticed that I forgot to do this for the Guile plugin; the next NLopt release will include a GUILE_INSTALL_DIR to manually override the Guile plugin installation directory, but for now you may need to suppress the compilation of the Guile plugin with the --without-guile option. Anyway, it looks like these are not affecting you, probably because you don't have the necessary packages installed to compile Octave and Guile plugins on your system.)

2) Another issue is that the files are written to
lib/python2.6/site-packages

However, on my ubuntu machine I only have
/usr/lib/python2.6/dist-packages

i.e. there is no site-packages, which results in an error when installing with
./configure --enable-shared Python=python && make && install

I'm using the automake support for Python installation; this looks like a bug in that, I'll look into it and submit a bug report if needed.

(Python distutils had a similar problem on Ubuntu last year: 
https://bugs.launchpad.net/ubuntu/+source/python2.6/+bug/362570)


3) I think it would be nice if you could make a package

nlopt/
  __init__.py
  nlopt.py
  _nlopt.so

or similar. At the moment, the site-packages gets cluttered with many files b45...@shlp:~/workspace/tmp/nlopt-2.1.2/lib/python2.6/site-packages$ ls
_nlopt.a   nlopt.py   nlopt.pyo  _nlopt.so.0
_nlopt.la  nlopt.pyc  _nlopt.so  _nlopt.so.0.4.2

I'm loath to mess with the default automake installation by trying to force it to install in a subdirectory. In any case, a bit of file clutter in a directory that users almost never see doesn't seem like a big problem to me.

4) It would be nice if nlopt.py had a docstring that gives a simple
example that helps you get started:

In [7]: import nlopt
In [8]: nlopt?

This would be nice, I agree. I'll look into how this can be done within SWIG (which generates the NLopt Python wrappers).

At the very least, the docstring could give the URL of the web site and the manual.

Steven


_______________________________________________
NLopt-discuss mailing list
[email protected]
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/nlopt-discuss

Reply via email to