Symbol lookup error in /usr/bin/python3 "_Py_CoerceLegacyLocale" in new Fedora 27

Viewed 12477

Thanks for your patience, this question has not been answered anywhere on the internet and I am unable to find any clues on how to fix it. The problem is:

[jv@xp ~]$ /usr/bin/python3
/usr/bin/python3: symbol lookup error: /usr/bin/python3: undefined symbol: _Py_CoerceLegacyLocale

Before this happened I was fixing problems with anaconda3 python environments so there may be a connection there.

It is the new Fedora 27 system python3 that all the packaging systems(yum, dnf) depends on, so if I am unable to fix it, it is probably better to re-install the whole system.(Which will probably mean that with a face of defeat, looking down I ll go back to mint :-/ )

Here this gentleman is battling the same problem:

https://forums.fedoraforum.org/showthread.php?316109-f26-DNF-error-undefined-symbol-_Py_CoerceLegacyLocale

Thanks for your help. Any clues and advice will be greatly appreciated.

2 Answers

I had the same problem after installing python3 via conda. What I did to solve this problem was to :

1/ Reinstall python3, python3-libs and system-python with the following command :

python2 /usr/bin/yum reinstall python3-libs

(note that you can still run dnf and yum with python2, assuming that only python3 was broken)

2/ Remove the following files :

  • /usr/lib/libpython3.so
  • /usr/lib/libpython3.6m.so
  • /usr/lib/libpython3.6m.so.1.0

The command rpm -qf libpython3.6m.so says that those files do not belong to any package. They were surely installed via conda. The problem was that the python3 executable loaded these shared libraries instead of the good ones.

While conda update intel-openmp didn't work for me;

conda install --channel conda-forge llvm-openmp worked for me.

Related