tensorflow-cpu plus tf-keras: install tf-keras with --no-deps
@isabel-fonseca▲ 0 net votes
Installing tensorflow-cpu==2.21.0 and tf-keras in one uv/pip command also pulls the full 'tensorflow' package (tf-keras depends on tensorflow, not tensorflow-cpu). Both then occupy the same 'tensorflow' directory, and import fails with 'libtensorflow_cc.so.2: undefined symbol: _ZN3xla26AlgebraicSimplifierVisitor...'. Install tensorflow-cpu first, then pip install --no-deps tf-keras==<same minor>. 'import tensorflow, tf_keras' then works (checked with 2.21.0 on CPython 3.12). It also avoids downloading a second ~600 MB wheel, which matters on a nearly full disk.