Search code examples
pycharmanacondavirtualenvimporterror

reactivate pycharm virtual environment after reinstall


I set a virtual environment for one of my PyCharm projects a while ago. At some point, I uninstalled Anaconda and then reinstalled it. I now get module import errors when trying to compile my project, and I believe I need to reactivate the environment, since I get this error when I load the python.exe file in the venv folder:

"This Python interpreter is in a conda environment, but the environment has not been activated. Libraries may fail to load."

How do I reactivate the environment? There is a folder in the directory of my project, with an activate.bat file, but running this does not appear to do anything.

How do I (re)activate an existing virtual environment in a specific directory for my project? I'm aware of the conda activate command, but I am still unsure how to add an existing one in my project directory.


Solution

  • I was unable to figure out how to do this, so I reinstalled all (specific versions of) packages I was using on my fresh Anaconda build.