I have a problem where I am trying to use PyCharm for PyTorch. I have installed Python separately (quite a task as it tried to install it in the Microsoft/AppData folder?).
In PyCharm, I have to first manually set the Python.exe location, which is not apparent.
Then, it does not recognize any packages I installed before, I have to reinstall these from the Python Interpreter setting in PyCharm.
Okay this works.
Now however, I try to confirm PyTorch is running on my system. However, when I run command prompt, even after setting my directory to the same exact Python.exe location (this time in Program Files), I am only getting error after error trying to load PyTorch.
Example of an error in Powershell:
Installing collected packages: mpmath, typing-extensions, sympy, setuptools, pillow, numpy, networkx, MarkupSafe, fsspec, filelock, jinja2, torch, torchvision
━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2/13 [sympy] WARNING: The script isympy.exe is installed in 'C:\Users\alexa\AppData\Roaming\Python\Python314\Scripts' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
━━━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━ 5/13 [numpy] WARNING: The scripts f2py.exe and numpy-config.exe are installed in 'C:\Users\alexa\AppData\Roaming\Python\Python314\Scripts' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╸━━━━━━ 11/13 [torch] WARNING: The scripts torchfrtrace.exe and torchrun.exe are installed in 'C:\Users\alexa\AppData\Roaming\Python\Python314\Scripts' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed MarkupSafe-2.1.5 filelock-3.19.1 fsspec-2025.9.0 jinja2-3.1.6 mpmath-1.3.0 networkx-3.5 numpy-2.3.3 pillow-11.3.0 setuptools-70.2.0 sympy-1.14.0 torch-2.9.1+cu126 torchvision-0.24.1+cu126 typing-extensions-4.15.0
PS C:\Program Files\Python314> import torch
import : The term 'import' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ import torch
+ ~~~~~~
+ CategoryInfo : ObjectNotFound: (import:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
What am I doing wrong?
Thanks.