groq / groq-python

The official Python Library for the Groq API
Apache License 2.0
353 stars 23 forks source link

ImportError: cannot import name 'Groq' from partially initialized module 'groq' (most likely due to a circular import) #30

Closed smcady closed 4 months ago

smcady commented 4 months ago

After fresh install in a new codespace environment, I attempted to run your chat_completion_streaming.py example and received the following error:

Traceback (most recent call last):
  File "/workspaces/codespaces-flask/groq.py", line 1, in <module>
    from groq import Groq
  File "/workspaces/codespaces-flask/groq.py", line 1, in <module>
    from groq import Groq
ImportError: cannot import name 'Groq' from partially initialized module 'groq' (most likely due to a circular import) (/workspaces/codespaces-flask/groq.py)

I know this is typically due to a circular reference, but I am not understanding at all, why that would be the case.
Thanks in advance!

LukasNel commented 4 months ago

Your file is named groq.py, which conflicts with the module groq - rename it to something like groq_test.py

smcady commented 4 months ago

Ahh, there it is. Thanks @LukasNel!