Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing numba for python

I am trying to install numba for python but after following the instruction from the homepage I got this error that the extension_types page can not be found.

I would very appreciate if someone knows what I am doing wrong or if I missed something that I should install.

Thank you very much in advance.

Python 2.7.2+ (default, Jul 20 2012, 22:15:08) 
Type "copyright", "credits" or "license" for more information.

IPython 0.10.2 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object'. ?object also works, ?? prints more.

In [1]: import numba
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)

/home/mijc/Downloads/numba/<ipython console> in <module>()

/home/mijc/Downloads/numba/numba/__init__.py in <module>()
      2 # type inferer

      3 from numba.special import *
----> 4 from numba import module_type_inference
      5 
      6 import os

/home/mijc/Downloads/numba/numba/module_type_inference.py in <module>()
      6 from numba import *
      7 from numba.minivect import minitypes
----> 8 from numba import typesystem, symtab
      9 
     10 import numpy.random

/home/mijc/Downloads/numba/numba/typesystem/__init__.py in <module>()
      2 from exttypes import *
      3 from closuretypes import *
      4 from ssatypes import *
      5 from templatetypes import *
      6 from typemapper import *

/home/mijc/Downloads/numba/numba/typesystem/basetypes.py in <module>()
      6 
      7 import numba
----> 8 from numba import  extension_types, error
      9 from numba.minivect.minitypes import *
     10 from numba.minivect.minitypes import map_dtype

ImportError: cannot import name extension_types

EDIT: I installed numba via:

git clone https://github.com/numba/numba.git
cd numba
python setup.py install

When I try to install it via pip, I get the following error:

pip install numba --upgrade
Downloading/unpacking numba
  Downloading numba-0.5.0.tar.gz (333Kb): 333Kb downloaded
  Running setup.py egg_info for package numba
    Traceback (most recent call last):
      File "<string>", line 14, in <module>
      File "/home/mijc/Downloads/numba/build/numba/setup.py", line 90, in <module>
        cython_gdb=True),
      File "/usr/local/lib/python2.7/dist-packages/Cython/Distutils/extension.py", line 108, in __init__
        **kw)
    TypeError: unbound method __init__() must be called with Extension instance as first argument (got Extension instance instead)
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

  File "<string>", line 14, in <module>

  File "/home/mijc/Downloads/numba/build/numba/setup.py", line 90, in <module>

    cython_gdb=True),

  File "/usr/local/lib/python2.7/dist-packages/Cython/Distutils/extension.py", line 108, in __init__

    **kw)

TypeError: unbound method __init__() must be called with Extension instance as first argument (got Extension instance instead)

----------------------------------------
Command python setup.py egg_info failed with error code 1
like image 481
mijc Avatar asked Jan 29 '13 14:01

mijc


People also ask

How do I install Python Numba?

The easiest way to install Numba and get updates is by using conda , a cross-platform package manager and software distribution maintained by Anaconda, Inc. You can either use Anaconda to get the full stack in one download, or Miniconda which will install the minimum packages required for a conda environment.

What is Numba package in Python?

Numba is an open source JIT compiler that translates a subset of Python and NumPy code into fast machine code.

Is Numba part of Anaconda?

Numba is part of the Anaconda Python distribution. If Number is not already installed, you can install it manually using the command below.


2 Answers

I hope you are on Linux and you have pip installed. On my Debian Linux, I can easily install numba by following commands:

sudo apt-get install build-essential
sudo apt-get install llvm
pip install llvmpy
pip install cython
pip install numba

Then you are done!

like image 76
Suman Khanal Avatar answered Sep 26 '22 06:09

Suman Khanal


I had the same issue and for me the solution was upgrading distribute to 0.6.45.

like image 41
kichik Avatar answered Sep 23 '22 06:09

kichik