Symbol not found in flat namespace (_PyErr_Clear) when build ParaView with python

Hi, dear ParaView experts:
I try to build ParaView based on document here, and I use MacOS. However, I got this error message when I execute paraview

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

I also got similar error like this:

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

According some stackoverflow answer, 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:

$ 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:

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!

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

otool -l bin/paraview

Same with related binaries.

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!

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