Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have Ubuntu 10.10 server on EC2. I installed Python 3.1, and now I want to install NumPy on it. How do I do it? I tried easy_install-3.1 numpy but got this error:

RefactoringTool: Refactored /tmp/easy_install-MiUli2/numpy-1.5.1/build/py3k/numpy/core/
RefactoringTool: Files that were modified:
RefactoringTool: /tmp/easy_install-MiUli2/numpy-1.5.1/build/py3k/numpy/compat/
RefactoringTool: /tmp/easy_install-MiUli2/numpy-1.5.1/build/py3k/numpy/core/
Running from numpy source directory.Traceback (most recent call last):
  File "/usr/local/bin/easy_install-3.1", line 9, in <module>
    load_entry_point('distribute==0.6.14', 'console_scripts', 'easy_install-3.1')()
  File "/usr/local/lib/python3.1/dist-packages/distribute-0.6.14-py3.1.egg/setuptools/command/", line 1855, in main
  File "/usr/local/lib/python3.1/dist-packages/distribute-0.6.14-py3.1.egg/setuptools/command/", line 1836, in with_ei_usage
    return f()
  File "/usr/local/lib/python3.1/dist-packages/distribute-0.6.14-py3.1.egg/setuptools/command/", line 1859, in <lambda>
    distclass=DistributionWithoutHelpCommands, **kw
  File "/usr/lib/python3.1/distutils/", line 149, in setup
  File "/usr/lib/python3.1/distutils/", line 919, in run_commands
  File "/usr/lib/python3.1/distutils/", line 938, in run_command
  File "/usr/local/lib/python3.1/dist-packages/distribute-0.6.14-py3.1.egg/setuptools/command/", line 342, in run
    self.easy_install(spec, not self.no_deps)
  File "/usr/local/lib/python3.1/dist-packages/distribute-0.6.14-py3.1.egg/setuptools/command/", line 582, in easy_install
    return self.install_item(spec, dist.location, tmpdir, deps)
  File "/usr/local/lib/python3.1/dist-packages/distribute-0.6.14-py3.1.egg/setuptools/command/", line 612, in install_item
    dists = self.install_eggs(spec, download, tmpdir)
  File "/usr/local/lib/python3.1/dist-packages/distribute-0.6.14-py3.1.egg/setuptools/command/", line 802, in install_eggs
    return self.build_and_install(setup_script, setup_base)
  File "/usr/local/lib/python3.1/dist-packages/distribute-0.6.14-py3.1.egg/setuptools/command/", line 1079, in build_and_install
    self.run_setup(setup_script, setup_base, args)
  File "/usr/local/lib/python3.1/dist-packages/distribute-0.6.14-py3.1.egg/setuptools/command/", line 1068, in run_setup
    run_setup(setup_script, args)
  File "/usr/local/lib/python3.1/dist-packages/distribute-0.6.14-py3.1.egg/setuptools/", line 30, in run_setup
    lambda: exec(compile(open(
  File "/usr/local/lib/python3.1/dist-packages/distribute-0.6.14-py3.1.egg/setuptools/", line 71, in run
    return func()
  File "/usr/local/lib/python3.1/dist-packages/distribute-0.6.14-py3.1.egg/setuptools/", line 33, in <lambda>
    {'__file__':setup_script, '__name__':'__main__'})
  File "", line 211, in <module>
  File "", line 204, in setup_package
  File "/tmp/easy_install-MiUli2/numpy-1.5.1/build/py3k/numpy/distutils/", line 152, in setup
  File "", line 151, in configuration
  File "/tmp/easy_install-MiUli2/numpy-1.5.1/build/py3k/numpy/distutils/", line 972, in add_subpackage
  File "/tmp/easy_install-MiUli2/numpy-1.5.1/build/py3k/numpy/distutils/", line 941, in get_subpackage
  File "/tmp/easy_install-MiUli2/numpy-1.5.1/build/py3k/numpy/distutils/", line 878, in _get_configuration_from_setup_py
  File "numpy/", line 5, in configuration
  File "/tmp/easy_install-MiUli2/numpy-1.5.1/build/py3k/numpy/distutils/", line 713, in __init__
ValueError: 'build/py3k/numpy' is not a directory
share|improve this question
up vote 4 down vote accepted

The code from this branch of numpy appears to include a fix.
Here's a snippet and the relevant comments :

643         # XXX Hack to get numpy installable with easy_install.
644         # The problem is easy_install runs it's own setup(), which
645         # sets up distutils.core._setup_distribution. However,
646         # when our setup() runs, that gets overwritten and lost.
647         # We can't use isinstance, as the DistributionWithoutHelpCommands
648         # class is local to a function in setuptools.command.easy_install
649         if dist is not None and \
650                 repr(dist).find('DistributionWithoutHelpCommands') != -1:
651             return None
652         return dist

However, if you don't want to do that, try python3.1 install inside the directory where you extracted numpy. That avoids the easy_install issue described in the code comments.

share|improve this answer
I just downloaded the official release of 1.6.1, it installs for python 3.2 via, no problem. – hwjp Dec 1 '11 at 18:00

Try this command to install numpy

sudo apt-get install python-numpy
share|improve this answer
that wouldn't install it for Python 3 would it? – hwjp Dec 1 '11 at 17:44

Because NumPy is not availible for Python 3.x, like many other libraries

share|improve this answer
But that version does support Python 3.x. – Tshepang Jan 24 '11 at 10:30

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.