[Numpy-discussion] AttributeError in numpy.distutils
Ralf Gommers
ralf.gommers at googlemail.com
Sun May 29 14:19:54 EDT 2011
On Sun, May 22, 2011 at 8:14 PM, Branimir Sesar <bsesar at astro.caltech.edu>wrote:
> On 05/22/2011 04:17 AM, Ralf Gommers wrote:
> >
> >
> > On Thu, May 19, 2011 at 8:28 PM, Branimir Sesar
> > <bsesar at astro.caltech.edu <mailto:bsesar at astro.caltech.edu>> wrote:
> >
> > Dear Numpy users,
> >
> > I've encountered an AttributeError in numpy.distutils
> >
> > File
> >
> "/home/bsesar/usr/pydebug/lib/python2.7/site-packages/numpy/distutils/command/build_src.py",
> > line 646, in swig_sources
> > extension.swig_opts.remove('-c++')
> > AttributeError: 'str' object has no attribute 'remove'
> >
> > while compiling some code with Python 2.7.1 and Numpy 1.6.0.
> >
> >
> > What are you doing here, compiling numpy? Building some of your own
> > swig-ed code? Please give the details needed to reproduce your issue.
>
> I've been trying to compile Scikits ANN
> (http://projects.scipy.org/scikits/wiki/AnnWrapper) with Python 2.7.1,
> numpy 1.6.0, and SWIG 2.0.3 but the compilation breaks down down with
> the error given below. Previously, I was able to compile Scikits ANN
> using Enthought Python Distribution 7.0.2 (Python 2.7.1, numpy 1.5.1,
> swig 1.3.40).
>
> running install
> running bdist_egg
> running egg_info
> running build_src
> build_src
> building extension "scikits.ann._ANN" sources
> Traceback (most recent call last):
> File "setup.py", line 139, in <module>
> test_suite = 'nose.collector',
> File
>
> "/home/bsesar/usr/pydebug/lib/python2.7/site-packages/numpy/distutils/core.py",
>
> line 186, in setup
> return old_setup(**new_attr)
> File "/home/bsesar/usr/pydebug/lib/python2.7/distutils/core.py", line
> 152, in setup
> dist.run_commands()
> File "/home/bsesar/usr/pydebug/lib/python2.7/distutils/dist.py", line
> 953, in run_commands
> self.run_command(cmd)
> File "/home/bsesar/usr/pydebug/lib/python2.7/distutils/dist.py", line
> 972, in run_command
> cmd_obj.run()
> File
>
> "/home/bsesar/usr/pydebug/lib/python2.7/site-packages/numpy/distutils/command/install.py",
>
> line 57, in run
> r = self.setuptools_run()
> File
>
> "/home/bsesar/usr/pydebug/lib/python2.7/site-packages/numpy/distutils/command/install.py",
>
> line 51, in setuptools_run
> self.do_egg_install()
> File "build/bdist.linux-x86_64/egg/setuptools/command/install.py",
> line 96, in do_egg_install
> File "/home/bsesar/usr/pydebug/lib/python2.7/distutils/cmd.py", line
> 326, in run_command
> self.distribution.run_command(command)
> File "/home/bsesar/usr/pydebug/lib/python2.7/distutils/dist.py", line
> 972, in run_command
> cmd_obj.run()
> File "build/bdist.linux-x86_64/egg/setuptools/command/bdist_egg.py",
> line 167, in run
> File "/home/bsesar/usr/pydebug/lib/python2.7/distutils/cmd.py", line
> 326, in run_command
> self.distribution.run_command(command)
> File "/home/bsesar/usr/pydebug/lib/python2.7/distutils/dist.py", line
> 972, in run_command
> cmd_obj.run()
> File
>
> "/home/bsesar/usr/pydebug/lib/python2.7/site-packages/numpy/distutils/command/egg_info.py",
>
> line 8, in run
> self.run_command("build_src")
> File "/home/bsesar/usr/pydebug/lib/python2.7/distutils/cmd.py", line
> 326, in run_command
> self.distribution.run_command(command)
> File "/home/bsesar/usr/pydebug/lib/python2.7/distutils/dist.py", line
> 972, in run_command
> cmd_obj.run()
> File
>
> "/home/bsesar/usr/pydebug/lib/python2.7/site-packages/numpy/distutils/command/build_src.py",
>
> line 152, in run
> self.build_sources()
> File
>
> "/home/bsesar/usr/pydebug/lib/python2.7/site-packages/numpy/distutils/command/build_src.py",
>
> line 169, in build_sources
> self.build_extension_sources(ext)
> File
>
> "/home/bsesar/usr/pydebug/lib/python2.7/site-packages/numpy/distutils/command/build_src.py",
>
> line 332, in build_extension_sources
> sources = self.swig_sources(sources, ext)
> File
>
> "/home/bsesar/usr/pydebug/lib/python2.7/site-packages/numpy/distutils/command/build_src.py",
>
> line 646, in swig_sources
> extension.swig_opts.remove('-c++')
> AttributeError: 'str' object has no attribute 'remove'
>
> Looks like this is a bug introduced in numpy 1.6.0 by commit ff0822c4.
Right above this line (numpy/distutils/command/build_src.py, line 646) add
this:
if isinstance(extension.swig_opts, basestring):
extension.swig_opts = extension.swig_opts.split()
Then you should be able to compile scikits.ann.
Cheers,
Ralf
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20110529/6932da3a/attachment.html>
More information about the NumPy-Discussion
mailing list