pythonpycharmstreamlitvenv

Cannot import: `from serpapi import GoogleSearch`


I have this app in PyCharm (see screenshot). It won't run because of:

ImportError: cannot import name 'GoogleSearch' from 'serpapi' (/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/serpapi/init.py) Process finished with exit code 1

Has anybody faced this issue?

Invalidate Caches / Restart pycharm. Check my run configuration


Solution

  • The solution was to remove all system Python installations from my Mac (including the official Python binary and Brew python). Then create a run shell script configuration in PyCharm like this:

    source venv/bin/activate && streamlit run app/web/app.py