Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed in nopython mode pipeline in Windows Jupyter Notebook #12

Closed
MatthewBelzer opened this issue Jun 4, 2020 · 3 comments
Closed

Comments

@MatthewBelzer
Copy link

I am using Jupyter Notebook on Windows 10 and when I try to run this code

import pde

grid = pde.UnitGrid([64, 64])                 # generate grid
state = pde.ScalarField.random_uniform(grid)  # generate initial condition

eq = pde.DiffusionPDE(diffusivity=0.1)        # define the pde
result = eq.solve(state, t_range=10)          # solve the pde
result.plot()                                 # plot the resulting field

it gives me the following error message. If you can help me I would really appreciate it.

TypingError Traceback (most recent call last)
in
5
6 eq = pde.DiffusionPDE(diffusivity=0.1) # define the pde
----> 7 result = eq.solve(state, t_range=10) # solve the pde
8 result.plot() # plot the resulting field

~\Anaconda3\lib\site-packages\pde\pdes\base.py in solve(self, state, t_range, dt, tracker, method, ret_info, **kwargs)
312
313 # run the simulation
--> 314 final_state = controller.run(state, dt)
315
316 if ret_info:

~\Anaconda3\lib\site-packages\pde\solvers\controller.py in run(self, state, dt)
142
143 # initialize the stepper
--> 144 stepper = self.solver.make_stepper(state=state, dt=dt)
145
146 # initialize profiling information

~\Anaconda3\lib\site-packages\pde\solvers\scipy.py in make_stepper(self, state, dt)
67 # obtain function for evaluating the right hand side
68 rhs = self._make_pde_rhs(state, backend=self.backend,
---> 69 allow_stochastic=False)
70
71 def rhs_helper(t, state_flat):

~\Anaconda3\lib\site-packages\pde\solvers\base.py in _make_pde_rhs(self, state, backend, allow_stochastic)
123 rhs = self.pde.make_sde_rhs(state, backend=backend)
124 else:
--> 125 rhs = self.pde.make_pde_rhs(state, backend=backend)
126
127 if hasattr(rhs, '_backend'):

~\Anaconda3\lib\site-packages\pde\pdes\base.py in make_pde_rhs(self, state, backend)
86 if backend == 'auto':
87 try:
---> 88 rhs = self._make_pde_rhs_numba(state)
89 except NotImplementedError:
90 backend = 'numpy'

~\Anaconda3\lib\site-packages\pde\pdes\diffusion.py in _make_pde_rhs_numba(self, state)
93
94 @jit(signature)
---> 95 def pde_rhs(state_data: np.ndarray, t: float):
96 """ compiled helper function evaluating right hand side """
97 return diffusivity_value * laplace(state_data)

~\Anaconda3\lib\site-packages\pde\tools\misc.py in (realf)
162 else:
163 # decorator arguments
--> 164 return lambda realf: decorator(realf, *args, **kwargs)
165
166 return new_decorator

~\Anaconda3\lib\site-packages\pde\tools\numba.py in jit(function, signature, parallel, **kwargs)
156 logging.getLogger(name).info('Compile %s with parallel=%s',
157 name, jit_kwargs['parallel'])
--> 158 return nb.jit(signature, **jit_kwargs)(function) # type: ignore
159
160

~\Anaconda3\lib\site-packages\numba\decorators.py in wrapper(func)
184 with typeinfer.register_dispatcher(disp):
185 for sig in sigs:
--> 186 disp.compile(sig)
187 disp.disable_compile()
188 return disp

~\Anaconda3\lib\site-packages\numba\compiler_lock.py in _acquire_compile_lock(*args, **kwargs)
30 def _acquire_compile_lock(*args, **kwargs):
31 with self:
---> 32 return func(*args, **kwargs)
33 return _acquire_compile_lock
34

~\Anaconda3\lib\site-packages\numba\dispatcher.py in compile(self, sig)
691
692 self._cache_misses[sig] += 1
--> 693 cres = self._compiler.compile(args, return_type)
694 self.add_overload(cres)
695 self._cache.save_overload(sig, cres)

~\Anaconda3\lib\site-packages\numba\dispatcher.py in compile(self, args, return_type)
78 return retval
79 else:
---> 80 raise retval
81
82 def _compile_cached(self, args, return_type):

~\Anaconda3\lib\site-packages\numba\dispatcher.py in _compile_cached(self, args, return_type)
88
89 try:
---> 90 retval = self._compile_core(args, return_type)
91 except errors.TypingError as e:
92 self._failed_cache[key] = e

