"no module named torch". But installed pytorch 1.3.0 with conda in Ubuntu 18.04.02 Server Edition
installed pytorch with conda :

(base) (3.8.0/envs/my_virtual_env-3.8.0) marco@pc:~/facenet_pytorch/examples$ conda install  
pytorch torchvision cpuonly -c pytorch
Collecting package metadata (current_repodata.json): done
Solving environment: done

# All requested packages already installed.


I updated conda:

(base) (3.8.0/envs/my_virtual_env-3.8.0) marco@pc:~/facenet_pytorch/examples$ conda update 
conda
Collecting package metadata (current_repodata.json): done
Solving environment: done

# All requested packages already installed.


Installed mkl=2019 :   

(base) (3.8.0/envs/my_virtual_env-3.8.0) marco@pc:~/facenet_pytorch/examples$ conda install  
mkl=2019
Collecting package metadata (current_repodata.json): done
Solving environment: done

# All requested packages already installed.

(base) (3.8.0/envs/my_virtual_env-3.8.0) marco@pc:~/facenet_pytorch/examples$ conda list | grep 
torch
cpuonly                   1.0                           0    pytorch
facenet-pytorch           0.1.0                    pypi_0    pypi
pytorch                   1.3.0               py3.7_cpu_0  [cpuonly]  pytorch
torchfile                 0.1.0                    pypi_0    pypi
torchvision               0.4.1                  py37_cpu  [cpuonly]  pytorch


But it still says "no module torch" :  

(base) (3.8.0/envs/my_virtual_env-3.8.0) marco@pc:~/facenet_pytorch/examples$ python3
Python 3.8.0 (default, Oct 30 2019, 16:20:23) 
[GCC 7.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
&gt;&gt;&gt; import torch
Traceback (most recent call last):
  File "&lt;stdin&gt;", line 1, in &lt;module&gt;
ModuleNotFoundError: No module named 'torch'
&gt;&gt;&gt; 


I discovered that the problem appears only with python 3.8.0 version

(base) marco@pc:~/facenet_pytorch$ python3
Python 3.7.3 (default, Mar 27 2019, 22:11:17) 
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
&gt;&gt;&gt; import torch
&gt;&gt;&gt; 


Ubuntu 18.04.02 Server Edition

Or, may be, it's just a matter of python environments, as you said.
But I do not understand why just activating conda environment, with "conda activate", it doesn't work

Marco

First create a Conda environment using:

conda create -n pytorch_env python=3 ( you can create with any python version )


Activate the environment using:

conda activate pytorch_env


Now install PyTorch using:

conda install pytorch-cpu torchvision -c pytorch


Go to python shell and import using the command:

import torch

