Pinecone.init( ^^^^^^^^^^^^^ AttributeError: partially initialized module 'pinecone' has no attribute 'init' (most likely due to a circular import)

Hi everyone this error occures when i run my code in VS code or in Pycharm

In google colab it works well
error is it this portion of my code

import pinecone
pinecone.init(
api_key=pinecone_api_key, # find at app.pinecone.io
environment=pinecone_environment, # next to api key in console
)

This usually happens if you have more than one module named “pinecone” in your path. I suggest using virtual environments to avoid the issue entirely.

Hello, I am facing the same kind of error:
AttributeError: module ‘pinecone’ has no attribute ‘init’

This error suddenly popped up today when I was re-running the same old code which was running perfectly fine till yesterday evening, in the Google Colab.

The solutions which I tried to resolve my error are:

  1. Uninstalling the pinecone-client via pip command

  2. Re-installing the pinecone-client[grpc] via pip command

  3. Uninstalling the pinecone-client

  4. Re-installing the pinecone-client==3.0.0

Till now, none of the above solutions worked for me.

Is there anything that has been changed, that I need to address while installing or uninstalling the pinecone?

1 Like

Hi all,
I had the same problem and it looks like the library changed. Check out:

This worked for me:

from pinecone import Pinecone
pc = Pinecone(api_key=api_key)
index = pc.Index(host='<host>')

Hope this helps someone out there, was a real head scratcher for me

2 Likes

yep this worked for me as well.