Torch 2.7.0 Segmentation fault on import on linux

username: Skier
cooked: <p>I’m getting a segmentation fault when importing pytorch 2.7.0 inside a completely fresh conda environment with python 3.12. (WSL with Conda). Are others seeing this? I can reproduce it consistently. I create a conda environment completely fresh with nothing but python 3.12, I then install torch using the exact command from the website, then I import torch in a .py file and get a seg fault. No issues on windows.</p>
<p>Example conda file:</p>
<pre><code class="lang-auto">name: test2
channels:
  - defaults
dependencies:
  - python=3.12
  - pip
</code></pre>
<p>Then install torch:</p>
<pre><code class="lang-auto">pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu128
</code></pre>
<p>Then import torch yields: <code>Segmentation fault</code></p>

username: ptrblck
cooked: <p>Could you try to get a stacktraces from <code>gdb</code> and post it here?</p>

username: Skier
cooked: <pre><code class="lang-auto">&gt;&gt;&gt; import torch

Program received signal SIGSEGV, Segmentation fault.
elf_dynamic_do_Rela (skip_ifunc=&lt;optimized out&gt;, lazy=0, nrelative=0, relsize=0, reladdr=0, scope=&lt;optimized out&gt;, map=0xed92d0) at ./elf/do-rel.h:52
warning: 52     ./elf/do-rel.h: No such file or directory
(gdb) bt
#0  elf_dynamic_do_Rela (skip_ifunc=&lt;optimized out&gt;, lazy=0, nrelative=0, relsize=0, reladdr=0, scope=&lt;optimized out&gt;, map=0xed92d0) at ./elf/do-rel.h:52
#1  _dl_relocate_object (l=&lt;optimized out&gt;, scope=&lt;optimized out&gt;, reloc_mode=&lt;optimized out&gt;, consider_profiling=&lt;optimized out&gt;, consider_profiling@entry=0)
    at ./elf/dl-reloc.c:301
#2  0x00007ffff7fd1e0b in _dl_open_relocate_one_object (args=args@entry=0x7fffffffb420, r=r@entry=0x7ffff7ffe128 &lt;_r_debug&gt;, l=&lt;optimized out&gt;,
    reloc_mode=reloc_mode@entry=1, relocation_in_progress=relocation_in_progress@entry=0x7fffffffb0ff) at ./elf/dl-open.c:511
#3  0x00007ffff7fd2b16 in _dl_open_relocate_one_object (relocation_in_progress=0x7fffffffb0ff, reloc_mode=&lt;optimized out&gt;, l=&lt;optimized out&gt;, r=&lt;optimized out&gt;,
    args=&lt;optimized out&gt;) at ./elf/dl-open.c:478
#4  dl_open_worker_begin (a=a@entry=0x7fffffffb420) at ./elf/dl-open.c:723
#5  0x00007ffff7fc651c in __GI__dl_catch_exception (exception=exception@entry=0x7fffffffb270, operate=operate@entry=0x7ffff7fd2830 &lt;dl_open_worker_begin&gt;,
    args=args@entry=0x7fffffffb420) at ./elf/dl-catch.c:237
#6  0x00007ffff7fd1d20 in dl_open_worker (a=a@entry=0x7fffffffb420) at ./elf/dl-open.c:803
#7  0x00007ffff7fc651c in __GI__dl_catch_exception (exception=exception@entry=0x7fffffffb400, operate=operate@entry=0x7ffff7fd1ce0 &lt;dl_open_worker&gt;,
    args=args@entry=0x7fffffffb420) at ./elf/dl-catch.c:237
#8  0x00007ffff7fd2164 in _dl_open (file=0x7fff14923290 "libcuda.so.1", mode=&lt;optimized out&gt;, caller_dlopen=0x7fff0d23dee9, nsid=&lt;optimized out&gt;, argc=1,
    argv=0x7fffffffd2f8, env=0x7fffffffd308) at ./elf/dl-open.c:905
#9  0x00007ffff7d451a4 in dlopen_doit (a=a@entry=0x7fffffffb6d0) at ./dlfcn/dlopen.c:56
#10 0x00007ffff7fc651c in __GI__dl_catch_exception (exception=exception@entry=0x7fffffffb610, operate=0x7ffff7d45140 &lt;dlopen_doit&gt;, args=0x7fffffffb6d0)
    at ./elf/dl-catch.c:237
