Search code examples
pythonimportmodulepycharmpython-3.10

Pycharm unable to find dotenv even though I installed it


I downloaded python-dotenv successfully using pip but for some reason pycharm doesnt detect it when I do import dotenv even though I added the package manually to pycharm by doing File > Settings > Project > Python Interpreter > + > python-dotenv > Install Package in which pycharm says it has successfully downloaded python-dotenv. I tried doing import python-dotenv but python mistakes python and dotenv as separate packages so it doesn't work. Am I just getting the package name wrong? I tried using the inbuilt package installer for pycharm but it gives me an error saying it can't find dotenv which is probably is because it says it executed the command pip install dotenv to install the package. Also I tried closing pycharm and opening it again but that doesn't fix the problem too.


Solution

  • Found out the problem, I just uninstalled python-dotenv using pip and reinstalled it. Actually saw this solution on the internet but it said to also uninstall dotenv which I did first, and pip said it couldn't find it so I thought the solution wouldn't work and gave up lol.