Numba: "RuntimeError: missing Environment" with #2405 when printing inside a inner function

Created on 15 Jun 2017  路  2Comments  路  Source: numba/numba

This affects #2405.

Example: chkprint.py

import numpy as np
from numba import njit


@njit
def foo(arr):
    print("In foo")
    print(arr)
    print("Out foo")


@njit
def bar(arr):
    print("In bar")
    foo(arr)
    print("Out bar")


arr = np.arange(10)

print("Call foo")
foo(arr)
print("Call bar")
bar(arr)

Output:

Call foo
In foo
[0 1 2 3 4 5 6 7 8 9]
Out foo
Call bar
In bar
In foo
Traceback (most recent call last):
  File "chkprint.py", line 24, in <module>
    bar(arr)
RuntimeError: missing Environment

Most helpful comment

Hello, I am wondering when will this be fixed? print is a useful function even for numba.

All 2 comments

Seems like the environment pointer is not passed properly across nopython functions.

Hello, I am wondering when will this be fixed? print is a useful function even for numba.

Was this page helpful?
0 / 5 - 0 ratings