ERJAN
ERJAN

Reputation: 24500

how to see where exactly torch is installed pip vs conda torch installation

On my machine i can't "pip install torch" - i get infamous "single source externally managed error" - i could not fix it and used "conda install torch" from anaconda.

Still, checking version is easy - torch.__version__

But how to see where is it installed -the home dir of torch? Suppose if I had had both torches installed via pip and conda - how to know which one is used in a project?

import torch
print(torch__version__)

Upvotes: 7

Views: 26485

Answers (3)

Faisal shahzad
Faisal shahzad

Reputation: 398

If you have already installed PyTorch library, then open Google Colab, paste following code and hit the run button:

import torch
print(torch.__file__)

then you see version of PyTorch.

If it is not working then please go to https://pytorch.org/get-started/locally/ and follow the instruction about how to install PyTorch because sometimes Python and PyTorch have dependencies issues.

Upvotes: 2

Mughees
Mughees

Reputation: 953

pip show torch at terminal will give you all the required information.

Name: torch
Version: 1.3.1
Summary: Tensors and Dynamic neural networks in Python with strong GPU acceleration
Home-page: https://pytorch.org/
Author: PyTorch Team
Author-email: [email protected]
License: BSD-3
Location: c:\programdata\anaconda3\lib\site-packages
Requires: numpy
Required-by: torchvision, torchtext, efficientunet-pytorch

Upvotes: 6

Grigor Poghosyan
Grigor Poghosyan

Reputation: 336

You can get torch module location which is imported in your script

import torch
print(torch.__file__)

Upvotes: 14

Related Questions