question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

segmentation fault when importing local module that imports numba

See original GitHub issue

I keep getting segfaults when importing a local module that contains numba into a file that has symengine imported into it. The segfaults are resolved whenever I remove either one of the imports. Anyone know why this is happening?

I’m using numba 0.53.0 and python 3.8.5 on ubuntu 20.04. I’ve also been able to reproduce this on numba 0.52.0 and python 3.6.9 on ubuntu 16.04.

To reproduce, create two files as follow main.py

import symengine as se
from utils import *

utils.py

from numba import njit

Then

PYTHONFAULTHANDLER=1 python3 main.py

produces the following:

Fatal Python error: Segmentation fault

Current thread 0x00007fc6fc9e2740 (most recent call first):
  File "/usr/lib/python3.8/ctypes/__init__.py", line 373 in __init__
  File "/home/asjchoi/.local/lib/python3.8/site-packages/llvmlite/binding/ffi.py", line 185 in <module>
  File "<frozen importlib._bootstrap>", line 219 in _call_with_frames_removed
  File "<frozen importlib._bootstrap_external>", line 783 in exec_module
  File "<frozen importlib._bootstrap>", line 671 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 975 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 991 in _find_and_load
  File "<frozen importlib._bootstrap>", line 219 in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1042 in _handle_fromlist
  File "/home/asjchoi/.local/lib/python3.8/site-packages/llvmlite/binding/dylib.py", line 3 in <module>
  File "<frozen importlib._bootstrap>", line 219 in _call_with_frames_removed
  File "<frozen importlib._bootstrap_external>", line 783 in exec_module
  File "<frozen importlib._bootstrap>", line 671 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 975 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 991 in _find_and_load
  File "/home/asjchoi/.local/lib/python3.8/site-packages/llvmlite/binding/__init__.py", line 4 in <module>
  File "<frozen importlib._bootstrap>", line 219 in _call_with_frames_removed
  File "<frozen importlib._bootstrap_external>", line 783 in exec_module
  File "<frozen importlib._bootstrap>", line 671 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 975 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 991 in _find_and_load
  File "/home/asjchoi/.local/lib/python3.8/site-packages/numba/core/config.py", line 16 in <module>
  File "<frozen importlib._bootstrap>", line 219 in _call_with_frames_removed
  File "<frozen importlib._bootstrap_external>", line 783 in exec_module
  File "<frozen importlib._bootstrap>", line 671 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 975 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 991 in _find_and_load
  File "<frozen importlib._bootstrap>", line 219 in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1042 in _handle_fromlist
  File "/home/asjchoi/.local/lib/python3.8/site-packages/numba/__init__.py", line 19 in <module>
  File "<frozen importlib._bootstrap>", line 219 in _call_with_frames_removed
  File "<frozen importlib._bootstrap_external>", line 783 in exec_module
  File "<frozen importlib._bootstrap>", line 671 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 975 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 991 in _find_and_load
  File "/home/asjchoi/Desktop/test/utils.py", line 1 in <module>
  File "<frozen importlib._bootstrap>", line 219 in _call_with_frames_removed
  File "<frozen importlib._bootstrap_external>", line 783 in exec_module
  File "<frozen importlib._bootstrap>", line 671 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 975 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 991 in _find_and_load
  File "main.py", line 2 in <module>
Segmentation fault (core dumped)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:11 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
QuantuMopecommented, Mar 22, 2021

Problem is now fixed! Tested on symengine 0.7.0 and numba 0.53.0.

0reactions
esccommented, Mar 25, 2021
Read more comments on GitHub >

github_iconTop Results From Across the Web

Segmentation fault when importing a C++ shared object in ...
It looks like the address of the variable var is wrong and when accessing it, there is a segmentation fault. I tried using...
Read more >
Faults when trying to make a basic def - Numba Discussion
When running this script line-by-line, I am able to import numba fine. It only fails after the “return a” line and before the...
Read more >
Troubleshooting and tips - Numba 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 >
Compiling Python classes with @jitclass - Numba
from numba import jitclass, types, typed # key and value types kv_ty ... initialized NotInitilisingContainer() # segmentation fault/memory access violation ...
Read more >
Segmentation Fault when importing PyTorch
When I tried to import PyTorch in python, it crashed with a segfault error: “Segmentation fault (core dumped)” is all I have about...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found