#11 0x00007ffff7fc6669 in _dl_catch_error (objname=0x7fffffffb678, errstring=0x7fffffffb680, mallocedp=0x7fffffffb677, operate=&lt;optimized out&gt;,
    args=&lt;optimized out&gt;) at ./elf/dl-catch.c:256
#12 0x00007ffff7d44c83 in _dlerror_run (operate=operate@entry=0x7ffff7d45140 &lt;dlopen_doit&gt;, args=args@entry=0x7fffffffb6d0) at ./dlfcn/dlerror.c:138
#13 0x00007ffff7d4525f in dlopen_implementation (dl_caller=&lt;optimized out&gt;, mode=&lt;optimized out&gt;, file=&lt;optimized out&gt;) at ./dlfcn/dlopen.c:71
#14 ___dlopen (file=&lt;optimized out&gt;, mode=&lt;optimized out&gt;) at ./dlfcn/dlopen.c:81
#15 0x00007fff0d23dee9 in ?? () from /home/tyler/miniconda3/envs/test2/lib/python3.12/site-packages/torch/lib/../../nvidia/cublas/lib/libcublasLt.so.12
#16 0x00007fff0d23df31 in ?? () from /home/tyler/miniconda3/envs/test2/lib/python3.12/site-packages/torch/lib/../../nvidia/cublas/lib/libcublasLt.so.12
#17 0x00007fff0aad73a6 in ?? () from /home/tyler/miniconda3/envs/test2/lib/python3.12/site-packages/torch/lib/../../nvidia/cublas/lib/libcublasLt.so.12
#18 0x00007ffff7fca71f in call_init (l=&lt;optimized out&gt;, argc=argc@entry=1, argv=argv@entry=0x7fffffffd2f8, env=env@entry=0x7fffffffd308) at ./elf/dl-init.c:74
#19 0x00007ffff7fca824 in call_init (env=&lt;optimized out&gt;, argv=&lt;optimized out&gt;, argc=&lt;optimized out&gt;, l=&lt;optimized out&gt;) at ./elf/dl-init.c:120
#20 _dl_init (main_map=0xc5b010, argc=1, argv=0x7fffffffd2f8, env=0x7fffffffd308) at ./elf/dl-init.c:121
#21 0x00007ffff7fc65b2 in __GI__dl_catch_exception (exception=exception@entry=0x0, operate=operate@entry=0x7ffff7fd1cc0 &lt;call_dl_init&gt;,
    args=args@entry=0x7fffffffb920) at ./elf/dl-catch.c:211
#22 0x00007ffff7fd1d7c in dl_open_worker (a=0x7fffffffbad0) at ./elf/dl-open.c:829
#23 dl_open_worker (a=a@entry=0x7fffffffbad0) at ./elf/dl-open.c:792
#24 0x00007ffff7fc651c in __GI__dl_catch_exception (exception=exception@entry=0x7fffffffbab0, operate=operate@entry=0x7ffff7fd1ce0 &lt;dl_open_worker&gt;,
    args=args@entry=0x7fffffffbad0) at ./elf/dl-catch.c:237
#25 0x00007ffff7fd2164 in _dl_open (
    file=0x7ffff7619760 "/home/tyler/miniconda3/envs/test2/lib/python3.12/site-packages/torch/_C.cpython-312-x86_64-linux-gnu.so", mode=&lt;optimized out&gt;,
    caller_dlopen=0x61ce42 &lt;_PyImport_FindSharedFuncptr+146&gt;, nsid=&lt;optimized out&gt;, argc=1, argv=0x7fffffffd2f8, env=0x7fffffffd308) at ./elf/dl-open.c:905
#26 0x00007ffff7d451a4 in dlopen_doit (a=a@entry=0x7fffffffbd80) at ./dlfcn/dlopen.c:56
#27 0x00007ffff7fc651c in __GI__dl_catch_exception (exception=exception@entry=0x7fffffffbcc0, operate=0x7ffff7d45140 &lt;dlopen_doit&gt;, args=0x7fffffffbd80)
    at ./elf/dl-catch.c:237
