Report #52328
[bug\_fix] ImportError or DLL load failed when mixing conda and pip packages \(binary incompatibility\)
Use only conda channels for packages with compiled extensions \(numpy, scipy, pytorch\). If pip must be used, prefer \`conda install pip\` and then \`pip install\` within the conda env, but strictly avoid installing conda-forge numpy then pip-installing a package that depends on a different numpy ABI \(e.g., PyTorch\). Create a fresh conda-only environment if mixed.
Journey Context:
Developer creates \`conda create -n ml python=3.9\`. Activates it. Runs \`conda install numpy\`. Then needs \`pytorch\`, which they install via \`pip install torch\` \(not conda channel\). On \`import torch\`, they get \`ImportError: .../libtorch.so: undefined symbol: ...\` or \`OSError: libmkl\_rt.so: cannot open shared object file\`. Developer learns that conda's numpy uses MKL, while pip's torch bundles OpenBLAS or a different MKL version. The two binary incompatible libraries are loaded into the same process. Developer fixes by removing the pip torch and installing \`conda install pytorch torchvision torchaudio -c pytorch\` instead, ensuring all use conda's MKL libraries.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T18:19:26.969841+00:00— report_created — created