Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Segmentation fault (core dumped) when launching python in anaconda

When I tried to create a virtual environment using miniconda command 'conda create -n py37 python=3.7', I encountered some problem when I tried to launch python in the virtual environment using command 'python'.

It seems python cannot be launched appropriately in the terminal. The error info is listed as followed:

(py37) bash-4.2$ python Python 3.7.13 (default, Oct 18 2022, 18:57:03) [GCC 11.2.0] :: Anaconda, Inc. on linux Type "help", "copyright", "credits" or "license" for more information. Segmentation fault (core dumped)

I tried several methods including creating another environment, using the command 'conda clean', even reinstall the miniconda3, but nothing works.

Everything seems to be normal under the python outside the conda env.

Anyone knows how to solve this problem?

like image 249
cassiee775 Avatar asked Oct 17 '25 06:10

cassiee775


1 Answers

You may try to change the LANG environment varialble, e.g

export LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8

Run into the same issue recently on a shared cluster. A user reported that he failed to open Python via ssh terminal, the dmesg log showed:

[22458809.093186] python[25221]: segfault at 0 ip 00002aceb37338c1 sp 00007ffd29f52528 error 4 in libc-2.17.so[2aceb35c4000+1c4000]

But when I use sudo -i -u to switch to his account and run the same command, everything is fine. By comparing the output of env in both cases I find that the LANG is different. It will fail to start Python if LANG=C.UTF-8, which can be fixed by updating to LANG=en_US.UTF-8.

It only happens to Python that installed by conda, Python installed by system doesn't have such issue.

like image 70
link89 Avatar answered Oct 19 '25 21:10

link89



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!