#28 0x00007ffff7fc6669 in _dl_catch_error (objname=0x7fffffffbd28, errstring=0x7fffffffbd30, mallocedp=0x7fffffffbd27, operate=&lt;optimized out&gt;,
    args=&lt;optimized out&gt;) at ./elf/dl-catch.c:256
#29 0x00007ffff7d44c83 in _dlerror_run (operate=operate@entry=0x7ffff7d45140 &lt;dlopen_doit&gt;, args=args@entry=0x7fffffffbd80) at ./dlfcn/dlerror.c:138
#30 0x00007ffff7d4525f in dlopen_implementation (dl_caller=&lt;optimized out&gt;, mode=&lt;optimized out&gt;, file=&lt;optimized out&gt;) at ./dlfcn/dlopen.c:71
#31 ___dlopen (file=&lt;optimized out&gt;, mode=&lt;optimized out&gt;) at ./dlfcn/dlopen.c:81
#32 0x000000000061ce42 in _PyImport_FindSharedFuncptr (prefix=prefix@entry=0x681409 "PyInit", shortname=shortname@entry=0x7ffff7667260 "_C",
    pathname=pathname@entry=0x7ffff7619760 "/home/tyler/miniconda3/envs/test2/lib/python3.12/site-packages/torch/_C.cpython-312-x86_64-linux-gnu.so",
    fp=fp@entry=0x0) at /usr/local/src/conda/python-3.12.9/Python/dynload_shlib.c:80
