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

using numba with scipy.integrate.quad #4207

Closed
wkblack opened this issue Jun 20, 2019 · 4 comments
Closed

using numba with scipy.integrate.quad #4207

wkblack opened this issue Jun 20, 2019 · 4 comments
Labels
no action required No action was needed to resolve. scipy Requests for scipy features scumba Issue relating to SciPy support that could exist in Numba "Scumba!"

Comments

@wkblack
Copy link

wkblack commented Jun 20, 2019

There seems to be a problem with numba, using scipy's integrate function. Here's a minimal example:

# minimal reproduction of jit failure

from scipy import integrate
from numba import jit
 
@jit
def r(zf):
  return integrate.quad(lambda z: z,1,zf)

print(r(.5))

Here's a copy of the error message:

Traceback (most recent call last):
  File "min.py", line 10, in <module>
    print r(.5)
  File "/global/common/cori/software/python/2.7-anaconda-5.2/lib/python2.7/site-packages/numba/dispatcher.py", line 360, in _compile_for_args
    raise e
numba.errors.LoweringError: Failed at object (object mode backend)
make_function(closure=None, code=<code object <lambda> at 0x2aaaabb0a430, file "min.py", line 8>, name=None, defaults=None)

File "min.py", line 8:
def r(zf):
  return integrate.quad(lambda z: z,1,zf)
  ^
[1] During: lowering "$0.4 = make_function(closure=None, code=<code object <lambda> at 0x2aaaabb0a430, file "min.py", line 8>, name=None, defaults=None)" at min.py (8)
-------------------------------------------------------------------------------
 This should not have happened, a problem has occurred in Numba's internals.

Please report the error message and traceback, along with a minimal reproducer
at: https://github.com/numba/numba/issues/new

If you need help writing a minimal reproducer please see:
http://matthewrocklin.com/blog/work/2018/02/28/minimal-bug-reports

If more help is needed please feel free to speak to the Numba core developers
directly at: https://gitter.im/numba/numba

Thanks in advance for your help in improving Numba!
@wkblack wkblack changed the title scipy.integrate.quad using numba with scipy.integrate.quad Jun 20, 2019
@stuartarchibald
Copy link
Contributor

NOTE: updated comment for markdown syntax.

Thanks for the report. In general only a subset of NumPy and Python functions/features are supported by Numba, documentation on those supported can be found here.

Also, which version of Numba are you using? Locally on 0.44.1 I get:

Numba encountered the use of a language feature it does not support in this context: <lambda> (op code: make_function not supported). If the feature is explicitly supported it is likely that the result of the expression (<lambda>) is being used in an unsupported manner.

RE formatting in GitHub issues, for future reference triple backticks are needed around a code block (with optional language syntax specified), for example: ```python <your code> ```. GitHub also has a basic guide to its markdown syntax available here.

@stuartarchibald stuartarchibald added scipy Requests for scipy features no action required No action was needed to resolve. labels Jun 20, 2019
@wkblack
Copy link
Author

wkblack commented Jun 20, 2019

Thanks for the docs and the formatting pages!

I'm using python 2.7 and numba 0.38.0 apparently. The "dirty" tag worries me, though it's not likely the problem.

Python 2.7.15 |Anaconda, Inc.| (default, Dec 14 2018, 19:04:19)
[GCC 7.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import numba
>>> numba.__version__
'0.38.0+0.g2a2b772fc.dirty'

@stuartarchibald
Copy link
Contributor

Thanks for the docs and the formatting pages!

No problem.

I'm using python 2.7 and numba 0.38.0 apparently. The "dirty" tag worries me, though it's not likely the problem.

Thanks for confirming. You may find you get considerably better help messages if you upgrade, 0.44.1 is the latest released version. This won't fix the problem, that Numba doesn't support SciPy functions, but should help in general when using Numba.

@stuartarchibald
Copy link
Contributor

Closing this issue as it seems to be resolved. If this is not the case please re-open with a comment about any item that appears to be unresolved. Many thanks.

@stuartarchibald stuartarchibald added the scumba Issue relating to SciPy support that could exist in Numba "Scumba!" label Jun 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no action required No action was needed to resolve. scipy Requests for scipy features scumba Issue relating to SciPy support that could exist in Numba "Scumba!"
Projects
None yet
Development

No branches or pull requests

2 participants