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

"Segmentation fault (core dumped)" after installing the required sparse library in a Qiskit env (conda virtual env) #522

Open
seafolk-cn opened this issue Oct 19, 2021 · 14 comments
Labels

Comments

@seafolk-cn
Copy link

seafolk-cn commented Oct 19, 2021

Hi,

We encountered a serious issue when running jupyter notebook code with the support of sparse library.
Can someone help?

Thanks!

Describe the bug
In a Qiskit 0.30 conda virtual env, after installing the required sparse library using pip, the ipython run will error out with
"Segmentation fault (core dumped)" message.
issue_with_sparse.log

To Reproduce

  1. Activate conda virtual env and run the "01_neural_networks.ipynb" sample code with below commands:

conda activate qiskit0.30_test
ipython -c "%run 01_neural_networks.ipynb"
This will prompt you to install the sparse library.

  1. Install sparse library by executing "pip install 'qiskit-machine-learning[sparse]'" inside the conda virtual env
  2. Rerun the "01_neural_networks.ipynb" sample code will produce the "Segmenttation fault" error.

Expected behavior
expect no prompt for install sparse library and no errors popped up for the ipython run

System

  • OS and version: RHEL 8.4 (s390x)
  • Conda: 4.10.1
  • Sparse: version: 0.13.0
  • NumPy version: 1.20.3
  • Numba version: 0.54.1

Additional context
Add any other context about the problem here.

@seafolk-cn seafolk-cn added the bug Indicates an unexpected problem or unintended behavior label Oct 19, 2021
@hameerabbasi
Copy link
Collaborator

I cannot tell from your issue where the notebook is, could you give a link to it or upload it? Also could you show where you got the conda environment to run the notebook?

@hameerabbasi
Copy link
Collaborator

Also can you run with the environment variable NUMBA_DISABLE_JIT=1 and post the stack trace?

@seafolk-cn
Copy link
Author

I cannot tell from your issue where the notebook is, could you give a link to it or upload it? Also could you show where you got the conda environment to run the notebook?

We got the sample notebook from below official repo, it's inside the docs/tutorials/ folder.
https://github.com/Qiskit/qiskit-machine-learning
01_neural_networks.ipynb.zip

Download link for anaconda for IBM z
https://www.anaconda.com/products/individual#Downloads
https://repo.anaconda.com/archive/Anaconda3-2021.05-Linux-s390x.sh

I installed anaconda for z on RHEL 8.4 (s390x) and created virtual env using below commands:

conda create -n qiskit0.30 python=3.8
conda activate qiskit0.30
pip install qiskit==0.30
pip install qiskit-machine-learning
........
then i can run the notebook inside this virtual env.

@hameerabbasi
Copy link
Collaborator

Unfortunately I don't have access to an s390x machine, but I can try to reproduce it on x86_64 over the weekend.

@seafolk-cn
Copy link
Author

(qiskit0.30_test) [root@rhel84 qiskit-machine-learning]# jupyter nbconvert --to script 01_neural_networks.ipynb
[NbConvertApp] Converting notebook 01_neural_networks.ipynb to script
[NbConvertApp] Writing 9419 bytes to 01_neural_networks.py
(qiskit0.30_test) [root@rhel84 qiskit-machine-learning]#
(qiskit0.30_test) [root@rhel84 qiskit-machine-learning]#
(qiskit0.30_test) [root@rhel84 qiskit-machine-learning]#
(qiskit0.30_test) [root@rhel84 qiskit-machine-learning]# python 01_neural_networks.py
Segmentation fault (core dumped)
(qiskit0.30_test) [root@rhel84 qiskit-machine-learning]# export NUMBA_DISABLE_JIT=1
(qiskit0.30_test) [root@rhel84 qiskit-machine-learning]# python 01_neural_networks.py
Segmentation fault (core dumped)
(qiskit0.30_test) [root@rhel84 qiskit-machine-learning]# python -q -X faulthandler 01_neural_networks.py
Fatal Python error: Segmentation fault

