In Ubuntu 18.04.02 Desktop I’m trying to install pytorch from source:
(base) marco@marco-U36SG:~$ conda install numpy ninja pyyaml mkl mkl-include     
setuptools cmake cffi typing
Collecting package metadata (current_repodata.json): done
Solving environment: done

# All requested packages already installed.

(base) marco@marco-U36SG:~$ git clone --recursive https://github.com/pytorch
/pytorch
Cloning into 'pytorch'...
remote: Enumerating objects: 18, done.
remote: Counting objects: 100% (18/18), done.

(base) marco@marco-U36SG:~/pytorch$ git submodule sync
Synchronizing submodule url for 'third_party/FP16'
Synchronizing submodule url for 'third_party/FXdiv'
Synchronizing submodule url for 'third_party/NNPACK'
Synchronizing submodule url for 'third_party/QNNPACK'
Synchronizing submodule url for 'third_party/benchmark'

(base) marco@marco-U36SG:~/pytorch$ git submodule update --init --recursive

(base) marco@marco-U36SG:~/pytorch$ export 
CMAKE_PREFIX_PATH=${CONDA_PREFIX:-"$(dirname $(which conda))/../"}

(base) marco@marco-U36SG:~/pytorch$ export "USE_CUDNN=0"

But the installation step gives errors:
(base) marco@marco-U36SG:~/pytorch$ python setup.py install

CMake Warning at modules/detectron/CMakeLists.txt:34 (add_library):
 Cannot generate a safe runtime search path for target caffe2_detectron_ops
 because files in some directories may conflict with libraries in implicit
 directories

[521/2706] Building CXX object third_party/ideep/mkl-dnn/src/CMakeFiles/mkldnn.dir
/cpu/cpu_barrier.cpp.o
ninja: build stopped: subcommand failed.
I tried also with python3:
(base) marco@marco-U36SG:~/pytorch$ python3 setup.py install
Building wheel torch-1.3.0a0+5254b12
-- Building version 1.3.0a0+5254b12
cmake --build . --target install --config Release -- -j 4

../third_party/ideep/mkl-dnn/src/common/utils.cpp: In function ‘int    
mkldnn::impl::mkldnn_getenv(char*, const char*, int)’:
../third_party/ideep/mkl-dnn/src/common/utils.cpp:46:34: note: length computed here
   46 |             value_length = strlen(buffer);
      |                            ~~~~~~^~~~~~~~

I attached the file containing the complete log:
pytorchInstallationIssueUbuntu18.04DesktopFullLog.txt 3
Looking forward to your kind help.
Marco