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

Compatibility possible for numba jit compilation in Python runtime on GCP cloud functions? #3236

Closed
songololo opened this issue Aug 18, 2018 · 2 comments
Labels
more info needed This issue needs more information needtriage

Comments

@songololo
Copy link

Compatibility request for GCP cloud functions Python runtime

This is neither a feature request or a bug so much as request for compatibility with Google Cloud Platform's cloud functions. A corresponding issue has been logged with GCP.

At the moment numba doesn't work with GCP cloud functions' Python runtime. An example function and error message below. GCP cloud functions is able to install and import the numba package (e.g. printing numba.__version__ works) , but, numba is unable to jit compile a function, presumably something to do with how GCP hosts or virtualises its compute environments.

Is there a way to coordinate a solution with GCP as this would be an extremely useful use-case?

import numba

@numba.njit()
def sum_test_njit(a, b):
  return a + b

print(sum_test_njit(2, 3)) # should print '5'

Example error response from GCP cloud function Python 3.7 runtime:

severity:  "ERROR"   
 textPayload:  "Traceback (most recent call last):
  File "/env/local/lib/python3.7/site-packages/google/cloud/functions_v1beta2/worker.py", line 281, in run_background_function
    _function_handler.invoke_user_function(event_object)
  File "/env/local/lib/python3.7/site-packages/google/cloud/functions_v1beta2/worker.py", line 171, in invoke_user_function
    return call_user_function(request_or_event)
  File "/env/local/lib/python3.7/site-packages/google/cloud/functions_v1beta2/worker.py", line 168, in call_user_function
    event_context.Context(**request_or_event.context))
  File "/user_code/main.py", line 25, in hello_pubsub
    print(f'numba working? {sum_test_njit(2, 3)}')
  File "/env/local/lib/python3.7/site-packages/numba/dispatcher.py", line 368, in _compile_for_args
    raise e
  File "/env/local/lib/python3.7/site-packages/numba/dispatcher.py", line 325, in _compile_for_args
    return self.compile(tuple(argtypes))
  File "/env/local/lib/python3.7/site-packages/numba/dispatcher.py", line 653, in compile
    cres = self._compiler.compile(args, return_type)
  File "/env/local/lib/python3.7/site-packages/numba/dispatcher.py", line 83, in compile
    pipeline_class=self.pipeline_class)
  File "/env/local/lib/python3.7/site-packages/numba/compiler.py", line 873, in compile_extra
    return pipeline.compile_extra(func)
  File "/env/local/lib/python3.7/site-packages/numba/compiler.py", line 367, in compile_extra
    return self._compile_bytecode()
  File "/env/local/lib/python3.7/site-packages/numba/compiler.py", line 804, in _compile_bytecode
    return self._compile_core()
  File "/env/local/lib/python3.7/site-packages/numba/compiler.py", line 791, in _compile_core
    res = pm.run(self.status)
  File "/env/local/lib/python3.7/site-packages/numba/compiler.py", line 253, in run
    raise patched_exception
  File "/env/local/lib/python3.7/site-packages/numba/compiler.py", line 245, in run
    stage()
  File "/env/local/lib/python3.7/site-packages/numba/compiler.py", line 678, in stage_nopython_backend
    self._backend(lowerfn, objectmode=False)
  File "/env/local/lib/python3.7/site-packages/numba/compiler.py", line 628, in _backend
    lowered = lowerfn()
  File "/env/local/lib/python3.7/site-packages/numba/compiler.py", line 615, in backend_nopython_mode
    self.flags)
  File "/env/local/lib/python3.7/site-packages/numba/compiler.py", line 991, in native_lowering_stage
    lower = lowering.Lower(targetctx, library, fndesc, interp)
  File "/env/local/lib/python3.7/site-packages/numba/lowering.py", line 93, in __init__
    self.env = Environment.from_fndesc(self.fndesc)
  File "/env/local/lib/python3.7/site-packages/numba/lowering.py", line 31, in from_fndesc
    mod = fndesc.lookup_module()
  File "/env/local/lib/python3.7/site-packages/numba/funcdesc.py", line 83, in lookup_module
    return sys.modules[self.modname]
KeyError: "Failed at nopython (nopython mode backend)\n'main'"
@stuartarchibald
Copy link
Contributor

Thanks for the report. Is this still an issue with latest Numba (0.51.2)?

@esc esc added the more info needed This issue needs more information label Sep 25, 2020
@esc
Copy link
Member

esc commented Nov 9, 2020

Closing this issue due to lack of information on compatibility with the latest version of Numba. If more information becomes available please add it and reopen the issue. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
more info needed This issue needs more information needtriage
Projects
Development

No branches or pull requests

4 participants