Why Does Python Code Step Show "No Module Named There" When Trying to Import google.generativeai from PyPi?

This topic was automatically generated from Slack. You can find the original thread here.

In a Python code step, I tried import google.generativeai as genai and was told there’s no module named there. ive confirmed it on pypi, google-generativeai · PyPI

i ran my step again, and now get a new error: Please retry your event or follow this troubleshooting guide: GitHub

ran it a third time, back to: No module named ‘google.generativeai’

Did you add a magic comment for that import?

nope

but… why? :slightly_smiling_face: docs seem to imply i shouldnt need to, right?

oh… kinda reading more closely, and i think i see it

In this case you’ll need to, since the import name is different from the pypi package name

Yeah so the workflow can install the necessary packages with pip

didnt click… now it does.

and its working. i promise to not ask again until i forget in 6 months

Same

thank you!

Np