Visual Studio Code - no module name 'torch'

username: Liew_Shaun_Kheng
cooked: <p>Hi, I am very new to computer science and I need some help with importing torch into VSC. I am unsure why but I can only import torch in the terminal, not into the main.</p>
<p><div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/5/2/526e5ad40dc3101bc3c761c9a8b40632efbfb874.png" data-download-href="https://discuss.pytorch.org/uploads/default/526e5ad40dc3101bc3c761c9a8b40632efbfb874" title="1"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/5/2/526e5ad40dc3101bc3c761c9a8b40632efbfb874_2_690x365.png" alt="1" data-base62-sha1="bLdAn362sHa8BWwHhlSfNggx62E" width="690" height="365" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/5/2/526e5ad40dc3101bc3c761c9a8b40632efbfb874_2_690x365.png, https://discuss.pytorch.org/uploads/default/optimized/3X/5/2/526e5ad40dc3101bc3c761c9a8b40632efbfb874_2_1035x547.png 1.5x, https://discuss.pytorch.org/uploads/default/optimized/3X/5/2/526e5ad40dc3101bc3c761c9a8b40632efbfb874_2_1380x730.png 2x" data-dominant-color="282929"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">1</span><span class="informations">2618×1386 458 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div></p>

username: peterjc123
cooked: <p>You have two Python environments, one based on conda and other installed by VS. And PyTorch is installed in the first one. Since you are using VS Code, you could first install the Python extension (Press ctrl+shift+x and type in <code>Python</code>) and then in the left side of the status bar, it will let you select the preferred python environment.</p>

username: Liew_Shaun_Kheng
cooked: <p><div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/e/c/ec8467402c691f3c9bb1888d39950a857ea80bcb.png" data-download-href="https://discuss.pytorch.org/uploads/default/ec8467402c691f3c9bb1888d39950a857ea80bcb" title="image"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/e/c/ec8467402c691f3c9bb1888d39950a857ea80bcb_2_690x437.png" alt="image" data-base62-sha1="xKkm3PX1Qrff3OWBHq0agEVig2f" width="690" height="437" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/e/c/ec8467402c691f3c9bb1888d39950a857ea80bcb_2_690x437.png, https://discuss.pytorch.org/uploads/default/optimized/3X/e/c/ec8467402c691f3c9bb1888d39950a857ea80bcb_2_1035x655.png 1.5x, https://discuss.pytorch.org/uploads/default/optimized/3X/e/c/ec8467402c691f3c9bb1888d39950a857ea80bcb_2_1380x874.png 2x" data-dominant-color="262727"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">image</span><span class="informations">2415×1532 453 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div></p>
<p>I already have the python extension installed. Previously when I was trying out pytorch, it was working normally. Until when I was running some image recognition codes, It prompt me to install a few more extension (which I did), and after installing, my python env doesn’t detect torch anymore.</p>
<p>Any idea what happened?</p>

username: Shisho_Sama
cooked: <p>Change your Pthon env by clicking here and selecting the right one.<br>
<div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/f/4/f46a7437c14a2adbb2154d87c0397f970006ef1f.png" data-download-href="https://discuss.pytorch.org/uploads/default/f46a7437c14a2adbb2154d87c0397f970006ef1f" title="image"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/f/4/f46a7437c14a2adbb2154d87c0397f970006ef1f_2_690x42.png" alt="image" data-base62-sha1="ySczV8Eyqa6TiPOds0PPqrglIHd" width="690" height="42" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/f/4/f46a7437c14a2adbb2154d87c0397f970006ef1f_2_690x42.png, https://discuss.pytorch.org/uploads/default/optimized/3X/f/4/f46a7437c14a2adbb2154d87c0397f970006ef1f_2_1035x63.png 1.5x, https://discuss.pytorch.org/uploads/default/optimized/3X/f/4/f46a7437c14a2adbb2154d87c0397f970006ef1f_2_1380x84.png 2x" data-dominant-color="3F6076"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">image</span><span class="informations">1599×99 14 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div></p>

username: Liew_Shaun_Kheng
cooked: <p>Thank you so much! Really appreciate your help</p>

username: Electronic_Tears
cooked: <p>Hey I have the same problem and I got the base:conda but still doesn’t work.</p>
<p><img src="https://discuss.pytorch.org/uploads/default/original/3X/1/7/172498eda942205e18777ed779df9e524731500b.png" alt="image" data-base62-sha1="3iJogiJcOdBlxWr5pDgBurP9Rb5" width="343" height="80"></p>

username: Electronic_Tears
cooked: <p>Actually, nevermind it works now after I restarted.</p>

username: Ansh_Shah
cooked: <p>Hi, where exactly is this?</p>