Thanks so much!
I don’t know if this is too much to look at, but here is a bit of an interactive session I had just now trying some of the above commands. I find that in my newly fabricated conda environment I don’t have access to the GPU. Same thing in system Python3. Only in Python2 do I have access to the GPU.
I’m not sure what to do.
Thank you for all your help!
senecawolf@tensorbook:~/Desktop/test-project$ conda info --envs
# conda environments:
#
base * /home/senecawolf/miniconda3
pytorch /home/senecawolf/miniconda3/envs/pytorch
senecawolf@tensorbook:~/Desktop/test-project$ conda activate pytorch
(pytorch) senecawolf@tensorbook:~/Desktop/test-project$ which python
/home/senecawolf/miniconda3/envs/pytorch/bin/python
(pytorch) senecawolf@tensorbook:~/Desktop/test-project$ python
Python 3.9.12 (main, Jun 1 2022, 11:38:51)
[GCC 7.5.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> import torch
>>> print ('\nPytorch versions:', torch.__version__)
Pytorch versions: 1.12.0
>>> torch.version
<module 'torch.version' from '/home/senecawolf/miniconda3/envs/pytorch/lib/python3.9/site-packages/torch/version.py'>
>>> print (torch.version)
<module 'torch.version' from '/home/senecawolf/miniconda3/envs/pytorch/lib/python3.9/site-packages/torch/version.py'>
>>> torch._C._cuda_getCompiledVersion()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 'torch._C' has no attribute '_cuda_getCompiledVersion'
>>> print(”\ntorch",torch.file)
File "<stdin>", line 1
print(”\ntorch",torch.file)
^
SyntaxError: invalid character '”' (U+201D)
>>> print (torch.file)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 'torch' has no attribute 'file'
>>> torch.__file__
'/home/senecawolf/miniconda3/envs/pytorch/lib/python3.9/site-packages/torch/__init__.py'
>>> torch.cuda.is_available()
False
>>> device = torch.device(‘cuda’ if torch.cuda.is_available() else ‘cpu’)
File "<stdin>", line 1
device = torch.device(‘cuda’ if torch.cuda.is_available() else ‘cpu’)
^
SyntaxError: invalid character '‘' (U+2018)
>>> torch.device('cuda' if torch.cuda.is_available() else 'cpu')
device(type='cpu')
>>> torch.cuda.get_device_name(device)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'device' is not defined
>>> device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
>>> torch.cuda.get_device_name(device)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/senecawolf/miniconda3/envs/pytorch/lib/python3.9/site-packages/torch/cuda/__init__.py", line 329, in get_device_name
return get_device_properties(device).name
File "/home/senecawolf/miniconda3/envs/pytorch/lib/python3.9/site-packages/torch/cuda/__init__.py", line 359, in get_device_properties
_lazy_init() # will define _get_device_properties
File "/home/senecawolf/miniconda3/envs/pytorch/lib/python3.9/site-packages/torch/cuda/__init__.py", line 211, in _lazy_init
raise AssertionError("Torch not compiled with CUDA enabled")
AssertionError: Torch not compiled with CUDA enabled
>>>
[6]+ Stopped python
(pytorch) senecawolf@tensorbook:~/Desktop/test-project$ conda deactivate
senecawolf@tensorbook:~/Desktop/test-project$ python3
Python 3.8.10 (default, Jun 22 2022, 20:18:18)
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'torch'
>>> device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
[7]+ Stopped python3
senecawolf@tensorbook:~/Desktop/test-project$ python
Python 2.7.18 (default, Jul 1 2022, 12:27:04)
[GCC 9.4.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
>>> torch.cuda.get_device_name(device)
u'NVIDIA GeForce RTX 2070 with Max-Q Design'
>>>
[8]+ Stopped python
senecawolf@tensorbook:~/Desktop/test-project$