Current thread 0x000003ffb7278240 (most recent call first):
File "/opt/anaconda/envs/qiskit0.30_test/lib/python3.8/ctypes/init.py", line 373 in init
File "/opt/anaconda/envs/qiskit0.30_test/lib/python3.8/site-packages/llvmlite/binding/ffi.py", line 185 in
File "", line 219 in _call_with_frames_removed
File "", line 843 in exec_module
File "", line 671 in _load_unlocked
File "", line 975 in _find_and_load_unlocked
File "", line 991 in _find_and_load
File "", line 219 in _call_with_frames_removed
File "", line 1042 in _handle_fromlist
File "/opt/anaconda/envs/qiskit0.30_test/lib/python3.8/site-packages/llvmlite/binding/dylib.py", line 3 in
File "", line 219 in _call_with_frames_removed
File "", line 843 in exec_module
File "", line 671 in _load_unlocked
File "", line 975 in _find_and_load_unlocked
File "", line 991 in _find_and_load
File "/opt/anaconda/envs/qiskit0.30_test/lib/python3.8/site-packages/llvmlite/binding/init.py", line 4 in
File "", line 219 in _call_with_frames_removed
File "", line 843 in exec_module
File "", line 671 in _load_unlocked
File "", line 975 in _find_and_load_unlocked
File "", line 991 in _find_and_load
File "/opt/anaconda/envs/qiskit0.30_test/lib/python3.8/site-packages/numba/core/config.py", line 16 in
File "", line 219 in _call_with_frames_removed
File "", line 843 in exec_module
File "", line 671 in _load_unlocked
File "", line 975 in _find_and_load_unlocked
File "", line 991 in _find_and_load
File "", line 219 in _call_with_frames_removed
File "", line 1042 in _handle_fromlist
File "/opt/anaconda/envs/qiskit0.30_test/lib/python3.8/site-packages/numba/init.py", line 19 in
File "", line 219 in _call_with_frames_removed
File "", line 843 in exec_module
File "", line 671 in _load_unlocked
File "", line 975 in _find_and_load_unlocked
File "", line 991 in _find_and_load
File "/opt/anaconda/envs/qiskit0.30_test/lib/python3.8/site-packages/sparse/_coo/core.py", line 9 in
File "", line 219 in _call_with_frames_removed
File "", line 843 in exec_module
File "", line 671 in _load_unlocked
File "", line 975 in _find_and_load_unlocked
File "", line 991 in _find_and_load
File "/opt/anaconda/envs/qiskit0.30_test/lib/python3.8/site-packages/sparse/_coo/init.py", line 1 in
File "", line 219 in _call_with_frames_removed
File "", line 843 in exec_module
File "", line 671 in _load_unlocked
File "", line 975 in _find_and_load_unlocked
File "", line 991 in _find_and_load
File "/opt/anaconda/envs/qiskit0.30_test/lib/python3.8/site-packages/sparse/init.py", line 1 in
File "", line 219 in _call_with_frames_removed
File "", line 843 in exec_module
File "", line 671 in _load_unlocked
File "", line 975 in _find_and_load_unlocked
File "", line 991 in _find_and_load
File "/opt/anaconda/envs/qiskit0.30_test/lib/python3.8/site-packages/qiskit_machine_learning/neural_networks/circuit_qnn.py", line 21 in
File "", line 219 in _call_with_frames_removed
File "", line 843 in exec_module
File "", line 671 in _load_unlocked
File "", line 975 in _find_and_load_unlocked
File "", line 991 in _find_and_load
File "/opt/anaconda/envs/qiskit0.30_test/lib/python3.8/site-packages/qiskit_machine_learning/neural_networks/init.py", line 52 in
File "", line 219 in _call_with_frames_removed
File "", line 843 in exec_module
File "", line 671 in _load_unlocked
File "", line 975 in _find_and_load_unlocked
File "", line 991 in _find_and_load
File "01_neural_networks.py", line 66 in
Segmentation fault (core dumped)
(qiskit0.30_test) [root@rhel84 qiskit-machine-learning]#

@seafolk-cn
Copy link
Author

Unfortunately I don't have access to an s390x machine, but I can try to reproduce it on x86_64 over the weekend.

Let me check if i can share this env to you. :)

@hameerabbasi
Copy link
Collaborator

It seems to be a problem importing Numba on S390x, IIUC. Can you try that on your system to see if it is indeed the issue?

If it is, can you install as many packages from conda as possible, and the conda compilers package as well, so things are built in an ABI compatible way?

@seafolk-cn
Copy link
Author

Is below your mailbox?

[email protected]

@seafolk-cn
Copy link
Author

hameer, mailed you just now, thanks!

@seafolk-cn
Copy link
Author

Hameer, sorry, just found the mentioned env not on this machine, i need create one to reproduce the issue, wait a moment.

@hameerabbasi
Copy link
Collaborator

I'm doing it already following your instructions! 😆

@seafolk-cn
Copy link
Author

OK! Great!

But that will take some time to complete!
You can create a new env with below clone command:
conda create -n qiskit0.30_test --clone qiskit0.30_py3.8

the qiskit 0.30 already installed in it, then you can install extension like machine learning (pip install qiskit-machine-learning) etc.

the sample code are located in below folder.
/root/tutorials/application-tutorials/qiskit-machine-learning

@hameerabbasi
Copy link
Collaborator

I see that you reported numba/llvmlite#780. This is the root cause here. I will mark this as upstream.

@hameerabbasi hameerabbasi added upstream and removed bug Indicates an unexpected problem or unintended behavior labels Oct 20, 2021
@seafolk-cn
Copy link
Author

I see that you reported numba/llvmlite#780. This is the root cause here. I will mark this as upstream.

Yes, i originally considered these were different issues.
But i now feel it maybe the same by comparing the stack trace.

Thanks!

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

No branches or pull requests

2 participants