~\Anaconda3\lib\site-packages\numba\dispatcher.py in _compile_core(self, args, return_type)
106 args=args, return_type=return_type,
107 flags=flags, locals=self.locals,
--> 108 pipeline_class=self.pipeline_class)
109 # Check typing error if object mode is used
110 if cres.typing_error is not None and not flags.enable_pyobject:

~\Anaconda3\lib\site-packages\numba\compiler.py in compile_extra(typingctx, targetctx, func, args, return_type, flags, locals, library, pipeline_class)
970 pipeline = pipeline_class(typingctx, targetctx, library,
971 args, return_type, flags, locals)
--> 972 return pipeline.compile_extra(func)
973
974

~\Anaconda3\lib\site-packages\numba\compiler.py in compile_extra(self, func)
388 self.lifted = ()
389 self.lifted_from = None
--> 390 return self._compile_bytecode()
391
392 def compile_ir(self, func_ir, lifted=(), lifted_from=None):

~\Anaconda3\lib\site-packages\numba\compiler.py in _compile_bytecode(self)
901 """
902 assert self.func_ir is None
--> 903 return self._compile_core()
904
905 def _compile_ir(self):

~\Anaconda3\lib\site-packages\numba\compiler.py in _compile_core(self)
888 self.define_pipelines(pm)
889 pm.finalize()
--> 890 res = pm.run(self.status)
891 if res is not None:
892 # Early pipeline completion

~\Anaconda3\lib\site-packages\numba\compiler_lock.py in _acquire_compile_lock(*args, **kwargs)
30 def _acquire_compile_lock(*args, **kwargs):
31 with self:
---> 32 return func(*args, **kwargs)
33 return _acquire_compile_lock
34

~\Anaconda3\lib\site-packages\numba\compiler.py in run(self, status)
264 # No more fallback pipelines?
265 if is_final_pipeline:
--> 266 raise patched_exception
267 # Go to next fallback pipeline
268 else:

~\Anaconda3\lib\site-packages\numba\compiler.py in run(self, status)
255 try:
256 event("-- %s" % stage_name)
--> 257 stage()
258 except _EarlyPipelineCompletion as e:
259 return e.result

~\Anaconda3\lib\site-packages\numba\compiler.py in stage_nopython_frontend(self)
513 self.args,
514 self.return_type,
--> 515 self.locals)
516 self.typemap = typemap
517 self.return_type = return_type

~\Anaconda3\lib\site-packages\numba\compiler.py in type_inference_stage(typingctx, interp, args, return_type, locals)
1122
1123 infer.build_constraint()
-> 1124 infer.propagate()
1125 typemap, restype, calltypes = infer.unify()
1126

~\Anaconda3\lib\site-packages\numba\typeinfer.py in propagate(self, raise_errors)
925 if errors:
926 if raise_errors:
--> 927 raise errors[0]
928 else:
929 return errors

TypingError: Failed in nopython mode pipeline (step: nopython frontend)
Failed in nopython mode pipeline (step: nopython frontend)
Invalid use of Function(<function _make_laplace_numba_2d..laplace at 0x00000208DBD26708>) with argument(s) of type(s): (array(float64, 2d, C), out=array(float64, 2d, C))

  • parameterized
    In definition 0:
    TypingError: Failed in nopython mode pipeline (step: nopython frontend)
    Invalid use of Function(<function BoundaryPair.make_region_evaluator..region_evaluator at 0x00000208DBD0E438>) with argument(s) of type(s): (array(float64, 2d, C), tuple(int64 x 2))
  • parameterized
    In definition 0:
    TypingError: Failed in nopython mode pipeline (step: nopython frontend)
    Invalid use of Function(<function BCBase1stOrder.make_adjacent_evaluator..adjacent_point at 0x00000208DBD0E828>) with argument(s) of type(s): (array(float64, 1d, A), int64, (..., int64))
  • parameterized
    In definition 0:
    KeyError: "<class 'numba.targets.cpu.CPUTargetOptions'> does not support option: 'inline'"
    raised from C:\Users\matth\Anaconda3\lib\site-packages\numba\targets\options.py:20
    In definition 1:
    KeyError: "<class 'numba.targets.cpu.CPUTargetOptions'> does not support option: 'inline'"
    raised from C:\Users\matth\Anaconda3\lib\site-packages\numba\targets\options.py:20
    This error is usually caused by passing an argument of a type that is unsupported by the named function.
    [1] During: resolving callee type: Function(<function BCBase1stOrder.make_adjacent_evaluator..adjacent_point at 0x00000208DBD0E828>)
    [2] During: typing of call at C:\Users\matth\Anaconda3\lib\site-packages\pde\grids\boundaries\axis.py (379)

File "..\Anaconda3\lib\site-packages\pde\grids\boundaries\axis.py", line 379:
def region_evaluator(arr, idx: Tuple[int, ...])

arr_1d, i_point, bc_idx = get_arr_1d(arr, idx)
return (ap_low(arr_1d, i_point, bc_idx),
^

raised from C:\Users\matth\Anaconda3\lib\site-packages\numba\typeinfer.py:927

In definition 1:
TypingError: Failed in nopython mode pipeline (step: nopython frontend)
Invalid use of Function(<function BCBase1stOrder.make_adjacent_evaluator..adjacent_point at 0x00000208DBD0E828>) with argument(s) of type(s): (array(float64, 1d, A), int64, (..., int64))

  • parameterized
    In definition 0:
    KeyError: "<class 'numba.targets.cpu.CPUTargetOptions'> does not support option: 'inline'"
    raised from C:\Users\matth\Anaconda3\lib\site-packages\numba\targets\options.py:20
    In definition 1:
    KeyError: "<class 'numba.targets.cpu.CPUTargetOptions'> does not support option: 'inline'"
    raised from C:\Users\matth\Anaconda3\lib\site-packages\numba\targets\options.py:20
    This error is usually caused by passing an argument of a type that is unsupported by the named function.
    [1] During: resolving callee type: Function(<function BCBase1stOrder.make_adjacent_evaluator..adjacent_point at 0x00000208DBD0E828>)
    [2] During: typing of call at C:\Users\matth\Anaconda3\lib\site-packages\pde\grids\boundaries\axis.py (379)

File "..\Anaconda3\lib\site-packages\pde\grids\boundaries\axis.py", line 379:
def region_evaluator(arr, idx: Tuple[int, ...])

arr_1d, i_point, bc_idx = get_arr_1d(arr, idx)
return (ap_low(arr_1d, i_point, bc_idx),
^

raised from C:\Users\matth\Anaconda3\lib\site-packages\numba\typeinfer.py:927

This error is usually caused by passing an argument of a type that is unsupported by the named function.
[1] During: resolving callee type: Function(<function BoundaryPair.make_region_evaluator..region_evaluator at 0x00000208DBD0E438>)
[2] During: typing of call at C:\Users\matth\Anaconda3\lib\site-packages\pde\grids\operators\cartesian.py (351)

File "..\Anaconda3\lib\site-packages\pde\grids\operators\cartesian.py", line 351:
def laplace(arr, out=None):

j = 0
arr_x_l, arr_c, arr_x_h = region_x(arr, (i, j))
^

raised from C:\Users\matth\Anaconda3\lib\site-packages\numba\typeinfer.py:927

In definition 1:
TypingError: Failed in nopython mode pipeline (step: nopython frontend)
Invalid use of Function(<function BoundaryPair.make_region_evaluator..region_evaluator at 0x00000208DBD0E438>) with argument(s) of type(s): (array(float64, 2d, C), tuple(int64 x 2))

  • parameterized
    In definition 0:
    TypingError: Failed in nopython mode pipeline (step: nopython frontend)
    Invalid use of Function(<function BCBase1stOrder.make_adjacent_evaluator..adjacent_point at 0x00000208DBD0E828>) with argument(s) of type(s): (array(float64, 1d, A), int64, (..., int64))
  • parameterized
    In definition 0:
    KeyError: "<class 'numba.targets.cpu.CPUTargetOptions'> does not support option: 'inline'"
    raised from C:\Users\matth\Anaconda3\lib\site-packages\numba\targets\options.py:20
    In definition 1:
    KeyError: "<class 'numba.targets.cpu.CPUTargetOptions'> does not support option: 'inline'"
    raised from C:\Users\matth\Anaconda3\lib\site-packages\numba\targets\options.py:20
    This error is usually caused by passing an argument of a type that is unsupported by the named function.
    [1] During: resolving callee type: Function(<function BCBase1stOrder.make_adjacent_evaluator..adjacent_point at 0x00000208DBD0E828>)
    [2] During: typing of call at C:\Users\matth\Anaconda3\lib\site-packages\pde\grids\boundaries\axis.py (379)

File "..\Anaconda3\lib\site-packages\pde\grids\boundaries\axis.py", line 379:
def region_evaluator(arr, idx: Tuple[int, ...])

arr_1d, i_point, bc_idx = get_arr_1d(arr, idx)
return (ap_low(arr_1d, i_point, bc_idx),
^

raised from C:\Users\matth\Anaconda3\lib\site-packages\numba\typeinfer.py:927

In definition 1:
TypingError: Failed in nopython mode pipeline (step: nopython frontend)
Invalid use of Function(<function BCBase1stOrder.make_adjacent_evaluator..adjacent_point at 0x00000208DBD0E828>) with argument(s) of type(s): (array(float64, 1d, A), int64, (..., int64))

  • parameterized
    In definition 0:
    KeyError: "<class 'numba.targets.cpu.CPUTargetOptions'> does not support option: 'inline'"
    raised from C:\Users\matth\Anaconda3\lib\site-packages\numba\targets\options.py:20
    In definition 1:
    KeyError: "<class 'numba.targets.cpu.CPUTargetOptions'> does not support option: 'inline'"
    raised from C:\Users\matth\Anaconda3\lib\site-packages\numba\targets\options.py:20
    This error is usually caused by passing an argument of a type that is unsupported by the named function.
    [1] During: resolving callee type: Function(<function BCBase1stOrder.make_adjacent_evaluator..adjacent_point at 0x00000208DBD0E828>)
    [2] During: typing of call at C:\Users\matth\Anaconda3\lib\site-packages\pde\grids\boundaries\axis.py (379)

File "..\Anaconda3\lib\site-packages\pde\grids\boundaries\axis.py", line 379:
def region_evaluator(arr, idx: Tuple[int, ...])

arr_1d, i_point, bc_idx = get_arr_1d(arr, idx)
return (ap_low(arr_1d, i_point, bc_idx),
^

raised from C:\Users\matth\Anaconda3\lib\site-packages\numba\typeinfer.py:927

This error is usually caused by passing an argument of a type that is unsupported by the named function.
[1] During: resolving callee type: Function(<function BoundaryPair.make_region_evaluator..region_evaluator at 0x00000208DBD0E438>)
[2] During: typing of call at C:\Users\matth\Anaconda3\lib\site-packages\pde\grids\operators\cartesian.py (351)

File "..\Anaconda3\lib\site-packages\pde\grids\operators\cartesian.py", line 351:
def laplace(arr, out=None):

j = 0
arr_x_l, arr_c, arr_x_h = region_x(arr, (i, j))
^

raised from C:\Users\matth\Anaconda3\lib\site-packages\numba\typeinfer.py:927

This error is usually caused by passing an argument of a type that is unsupported by the named function.
[1] During: resolving callee type: Function(<function _make_laplace_numba_2d..laplace at 0x00000208DBD26708>)
[2] During: typing of call at C:\Users\matth\Anaconda3\lib\site-packages\pde\tools\numba.py (259)

File "..\Anaconda3\lib\site-packages\pde\tools\numba.py", line 259:
def f_with_allocated_out(arr, out):

""" helper function allocating output array """
return f_jit(arr, out=np.empty_like(arr))
^

[1] During: resolving callee type: type(CPUDispatcher(<function _make_laplace_numba_2d..laplace at 0x00000208DBD268B8>))
[2] During: typing of call at C:\Users\matth\Anaconda3\lib\site-packages\pde\pdes\diffusion.py (97)

[3] During: resolving callee type: type(CPUDispatcher(<function _make_laplace_numba_2d..laplace at 0x00000208DBD268B8>))
[4] During: typing of call at C:\Users\matth\Anaconda3\lib\site-packages\pde\pdes\diffusion.py (97)

File "..\Anaconda3\lib\site-packages\pde\pdes\diffusion.py", line 97:
def pde_rhs(state_data: np.ndarray, t: float):

""" compiled helper function evaluating right hand side """
return diffusivity_value * laplace(state_data)
^

@david-zwicker
Copy link
Member

This looks like numba could not compile a part of the package. Are you using a recent version of the numba package (at least 0.48)? Generally, could you post the result of

import pde
pde.environment()

This should give us more information about the environment you're using.

@MatthewBelzer
Copy link
Author

It was on version .45 and I updated it. Thank you so much!

@david-zwicker
Copy link
Member

Great! I assume that solved the issue and thus closed it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants