Open3D
Open3D copied to clipboard
Segmentation fault when importing first PyTorch 2.2.2 and then Open3D 0.18.0
Checklist
- [X] I have searched for similar issues.
- [X] For Python issues, I have tested with the latest development wheel.
- [X] I have checked the release documentation and the latest documentation (for
main
branch).
Describe the issue
Importing torch and then open3d in that order causes a segmentation fault.
Steps to reproduce the bug
First install packages:
$ pip install open3d torch
To reproduce the bug, first import torch and then open3d:
$ python -c "import torch;import open3d;print('ok')"
OMP: Error #179: Function pthread_mutex_init failed:
OMP: System error #22: Invalid argument
zsh: segmentation fault python -c "import torch;import open3d;print('ok')"
This however doesn't reproduce in the opposite order:
$ python -c "import open3d;import torch;print('ok')"
ok
Error message
OMP: Error #179: Function pthread_mutex_init failed:
OMP: System error #22: Invalid argument
zsh: segmentation fault python -c "import torch;import open3d;print('ok')"
Expected behavior
The order of imports should not matter and it should not throw a segfault.
Open3D, Python and System information
- Operating system: macOS Sonoma 14.0
- Python version: Python 3.10.12
- Open3D version: 0.18.0
- System architecture: apple-silicon (m1 pro)
- Is this a remote workstation?: no
- How did you install Open3D?: pip
- Compiler version (if built from source): Not relevant
Additional information
I tried to install the latest development wheel but I get HTTP error 404.
I cannot reproduce this on Ubuntu 22.04.4 LTS using open3d in the pip repositories or the latest development version of open3d.
Experiment 1 (open3d version 0.18.0)
/tmp/ $ rm -rf /tmp/foo
/tmp/ $ mkdir /tmp/foo
/tmp/ $ cd /tmp/foo
/tmp/ $ virtualenv venv
/tmp/ $ source venv/bin/activate
(venv) /tmp/foo $ pip install open3d torch
(venv) /tmp/foo $ python -c "import open3d;import torch;print('ok')"
ok
(venv) /tmp/foo $ python -c "import torch;import open3d;print('ok')"
ok
(venv) /tmp/foo $ pip list
Package Version
------------------------- -----------
addict 2.4.0
asttokens 2.4.1
attrs 23.2.0
blinker 1.7.0
certifi 2024.2.2
charset-normalizer 3.3.2
click 8.1.7
comm 0.2.2
ConfigArgParse 1.7
contourpy 1.2.1
cycler 0.12.1
dash 2.16.1
dash-core-components 2.0.0
dash-html-components 2.0.0
dash-table 5.0.0
decorator 5.1.1
exceptiongroup 1.2.1
executing 2.0.1
fastjsonschema 2.19.1
filelock 3.13.4
Flask 3.0.3
fonttools 4.51.0
fsspec 2024.3.1
idna 3.7
importlib_metadata 7.1.0
ipython 8.23.0
ipywidgets 8.1.2
itsdangerous 2.2.0
jedi 0.19.1
Jinja2 3.1.3
joblib 1.4.0
jsonschema 4.21.1
jsonschema-specifications 2023.12.1
jupyter_core 5.7.2
jupyterlab_widgets 3.0.10
kiwisolver 1.4.5
MarkupSafe 2.1.5
matplotlib 3.8.4
matplotlib-inline 0.1.7
mpmath 1.3.0
nbformat 5.10.4
nest-asyncio 1.6.0
networkx 3.3
numpy 1.26.4
nvidia-cublas-cu12 12.1.3.1
nvidia-cuda-cupti-cu12 12.1.105
nvidia-cuda-nvrtc-cu12 12.1.105
nvidia-cuda-runtime-cu12 12.1.105
nvidia-cudnn-cu12 8.9.2.26
nvidia-cufft-cu12 11.0.2.54
nvidia-curand-cu12 10.3.2.106
nvidia-cusolver-cu12 11.4.5.107
nvidia-cusparse-cu12 12.1.0.106
nvidia-nccl-cu12 2.19.3
nvidia-nvjitlink-cu12 12.4.127
nvidia-nvtx-cu12 12.1.105
open3d 0.18.0
packaging 24.0
pandas 2.2.2
parso 0.8.4
pexpect 4.9.0
pillow 10.3.0
pip 22.0.2
platformdirs 4.2.0
plotly 5.21.0
prompt-toolkit 3.0.43
ptyprocess 0.7.0
pure-eval 0.2.2
Pygments 2.17.2
pyparsing 3.1.2
pyquaternion 0.9.9
python-dateutil 2.9.0.post0
pytz 2024.1
PyYAML 6.0.1
referencing 0.34.0
requests 2.31.0
retrying 1.3.4
rpds-py 0.18.0
scikit-learn 1.4.2
scipy 1.13.0
setuptools 59.6.0
six 1.16.0
stack-data 0.6.3
sympy 1.12
tenacity 8.2.3
threadpoolctl 3.4.0
torch 2.2.2
tqdm 4.66.2
traitlets 5.14.2
triton 2.2.0
typing_extensions 4.11.0
tzdata 2024.1
urllib3 2.2.1
wcwidth 0.2.13
Werkzeug 3.0.2
wheel 0.37.1
widgetsnbextension 4.0.10
zipp 3.18.1
(venv) /tmp/foo $ echo $?
0
Experiment 2 (open3d latest development version 0.18.0+5c982c7)
I installed open3d
using pip install -U -f https://www.open3d.org/docs/latest/getting_started.html open3d
, so the version reported by pip list
for open3d
is 0.18.0+5c982c7
.
/tmp/ $ rm -rf /tmp/foo
/tmp/ $ mkdir /tmp/foo
/tmp/ $ cd /tmp/foo
/tmp/ $ virtualenv venv
/tmp/ $ source venv/bin/activate
(venv) /tmp/foo $ pip install -U -f https://www.open3d.org/docs/latest/getting_started.html open3d
(venv) /tmp/foo $ pip install torch
(venv) /tmp/foo $ python -c "import open3d;import torch;print('ok')"
ok
(venv) /tmp/foo $ python -c "import torch;import open3d;print('ok')"
ok
(venv) /tmp/foo $ pip list
$ pip list
Package Version
------------------------- --------------
addict 2.4.0
asttokens 2.4.1
attrs 23.2.0
blinker 1.7.0
certifi 2024.2.2
charset-normalizer 3.3.2
click 8.1.7
comm 0.2.2
ConfigArgParse 1.7
contourpy 1.2.1
cycler 0.12.1
dash 2.16.1
dash-core-components 2.0.0
dash-html-components 2.0.0
dash-table 5.0.0
decorator 5.1.1
exceptiongroup 1.2.1
executing 2.0.1
fastjsonschema 2.19.1
filelock 3.13.4
Flask 3.0.3
fonttools 4.51.0
fsspec 2024.3.1
idna 3.7
importlib_metadata 7.1.0
ipython 8.23.0
ipywidgets 8.1.2
itsdangerous 2.2.0
jedi 0.19.1
Jinja2 3.1.3
joblib 1.4.0
jsonschema 4.21.1
jsonschema-specifications 2023.12.1
jupyter_core 5.7.2
jupyterlab_widgets 3.0.10
kiwisolver 1.4.5
MarkupSafe 2.1.5
matplotlib 3.8.4
matplotlib-inline 0.1.7
mpmath 1.3.0
nbformat 5.10.4
nest-asyncio 1.6.0
networkx 3.3
numpy 1.26.4
nvidia-cublas-cu12 12.1.3.1
nvidia-cuda-cupti-cu12 12.1.105
nvidia-cuda-nvrtc-cu12 12.1.105
nvidia-cuda-runtime-cu12 12.1.105
nvidia-cudnn-cu12 8.9.2.26
nvidia-cufft-cu12 11.0.2.54
nvidia-curand-cu12 10.3.2.106
nvidia-cusolver-cu12 11.4.5.107
nvidia-cusparse-cu12 12.1.0.106
nvidia-nccl-cu12 2.19.3
nvidia-nvjitlink-cu12 12.4.127
nvidia-nvtx-cu12 12.1.105
open3d 0.18.0+5c982c7
packaging 24.0
pandas 2.2.2
parso 0.8.4
pexpect 4.9.0
pillow 10.3.0
pip 22.0.2
platformdirs 4.2.0
plotly 5.21.0
prompt-toolkit 3.0.43
ptyprocess 0.7.0
pure-eval 0.2.2
Pygments 2.17.2
pyparsing 3.1.2
pyquaternion 0.9.9
python-dateutil 2.9.0.post0
pytz 2024.1
PyYAML 6.0.1
referencing 0.34.0
requests 2.31.0
retrying 1.3.4
rpds-py 0.18.0
scikit-learn 1.4.2
scipy 1.13.0
setuptools 59.6.0
six 1.16.0
stack-data 0.6.3
sympy 1.12
tenacity 8.2.3
threadpoolctl 3.4.0
torch 2.2.2
tqdm 4.66.2
traitlets 5.14.2
triton 2.2.0
typing_extensions 4.11.0
tzdata 2024.1
urllib3 2.2.1
wcwidth 0.2.13
Werkzeug 3.0.2
wheel 0.37.1
widgetsnbextension 4.0.10
zipp 3.18.1
(venv) /tmp/foo $ echo $?
0
Open3D, Python and System information
- Operating system: Ubuntu 22.04.4 LTS
- Python version: Python 3.10.12
- Open3D version: experiment 1 above uses 0.18.0 and experiment 2 above uses 0.18.0+5c982c7
- System architecture: `Linux desktop 6.5.0-27-generic #28~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Mar 15 10:51:06 UTC 2 x86_64 x86_64 x86_64 GNU/Linux` (as reported by `uname -a`)
- Is this a remote workstation?: no
- How did you install Open3D?: pip
- Compiler version (if built from source): Not relevant
Following
The same issue goes for torch==2.4.1
and open3d==0.18.0
in arm64 (mac osx)
python -c "import torch; import open3d; print('ok')"
[1] 93247 segmentation fault python -c "import torch; import open3d; print('ok')"
as written, forcing oped3d
to be import before torch
solve it.
python -c "import open3d; import torch; print('ok')"
ok