ModuleNotFoundError when importing scipy and pingouin modules

I am building an app to run some statistical tests on a data set that is imported. I’d like to use SciPy and Pingouin to run these tests. I have set up a new environment for the work, and have confirmed the required libraires are installed by checking the environment in Anaconda prompt. I’ve also been able to successfully import those libraries when using that environment, within a notebook situation of VS Code. However, when I import the libraries in main.py (the file with the streamlit code) I get a ModuleNotFoundError.

I’ve tried 3 approaches and have had a ModuleNotFoundError with each one. The approaches I’ve tried are:

  1. import SciPy within the main.py streamlit file, launching / running main.py within VS Code.
  2. import SciPy within a separate functions.py file, create functions using SciPy in that functions.py file, and then importing that function.py file into main.py, launching / running main.py within VS Code.
  3. Launching / running main.py from within Anaconda Prompt directly (with the required environment activated).

Has anyone else encountered this / analogous issue, if so, I’ve love to hear from you and how you solved it as I’m a bit stuck (!). Thanks.

From a distance, I can only guess. But usually such errors occur when you accidentally or unnoticed work in another python (virtual) environment.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.