#33 0x000000000061aeba in _PyImport_LoadDynamicModuleWithSpec (fp=&lt;optimized out&gt;, spec=0x7ffff76674d0) at /usr/local/src/conda/python-3.12.9/Python/importdl.c:144
#34 _imp_create_dynamic_impl (module=&lt;optimized out&gt;, file=&lt;optimized out&gt;, spec=0x7ffff76674d0) at /usr/local/src/conda/python-3.12.9/Python/import.c:3777
#35 _imp_create_dynamic (module=&lt;optimized out&gt;, args=&lt;optimized out&gt;, nargs=&lt;optimized out&gt;) at /usr/local/src/conda/python-3.12.9/Python/clinic/import.c.h:506
#36 0x000000000054db3c in cfunction_vectorcall_FASTCALL (func=&lt;optimized out&gt;, args=0x7ffff7665138, nargsf=1, kwnames=&lt;optimized out&gt;) at /usr/local/src/conda/python-3.12.9/Objects/methodobject.c:422
#37 0x000000000052d84a in PyCFunction_Call (kwargs=0x7ffff765b4c0, args=0x7ffff7665120, callable=0x7ffff7be9c10) at /usr/local/src/conda/python-3.12.9/Objects/call.c:387
#38 _PyEval_EvalFrameDefault (tstate=&lt;optimized out&gt;, frame=0x7ffff7fb9768, throwflag=&lt;optimized out&gt;) at Python/bytecodes.c:3263
#39 0x000000000054cfe3 in _PyObject_VectorcallTstate (kwnames=0x0, nargsf=&lt;optimized out&gt;, args=&lt;optimized out&gt;, callable=0x7ffff7bf0040, tstate=0x9c0e50 &lt;_PyRuntime+458992&gt;) at /usr/local/src/conda/python-3.12.9/Include/internal/pycore_call.h:92
#40 object_vacall (tstate=tstate@entry=0x9c0e50 &lt;_PyRuntime+458992&gt;, base=&lt;optimized out&gt;, callable=0x7ffff7bf0040, vargs=&lt;optimized out&gt;) at /usr/local/src/conda/python-3.12.9/Objects/call.c:850
#41 0x0000000000578741 in PyObject_CallMethodObjArgs (obj=&lt;optimized out&gt;, name=name@entry=0x9596f8 &lt;_PyRuntime+35224&gt;) at /usr/local/src/conda/python-3.12.9/Objects/call.c:910
#42 0x0000000000577d3d in import_find_and_load (abs_name=0x7ffff791ad70, tstate=0x9c0e50 &lt;_PyRuntime+458992&gt;) at /usr/local/src/conda/python-3.12.9/Python/import.c:2781
#43 PyImport_ImportModuleLevelObject (name=name@entry=0x7ffff791ad70, globals=&lt;optimized out&gt;, locals=locals@entry=0x7ffff79f2440, fromlist=fromlist@entry=0x7ffff78eaa70, level=0) at /usr/local/src/conda/python-3.12.9/Python/import.c:2864
#44 0x000000000052fb55 in import_name (level=0x951a28 &lt;_PyRuntime+3272&gt;, fromlist=0x7ffff78eaa70, name=0x7ffff791ad70, frame=0x7ffff7fb9378, tstate=&lt;optimized out&gt;) at /usr/local/src/conda/python-3.12.9/Python/ceval.c:2510
#45 _PyEval_EvalFrameDefault (tstate=&lt;optimized out&gt;, frame=0x7ffff7fb9378, throwflag=&lt;optimized out&gt;) at Python/bytecodes.c:2144
#46 0x00000000005e581e in PyEval_EvalCode (co=co@entry=0xb9d460, globals=globals@entry=0x7ffff79f2440, locals=locals@entry=0x7ffff79f2440) at /usr/local/src/conda/python-3.12.9/Python/ceval.c:580
#47 0x0000000000603679 in builtin_exec_impl (module=&lt;optimized out&gt;, closure=&lt;optimized out&gt;, locals=0x7ffff79f2440, globals=0x7ffff79f2440, source=0xb9d460) at /usr/local/src/conda/python-3.12.9/Python/bltinmodule.c:1096
#48 builtin_exec (module=&lt;optimized out&gt;, args=&lt;optimized out&gt;, nargs=&lt;optimized out&gt;, kwnames=&lt;optimized out&gt;) at /usr/local/src/conda/python-3.12.9/Python/clinic/bltinmodule.c.h:586
#49 0x00000000005418be in cfunction_vectorcall_FASTCALL_KEYWORDS (func=0x7ffff7be8770, args=0x7ffff78fed58, nargsf=&lt;optimized out&gt;, kwnames=0x0) at /usr/local/src/conda/python-3.12.9/Objects/methodobject.c:438
#50 0x000000000052d84a in PyCFunction_Call (kwargs=0x7ffff7c41100, args=0x7ffff78fed40, callable=0x7ffff7be8770) at /usr/local/src/conda/python-3.12.9/Objects/call.c:387
#51 _PyEval_EvalFrameDefault (tstate=&lt;optimized out&gt;, frame=0x7ffff7fb92f0, throwflag=&lt;optimized out&gt;) at Python/bytecodes.c:3263
#52 0x000000000054cfe3 in _PyObject_VectorcallTstate (kwnames=0x0, nargsf=&lt;optimized out&gt;, args=&lt;optimized out&gt;, callable=0x7ffff7bf0040, tstate=0x9c0e50 &lt;_PyRuntime+458992&gt;) at /usr/local/src/conda/python-3.12.9/Include/internal/pycore_call.h:92
#53 object_vacall (tstate=tstate@entry=0x9c0e50 &lt;_PyRuntime+458992&gt;, base=&lt;optimized out&gt;, callable=0x7ffff7bf0040, vargs=&lt;optimized out&gt;) at /usr/local/src/conda/python-3.12.9/Objects/call.c:850
#54 0x0000000000578741 in PyObject_CallMethodObjArgs (obj=&lt;optimized out&gt;, name=name@entry=0x9596f8 &lt;_PyRuntime+35224&gt;) at /usr/local/src/conda/python-3.12.9/Objects/call.c:910
#55 0x0000000000577d3d in import_find_and_load (abs_name=0x7ffff7a207e0, tstate=0x9c0e50 &lt;_PyRuntime+458992&gt;) at /usr/local/src/conda/python-3.12.9/Python/import.c:2781
#56 PyImport_ImportModuleLevelObject (name=name@entry=0x7ffff7a207e0, globals=&lt;optimized out&gt;, locals=locals@entry=0x7ffff7c41040, fromlist=fromlist@entry=0x93ac60 &lt;_Py_NoneStruct&gt;, level=0) at /usr/local/src/conda/python-3.12.9/Python/import.c:2864
#57 0x000000000052fb55 in import_name (level=0x951a28 &lt;_PyRuntime+3272&gt;, fromlist=0x93ac60 &lt;_Py_NoneStruct&gt;, name=0x7ffff7a207e0, frame=0x7ffff7fb9020, tstate=&lt;optimized out&gt;) at /usr/local/src/conda/python-3.12.9/Python/ceval.c:2510
#58 _PyEval_EvalFrameDefault (tstate=&lt;optimized out&gt;, frame=0x7ffff7fb9020, throwflag=&lt;optimized out&gt;) at Python/bytecodes.c:2144
#59 0x00000000005e581e in PyEval_EvalCode (co=co@entry=0x7ffff7c2de40, globals=globals@entry=0x7ffff7c41040, locals=locals@entry=0x7ffff7c41040) at /usr/local/src/conda/python-3.12.9/Python/ceval.c:580
#60 0x000000000060bfd7 in run_eval_code_obj (tstate=tstate@entry=0x9c0e50 &lt;_PyRuntime+458992&gt;, co=co@entry=0x7ffff7c2de40, globals=globals@entry=0x7ffff7c41040, locals=locals@entry=0x7ffff7c41040) at /usr/local/src/conda/python-3.12.9/Python/pythonrun.c:1716
#61 0x00000000006071c7 in run_mod (mod=mod@entry=0xb6ff28, filename=filename@entry=0x7ffff79eb390, globals=0x7ffff7c41040, locals=0x7ffff7c41040, flags=flags@entry=0x7fffffffd090, arena=arena@entry=0x7ffff7b674f0) at /usr/local/src/conda/python-3.12.9/Python/pythonrun.c:1737
#62 0x00000000004fc998 in PyRun_InteractiveOneObjectEx (fp=fp@entry=0x7ffff7eb08e0 &lt;_IO_2_1_stdin_&gt;, filename=filename@entry=0x7ffff79eb390, flags=flags@entry=0x7fffffffd090) at /usr/local/src/conda/python-3.12.9/Python/pythonrun.c:260
#63 0x0000000000503c3c in _PyRun_InteractiveLoopObject (fp=0x7ffff7eb08e0 &lt;_IO_2_1_stdin_&gt;, filename=0x7ffff79eb390, flags=0x7fffffffd090) at /usr/local/src/conda/python-3.12.9/Python/pythonrun.c:137
#64 0x000000000046cde1 in _PyRun_AnyFileObject (fp=0x7ffff7eb08e0 &lt;_IO_2_1_stdin_&gt;, filename=0x7ffff79eb390, closeit=0, flags=0x7fffffffd090) at /usr/local/src/conda/python-3.12.9/Python/pythonrun.c:72
#65 0x0000000000503d9b in PyRun_AnyFileExFlags (fp=0x7ffff7eb08e0 &lt;_IO_2_1_stdin_&gt;, filename=filename@entry=0x67d039 "&lt;stdin&gt;", closeit=closeit@entry=0, flags=0x7fffffffd090) at /usr/local/src/conda/python-3.12.9/Python/pythonrun.c:104
#66 0x0000000000467499 in pymain_run_stdin (config=0x963a30 &lt;_PyRuntime+77008&gt;) at /usr/local/src/conda/python-3.12.9/Modules/main.c:521
#67 pymain_run_python (exitcode=0x7fffffffd064) at /usr/local/src/conda/python-3.12.9/Modules/main.c:637
#68 Py_RunMain () at /usr/local/src/conda/python-3.12.9/Modules/main.c:714
#69 0x00000000005d03c9 in Py_BytesMain (argc=&lt;optimized out&gt;, argv=&lt;optimized out&gt;) at /usr/local/src/conda/python-3.12.9/Modules/main.c:768
#70 0x00007ffff7cd71ca in __libc_start_call_main (main=main@entry=0x5d0300 &lt;main&gt;, argc=argc@entry=1, argv=argv@entry=0x7fffffffd2f8) at ../sysdeps/nptl/libc_start_call_main.h:58
#71 0x00007ffff7cd728b in __libc_start_main_impl (main=0x5d0300 &lt;main&gt;, argc=1, argv=0x7fffffffd2f8, init=&lt;optimized out&gt;, fini=&lt;optimized out&gt;, rtld_fini=&lt;optimized out&gt;, stack_end=0x7fffffffd2e8) at ../csu/libc-start.c:360
#72 0x00000000005d01f9 in _start ()
</code></pre>

username: Skier
cooked: <p>Were you able to reproduce this or have any idea what might be the cause here? I’m looking to upgrade my 300-400 users to the new pytorch version but I need to figure this issue out first.</p>