Numba: LoweringError: Failed at object (object mode frontend)

Created on 4 Jul 2018  路  3Comments  路  Source: numba/numba

I encounter an error when running code that is annotated with @numba.jit.

numba.errors.LoweringError: Failed at object (object mode frontend)
Failed at object (object mode backend)

Minimal working reproducer (code and error/stacktrace)

I am not using the latest Numba but instead version 0.38.1. Below is the output from conda on a Windows laptop PC from a Cygwin64 shell terminal:

$ conda list numba
# packages in environment at C:\home\miniconda3:
#
# Name                    Version                   Build  Channel
numba                     0.38.1           py36h830ac7b_0

Please advise if there's a way to boost my Numba version without goobering up my Anaconda installation (I'm not very adept with that, easy to shoot myself in the foot if not careful), if so I am happy to try again once the version has been updated in case this has already been fixed in a later release.

Thanks in advance for any help with this issue.

bug

Most helpful comment

Also as a temporary fix, I was able to resolve that error by pre-declaring variables made in my for loop.

ex:

acc = 0
for i in range(100):
    b, c = i*10, i*20
    acc = acc + b + c

becomes

acc = 0
b = 0
c = 0
for i in range(100):
    b, c = i*10, i*20
    acc = acc + b + c

All 3 comments

Thanks for the report. This is unfortunately a known bug and another case of failure in the liveness analysis (it is hoped that some of these will be addressed in the 0.40 release cycle). Taking a quick look at your code, it seems to be largely numerical, you'll therefore get much better performance if you can write it so that it works with the numba.jit(nopython=True) decorator. This page in the documentation may help in understanding how to get good performance from Numba http://numba.pydata.org/numba-doc/latest/user/performance-tips.html.

As to upgrading Numba. It seems like you are using the root environment in your Miniconda installation? In general, it is more typical to create environments that contain a collection of packages for a specific use case, more info here: https://conda.io/docs/user-guide/tasks/manage-environments.html.

If you want to use the latest Numba built from the master branch on github then you can create an environment named e.g. numba_latest and obtain packages from the numba channel on anaconda.org like this:

conda create -n numba_latest -c numba numba

and also specify a specific version there if needed (like numba=0.39.0rc1, the latest release candidate for 0.39.0).

Also as a temporary fix, I was able to resolve that error by pre-declaring variables made in my for loop.

ex:

acc = 0
for i in range(100):
    b, c = i*10, i*20
    acc = acc + b + c

becomes

acc = 0
b = 0
c = 0
for i in range(100):
    b, c = i*10, i*20
    acc = acc + b + c

Closed by #3230.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sebma picture sebma  路  4Comments

hameerabbasi picture hameerabbasi  路  3Comments

smjure picture smjure  路  3Comments

elfnor picture elfnor  路  4Comments

sahaskn picture sahaskn  路  4Comments