title: VS Code: ModuleNotFoundError: No module named 'sklearn'
body: <p>I am working in VS Code to run a Python script in <code>conda</code> environment named <code>myenv</code> where  <code>sklearn</code> is already installed. However when I import it and run the script I get the following error:</p>
  <pre><code>Traceback (most recent call last):
    File &quot;d:\ML\Project\src\train.py&quot;, line 5, in &lt;module&gt;
      from sklearn.linear_models import LinearRegression
  ModuleNotFoundError: No module named 'sklearn'
  </code></pre>
  <p>I have tried all possible solutions suggested in the following but nothing worked for me:</p>
  <ul>
  <li><a href="https://stackoverflow.com/questions/46113732/modulenotfounderror-no-module-named-sklearn/52521214">ModuleNotFoundError: No module named 'sklearn'</a></li>
  <li><a href="https://www.researchgate.net/post/ModuleNotFoundError_No_module_named_sklearn_check_build_check_build" rel="nofollow noreferrer">ModuleNotFoundError: No module named 'sklearn.__check_build._check_build'?</a></li>
  <li><a href="https://stackoverflow.com/questions/15274696/importerror-in-importing-from-sklearn-cannot-import-name-check-build">ImportError in importing from sklearn: cannot import name check_build</a></li>
  <li><a href="https://github.com/scikit-learn/scikit-learn/issues/8754" rel="nofollow noreferrer">importError: cannot import name __check_build #8754</a></li>
  </ul>
  <p>Can someone suggest a different way to fix this?</p>