How do I install and run pytorch in MSVS2017 (to avoid "module not found" error on "import torch" statement)?
I'm trying to use pytorch in MSVS2017.  I started a pytorch project, have anaconda environment set using python3.6, but when I run the debugger, I get a "module not found" error on the first import statement "import torch".  I've tried various methods for installing pytorch in a way that allows MSVS2017 to use it, including command line and Anaconda command line installations (using tips from other closely related StackOverflow questions), but I cannot clear the error.  This is a native MSVS2017 project type that came with their AI Tools module.  What am I doing wrong?

Probably, at the date of our MSVS2017 installation (esp. if prior to April 2018), there were no official .whl files for Windows pytorch (this has since changed).  Also, given the default installation pathway, permissions on Windows (or file lock access) may be a problem (for example, when attempting to install to the "c:\ProgramData" folder).  

The solution is to 1) ensure all pytorch requisites are installed first (for example, if, during your failed pytorch installation you get a "_____ requires _____ which is not installed, for example cython, then install cython) 2) avoid permission errors by using the --user switch, and 3) install directly from the online repository.  

So, at the environment command line (top right corner in the "Python Environments" tool) provide --user  http://download.pytorch.org/whl/cpu/torch-0.4.0-cp36-cp36m-win_amd64.whl.  

This operation will create and execute the command: pip install --user  http://download.pytorch.org/whl/cpu/torch-0.4.0-cp36-cp36m-win_amd64.whl.

Incidentally, you can install all packages at this environmental command line simply by typing the package name (e.g., cython, torchvision, scipy, etc...).
