sklearn module not found when using VSCode, but works fine in Jupyter Notebook?
If you are sure you have installed the sklearn package, but you still get the ModuleNotFoundError error message. In most cases you must not choose the corresponding interpreter. Or your sklearn package is not installed in the current python environment.
Please use the pip show sklearn command to view the installation information of sklearn. Make sure to choose the correct interpreter.
Or activate the environment you want to use and install the sklearn package using the pip install sklearn command.
I have looked at several questions and tried their respective answers, but I cannot seem to understand why VSCode is unable to find the sklearn module.
I use a virtual conda environment called ftds, in which I have scikit-learn successfully show up when I run conda list. In jupyter notebook, I use the same ftds environment and sklearn works fine. In VSCode, I keep getting the ModuleNotFoundError: No module named 'sklearn' error message.
I ensure I have activated my conda environment using conda activate ftds prior to running my code. I also ensure that scikit-learn was successfully installed into the ftds environment using conda. I have the latest version, which is version 1.1.1 at the time of this question.
For further information, I am using MacOS Monterey (Version 12.5). Has anyone had the same issue? I am only able to find those who had issues with jupyter notebook, which is the opposite of my problem.
I have already selected the ftds environment as the python interpreter in VSCode. Other packages like pandas, numpy, etc. are all functioning as normal.