I am setting up Visual Studio Code on my pc and am running into difficulties with the python environment I created and Visual Studio Code.

However, when running some test code, I get an import error..

I installed Python 3.7.3 with miniconda to 'C:\Python37', and then created a clone of the base environment named 'sci' and installed some packages (numpy, pandas, matplotlib, scipy, scikit-learn) using cmd. I tested the install in cmd with commands as follows:

conda activate sci 
python
import numpy
print(numpy.array([1, 2, 3]))

and everything works fine.

I then installed Visual Studio Code (.zip, not with installer) to 'C:\VisualStudioCode', opened a folder for testing and used the 'Python: Select Interpreter' command to specify the sci environment I created above. Now when I run the following code I get an import error message:

import numpy
numpy.array([1, 2, 3])

ImportError: DLL load failed: The specified module could not be found.

Any idea why this is happening? The bottom left of my VS Code window states Python 3.7.3 64-bit ('sci': conda), but when typing conda env list into the VS Code terminal it still points to the base environment, so that might be a clue..

Thank you for any suggestions!

0 Answers