0

I have Python 3.6 installed using Anaconda as the sole Python instance on my computer. Following the installation instructions on TensorFlow, I created a conda environment called tensorflow running Python 3.5, activated it and ran pip install --ignore-installed --upgrade tensorflow to install tensorflow. While inside the environment I am able to validate the installation by running import tensorflow, which works fine. To run my scripts in this environment in VS Code, I followed the instructions on configuring Python environments and selected the interpreter such that it corresponds to the conda environment I created. This adjusts the python path variable in VS Code's user settings accordingly.

{
    "window.zoomLevel": 2,
    "files.autoSave": "off",
    "workbench.colorTheme": "Abyss",
    "python.pythonPath": "C:\\Users\\osharaki\\Anaconda3\\envs\\tensorflow\\python.exe"
}

However, when I try to run a script inside VS Code that imports tensorflow I still receive the following error:

ModuleNotFoundError: No module named 'tensorflow'

The resource that came closest to answering my issue was this.

What am I missing?

Omar Sharaki
  • 360
  • 9
  • 34
  • What happens when you run `C:\Users\osharaki\Anaconda3\envs\tensorflow\python.exe -c "import tensorflow"`? – Brett Cannon Aug 09 '18 at 17:51
  • Runs, but gives the numpy warning "RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected 96, got 88 return f(*args, **kwds)" – Omar Sharaki Aug 10 '18 at 13:32
  • Have you tried "conda install tensorflow" or "conda upgrade tensorflow"? – Natsfan Aug 10 '18 at 16:28
  • No, I haven't. It might be worth mentioning that in Pycharm I am able to edit the configuration and select the interpreter to be the 'tensorflow' environment I created, which works fine. – Omar Sharaki Aug 11 '18 at 08:04
  • And how are you running the code? From the terminal or using "Run Python File in Terminal"? – Brett Cannon Aug 13 '18 at 21:15
  • I'm using Task Runner to run the code in VS Code. – Omar Sharaki Aug 14 '18 at 20:51
  • _I created a conda environment called tensorflow running Python 3.5, activated it and ran pip install --ignore-installed --upgrade tensorflow to install tensorflow._ Don't use pip in a Conda environment unless absolutely necessary, see for example https://www.anaconda.com/using-pip-in-a-conda-environment – AMC Apr 26 '20 at 22:13
  • Same problem here. I created a conda env but install packages with pip and VSCode can't find the packages... – srodriguex Jan 22 '21 at 19:39

0 Answers0