numba 0.55 breaks compatibility with coverage
See original GitHub issueReporting a bug
- I have tried using the latest released version of Numba (most recent is visible in the change log (https://github.com/numba/numba/blob/master/CHANGE_LOG).
- I have included a self contained code sample to reproduce the problem. i.e. it’s possible to run as ‘python bug.py’.
Since numba 0.55 python files importing numba are causing trouble in combination with coverage xml.
Example
“example.py”:
from numba import jit
import numpy as np
@jit(nopython=True) # Set "nopython" mode for best performance, equivalent to @njit
def go_fast(a):
trace = 0.0
for i in range(a.shape[0]):
trace += np.tanh(a[i, i])
return a + trace
def main():
x = np.arange(100).reshape(10, 10)
print(go_fast(x))
if __name__ == '__main__':
main()
Expected behavior (as with numba 0.54)
$ python -m coverage run example.py
[[ 9. 10. 11. 12. 13. 14. 15. 16. 17. 18.]
[ 19. 20. 21. 22. 23. 24. 25. 26. 27. 28.]
[ 29. 30. 31. 32. 33. 34. 35. 36. 37. 38.]
[ 39. 40. 41. 42. 43. 44. 45. 46. 47. 48.]
[ 49. 50. 51. 52. 53. 54. 55. 56. 57. 58.]
[ 59. 60. 61. 62. 63. 64. 65. 66. 67. 68.]
[ 69. 70. 71. 72. 73. 74. 75. 76. 77. 78.]
[ 79. 80. 81. 82. 83. 84. 85. 86. 87. 88.]
[ 89. 90. 91. 92. 93. 94. 95. 96. 97. 98.]
[ 99. 100. 101. 102. 103. 104. 105. 106. 107. 108.]]
$ python -m coverage xml
Wrote XML report to coverage.xml
Found
$ python -m coverage run example.py
[[ 9. 10. 11. 12. 13. 14. 15. 16. 17. 18.]
[ 19. 20. 21. 22. 23. 24. 25. 26. 27. 28.]
[ 29. 30. 31. 32. 33. 34. 35. 36. 37. 38.]
[ 39. 40. 41. 42. 43. 44. 45. 46. 47. 48.]
[ 49. 50. 51. 52. 53. 54. 55. 56. 57. 58.]
[ 59. 60. 61. 62. 63. 64. 65. 66. 67. 68.]
[ 69. 70. 71. 72. 73. 74. 75. 76. 77. 78.]
[ 79. 80. 81. 82. 83. 84. 85. 86. 87. 88.]
[ 89. 90. 91. 92. 93. 94. 95. 96. 97. 98.]
[ 99. 100. 101. 102. 103. 104. 105. 106. 107. 108.]]
$ python -m coverage xml
No source for code: '/path/to/working/directory/__numba_array_expr_synthetic_module_example.py'.
coverage version is 6.2.
Many thanks for looking into this.
Best, Emanuel
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:12 (9 by maintainers)
Top Results From Across the Web
Release Notes — Numba 0.56.4+0.g288a38bbd.dirty-py3.7 ...
A backwards compatibility “shim” is provided for this release so as to not immediately break projects using Numba's internals. If a module is...
Read more >Call to cuLinkAddData results in UNKNOWN_CUDA_ERROR
Hi there, I am using numba without conda in Manjaro OS. That is, just using the nvidia driver and nvidia toolkit system installations....
Read more >Installation — Numba 0.50.1 documentation
Compatibility. Numba is compatible with Python 3.6 or later, and Numpy versions 1.15 or later. Our supported platforms are: Linux x86 (32-bit and...
Read more >Troubleshooting and tips — Numba 0.50.1 documentation
There can be various reasons why Numba cannot compile your code, and raises an error instead. One common reason is that your code...
Read more >A guide to using @overload — Numba 0.50.1 documentation
Numba supports NumPy through the provision of @jit compatible ... to look at that are well implemented in terms of accepted types and...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Sure, fully aware of that. It’s the effort that’s valued. 😃
Applying:
appears to resolve this issue, and doesn’t introduce any failures in any of the tests added or modified in #7177.