# Symbol not found in flat namespace (\_PyErr\_Clear) when build ParaView with python

**URL:** https://discourse.paraview.org/t/symbol-not-found-in-flat-namespace-pyerr-clear-when-build-paraview-with-python/13614
**Category:** ParaView Support
**Created:** [December 30, 2023, 5:59am UTC](https://discourse.paraview.org/t/symbol-not-found-in-flat-namespace-pyerr-clear-when-build-paraview-with-python/13614 "2023-12-30T05:59:24Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![zhe](https://discourse.paraview.org/user_avatar/discourse.paraview.org/zhe/32/2196_2.png) [@zhe](https://discourse.paraview.org/u/zhe)
#### Post date: [December 30, 2023, 5:59am UTC](https://discourse.paraview.org/t/symbol-not-found-in-flat-namespace-pyerr-clear-when-build-paraview-with-python/13614/1 "2023-12-30T05:59:24Z")

</div>

Hi, dear ParaView experts:  
I try to build ParaView based on document [here](https://github.com/Kitware/ParaView/blob/master/Documentation/dev/build.md), and I use MacOS. However, I got this error message when I execute paraview

```auto
$ ./paraview 
dyld[65137]: symbol not found in flat namespace (_PyErr_Clear)
Abort trap: 6

```

I also got similar error like this:

```auto
bin$ ./pvbatch 
dyld[65178]: symbol not found in flat namespace (_PyBool_FromLong)
Abort trap: 6

```

According some stackoverflow [answer](https://stackoverflow.com/questions/35006614/what-does-symbol-not-found-expected-in-flat-namespace-actually-mean), I guess there are some issues with python or CPython on my device, but I do not have more ideas to find the root reasons about it.

Maybe I need to remove some package or reinstall some packages.

Here are my brew list results:

```auto
$ brew list
==> Formulae
abseil gettext json-c libpthread-stubs	libxpm openexr re2
aom gflags jsoncpp librttopo libxrender openjdk readline
apache-arrow giflib krb5 libsm libxt openjpeg shared-mime-info
assimp glib libaec libspatialite little-cms2 openldap snappy
aws-sdk-cpp glog libarchive libtasn1 llvm openssl@1.1 sqlite
brotli gmp libassuan libtiff lz4 openssl@3 swig
bzip2 gnupg libb2 libtool lzo p11-kit tbb
c-ares gnutls libde265 libunistring m4 pcre thrift
ca-certificates gpgme libevent libusb md4c pcre2 unbound
cairo graphite2 libgcrypt libuv mesa pinentry unixodbc
cfitsio grpc libgeotiff libvmaf minizip pixman uriparser
cmake harfbuzz libgpg-error libx11 mpdecimal pkg-config utf8proc
dbus hdf5 libheif libxau mpfr pmix webp
double-conversion	hexo libice libxaw netcdf poppler x265
epsilon highway libidn2 libxcb nettle popt xerces-c
expat hunspell libkml libxdamage ninja proj xorgproto
fontconfig hwloc libksba libxdmcp node protobuf xterm
freetype icu4c liblerc libxext npth pyqt@5 xz
freexl imath libmng libxfixes nspr python-setuptools	z3
gcc isl libmpc libxft nss python@3.12 zstd
gdal jasper libnghttp2 libxinerama numpy qhull
gdbm jpeg-turbo libpng libxml2 open-mpi qt@5
geos jpeg-xl libpq libxmu openblas rapidjson

```

Here are python related parameter in CMakeCache:

```auto
build_paraview$ cat CMakeCache.txt |grep python
Python3_EXECUTABLE:FILEPATH=/Users/zhewang/opt/anaconda3/bin/python3.9
Python3_INCLUDE_DIR:FILEPATH=/Users/zhewang/opt/anaconda3/include/python3.9
Python3_LIBRARY:FILEPATH=/Users/zhewang/opt/anaconda3/lib/libpython3.9.dylib
//Whether to link libpython from libraries or not
python:BOOL=OFF
FIND_PACKAGE_MESSAGE_DETAILS_Python3:INTERNAL=[/Users/zhewang/opt/anaconda3/bin/python3.9][/Users/zhewang/opt/anaconda3/include/python3.9][cfound components: Interpreter Development.Module Development.Embed][v3.9.12(3.4)]
_Python3_EXECUTABLE:INTERNAL=/Users/zhewang/opt/anaconda3/bin/python3.9
_Python3_INCLUDE_DIR:INTERNAL=/Users/zhewang/opt/anaconda3/include/python3.9
_Python3_INTERPRETER_PROPERTIES:INTERNAL=Python;3;9;12;64;;cpython-39-darwin;abi3;/Users/zhewang/opt/anaconda3/lib/python3.9;/Users/zhewang/opt/anaconda3/lib/python3.9;/Users/zhewang/opt/anaconda3/lib/python3.9/site-packages;/Users/zhewang/opt/anaconda3/lib/python3.9/site-packages
_Python3_LIBRARY_RELEASE:INTERNAL=/Users/zhewang/opt/anaconda3/lib/libpython3.9.dylib

```

Could you provide some suggestions for solving this issue?  
Thanks a lot for the help!

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.paraview.org/u/ben.boeckel)
#### Post date: [January 1, 2024, 4:37pm UTC](https://discourse.paraview.org/t/symbol-not-found-in-flat-namespace-pyerr-clear-when-build-paraview-with-python/13614/2 "2024-01-01T16:37:42Z")

</div>

The binaries should have `libpython3.9.dylib` in their load commands. Do you see them if you run:

```auto
otool -l bin/paraview

```

Same with related binaries.

---

<div class="post-metadata">

### Author: ![zhe](https://discourse.paraview.org/user_avatar/discourse.paraview.org/zhe/32/2196_2.png) [@zhe](https://discourse.paraview.org/u/zhe)
#### Post date: [January 1, 2024, 4:46pm UTC](https://discourse.paraview.org/t/symbol-not-found-in-flat-namespace-pyerr-clear-when-build-paraview-with-python/13614/3 "2024-01-01T16:46:10Z")

</div>

Thanks for the information. I found that I mixed the conda env with homebrew, when I exit the conda env, and rebuild the paraview, it can build and run normally. Maybe there are some conflicts between python under conda and python under homebrew previously. Thanks for the help!

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.paraview.org/u/ben.boeckel)
#### Post date: [January 1, 2024, 4:54pm UTC](https://discourse.paraview.org/t/symbol-not-found-in-flat-namespace-pyerr-clear-when-build-paraview-with-python/13614/4 "2024-01-01T16:54:27Z")

</div>

Yes, that’s certainly a possible cause. Not all Python distributions are compatible with each other (sadly).
