Search code examples
pythonpippytorchtorch

i deleted a package(pip), but it still works


Because of the problem of torch(2.0.1) module, I want to downgrade torch version. I deleted torch, install torch version 1.10.2, but still python was working with torch 2.0.1.

So I cleaned pip cache, delete all of pip package(including torch), uninstall python, and re-install python(3.9.7).

now in my computer, module 'torch' isn't installed, but below code is still working.

import torch
print(f"Torch Version: {torch.__version__}")
>>> Torch Version: 2.0.1+cpu

(vs code)

. .

C:\>pip uninstall torch
WARNING: Skipping torch as it is not installed.

(cmd)

what would i do?


Solution

  • This looks like a classic case of using the wrong Python.

    If you run the code with python main.py, for example, try python -m pip uninstall torch.

    This will force your pip uninstall command to use the same pip that you used when running your code.

    Bonus: python -m pip --version will also tell you exactly which Python it is using and where it's located in your filesystem.