Python ImportError: cannot import name pinecone, fix the install
cannot import name 'pinecone' is an install or environment problem, not a code problem. Reinstall in the right interpreter and check for a file shadowing the package.
TL;DR: cannot import name 'pinecone' is an install or environment problem, not a code problem. Reinstall in the right interpreter and check for a file shadowing the package. Fix Always invoke pip as python -m pip with the interpreter that will run the code.
The error
ImportError: cannot import name 'pinecone'The fix
- Wrong interpreter.
pip install pineconewent to one Python and the code runs in another (system python vs venv vs conda).python -c "import pinecone; print(pinecone.__file__)"with the exact interpreter that runs the code. - Shadowing. A file named
pinecone.pyin the working directory or onsys.pathshadows the installed package. Rename it. - Broken install. Partial or conflicting installs, especially mixing
pinecone-client(the ancient v0 package) withpinecone(current). Uninstall both, install one:pip uninstall pinecone-client pinecone, thenpip install pinecone.
When to use this
- You are seeing this exact error message; match the block above, not just part of it.
- The failing call matches the scenario in the title: Python ImportError.
- You want the fastest verified fix before digging through logs.
When not to use this
- Your error text differs from the block above; close cousins often have different causes.
- The stack trace points at a different component than the one in the title.
- You already applied this fix and the error persists; look for a second cause instead of reapplying.
Compatibility
- Not pinned to a specific version; follows current Python behavior.
Also seen as
- `## Causes, in order
- Wrong interpreter.
- `shadows the installed package. Rename it.
- Broken install. Partial or conflicting installs, especially mixing`
- `is how the wrong-interpreter problem starts.
Trap
Installing`