Repository: pytorch
Issue: Install doesn't work with spaces in directory
Labels: todo,module: build,triaged,has workaround

PyTorch GitHub Issues Guidelines
--------------------------------

We like to limit our issues to bug reports and feature requests. If you have a question or would like help and support, please visit our forums: https://discuss.pytorch.org/

If you are submitting a feature request, please preface the title with [feature request].

When submitting a bug report, please include the following information (where relevant):
- OS:  macOS Sierra version 10.12.4
- PyTorch version: 
    - master, commit a3bd7b2875a1559cdbea9f6b3d15ac2dfa4655cc
    - v0.3.1, downloaded from https://github.com/pytorch/pytorch/releases/tag/v0.3.1
    - v0.3.1, via cloning entire repo and typing `git checkout v0.3.1`
- How you installed PyTorch (conda, pip, source): source
- Python version: 3.6.4
- CUDA/cuDNN version: 
- GPU models and configuration: Intel HD Graphics 3000 384 MB
- GCC version (if compiling from source):  I have CLANG installed, not GCC (Apple XCode installs gcc as a link to clang):

$ gcc -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/c++/4.2.1
Apple LLVM version 8.1.0 (clang-802.0.42)
Target: x86_64-apple-darwin16.5.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin


In addition, including the following information will also be very helpful for us to diagnose the problem:
- A script to reproduce the bug. Please try to provide as minimal of a test case as possible.
- Error messages and/or stack traces of the bug
- Context around what you are trying to do


I am trying to install Pytorch from source. I get an error from `make` when I try to do so; see below. 


```bash
(pyro) dhcp-18-189-61-137:pyro_experiments blake$ export NO_CUDA=1
(pyro) dhcp-18-189-61-137:pyro_experiments blake$ which conda
/Users/blake/anaconda/envs/pyro/bin/conda
(pyro) dhcp-18-189-61-137:pyro_experiments blake$ export CMAKE_PREFIX_PATH=/Users/blake/anaconda/
(pyro) dhcp-18-189-61-137:pyro_experiments blake$ conda install numpy pyyaml setuptools cmake cffi typing
Fetching package metadata .............
Solving package specifications: .

Package plan for installation in environment /Users/blake/anaconda/envs/pyro:

The following NEW packages will be INSTALLED:

    bzip2:        1.0.6-hd86a083_4     
    cffi:         1.11.5-py36h342bebf_0
    cmake:        3.9.4-h30c3106_0     
    curl:         7.58.0-ha441bb4_0    
    expat:        2.2.5-hb8e80ba_0     
    intel-openmp: 2018.0.0-h8158457_8  
    libcurl:      7.58.0-hf30b1f0_0    
    libgfortran:  3.0.1-h93005f0_2     
    libssh2:      1.8.0-h322a93b_4     
    libuv:        1.19.2-hfd94794_0    
    mkl:          2018.0.1-hfbd8650_4  
    numpy:        1.14.2-py36ha9ae307_0
    pycparser:    2.18-py36h724b2fc_1  
    pyyaml:       3.12-py36h2ba1e63_1  
    rhash:        1.3.5-h3aa0507_1     
    typing:       3.6.4-py36_0         
    yaml:         0.1.7-hc338f04_2     

Proceed ([y]/n)? y

bzip2-1.0.6-hd 100% |#####################################################| Time: 0:00:00   7.20 MB/s
libuv-1.19.2-h 100% |#####################################################| Time: 0:00:00   8.98 MB/s
rhash-1.3.5-h3 100% |#####################################################| Time: 0:00:00  13.90 MB/s
yaml-0.1.7-hc3 100% |#####################################################| Time: 0:00:00   7.94 MB/s
expat-2.2.5-hb 100% |#####################################################| Time: 0:00:00  13.88 MB/s
libssh2-1.8.0- 100% |#####################################################| Time: 0:00:00  11.75 MB/s
libcurl-7.58.0 100% |#####################################################| Time: 0:00:00  11.30 MB/s
curl-7.58.0-ha 100% |#####################################################| Time: 0:00:00  12.83 MB/s
cmake-3.9.4-h3 100% |#####################################################| Time: 0:00:00  14.24 MB/s
pyyaml-3.12-py 100% |#####################################################| Time: 0:00:00  21.67 MB/s
typing-3.6.4-p 100% |#####################################################| Time: 0:00:00  19.86 MB/s
(pyro) dhcp-18-189-61-137:pyro_experiments blake$ git clone --recursive https://github.com/pytorch/pytorch
Cloning into 'pytorch'...
remote: Counting objects: 57316, done.
remote: Compressing objects: 100% (38/38), done.
remote: Total 57316 (delta 16), reused 5 (delta 2), pack-reused 57276
Receiving objects: 100% (57316/57316), 24.55 MiB | 12.95 MiB/s, done.
Resolving deltas: 100% (43708/43708), done.
Checking out files: 100% (1833/1833), done.
Submodule 'aten/src/ATen/cpu/cpuinfo' (https://github.com/Maratyszcza/cpuinfo) registered for path 'aten/src/ATen/cpu/cpuinfo'
Submodule 'aten/src/ATen/cpu/tbb/tbb_remote' (https://github.com/01org/tbb) registered for path 'aten/src/ATen/cpu/tbb/tbb_remote'
Submodule 'aten/src/ATen/utils/catch' (https://github.com/catchorg/Catch2.git) registered for path 'aten/src/ATen/utils/catch'
Submodule 'torch/lib/gloo' (https://github.com/facebookincubator/gloo) registered for path 'torch/lib/gloo'
Submodule 'torch/lib/nanopb' (https://github.com/nanopb/nanopb.git) registered for path 'torch/lib/nanopb'
Submodule 'torch/lib/pybind11' (https://github.com/pybind/pybind11) registered for path 'torch/lib/pybind11'
Cloning into '/Users/blake/Dropbox (Personal)/projects/pyro_experiments/pytorch/aten/src/ATen/cpu/cpuinfo'...
remote: Counting objects: 4121, done.        
remote: Compressing objects: 100% (282/282), done.        
remote: Total 4121 (delta 411), reused 366 (delta 260), pack-reused 3575        
Receiving objects: 100% (4121/4121), 4.14 MiB | 0 bytes/s, done.
Resolving deltas: 100% (3051/3051), done.
Cloning into '/Users/blake/Dropbox (Personal)/projects/pyro_experiments/pytorch/aten/src/ATen/cpu/tbb/tbb_remote'...
remote: Counting objects: 9934, done.        
remote: Compressing objects: 100% (13/13), done.        
remote: Total 9934 (delta 1), reused 8 (delta 0), pack-reused 9921        
Receiving objects: 100% (9934/9934), 31.35 MiB | 17.23 MiB/s, done.
Resolving deltas: 100% (8105/8105), done.
Cloning into '/Users/blake/Dropbox (Personal)/projects/pyro_experiments/pytorch/aten/src/ATen/utils/catch'...
remote: Counting objects: 19637, done.        
remote: Compressing objects: 100% (38/38), done.        
remote: Total 19637 (delta 17), reused 23 (delta 11), pack-reused 19586        
Receiving objects: 100% (19637/19637), 9.41 MiB | 9.99 MiB/s, done.
Resolving deltas: 100% (13213/13213), done.
Cloning into '/Users/blake/Dropbox (Personal)/projects/pyro_experiments/pytorch/torch/lib/gloo'...
remote: Counting objects: 2074, done.        
remote: Compressing objects: 100% (17/17), done.        
remote: Total 2074 (delta 3), reused 2 (delta 0), pack-reused 2057        
Receiving objects: 100% (2074/2074), 623.03 KiB | 0 bytes/s, done.
Resolving deltas: 100% (1554/1554), done.
Cloning into '/Users/blake/Dropbox (Personal)/projects/pyro_experiments/pytorch/torch/lib/nanopb'...
remote: Counting objects: 4530, done.        
remote: Compressing objects: 100% (31/31), done.        
remote: Total 4530 (delta 10), reused 13 (delta 3), pack-reused 4494        
Receiving objects: 100% (4530/4530), 1.09 MiB | 0 bytes/s, done.
Resolving deltas: 100% (2953/2953), done.
Cloning into '/Users/blake/Dropbox (Personal)/projects/pyro_experiments/pytorch/torch/lib/pybind11'...
remote: Counting objects: 9835, done.        
remote: Total 9835 (delta 0), reused 0 (delta 0), pack-reused 9834        
Receiving objects: 100% (9835/9835), 3.45 MiB | 0 bytes/s, done.
Resolving deltas: 100% (6643/6643), done.
Submodule path 'aten/src/ATen/cpu/cpuinfo': checked out '7b5e4d542409989c8759890208202000a0306764'
Submodule path 'aten/src/ATen/cpu/tbb/tbb_remote': checked out '4c73c3b5d7f78c40f69e0c04fd4afb9f48add1e6'
Submodule path 'aten/src/ATen/utils/catch': checked out '0a34cc201ef28bf25c88b0062f331369596cb7b7'
Submodule path 'torch/lib/gloo': checked out '9b2c046e5f7d4a8ec61598d382838a8f6867a1d4'
Submodule 'third-party/googletest' (https://github.com/google/googletest.git) registered for path 'torch/lib/gloo/third-party/googletest'
Cloning into '/Users/blake/Dropbox (Personal)/projects/pyro_experiments/pytorch/torch/lib/gloo/third-party/googletest'...
remote: Counting objects: 10776, done.        
remote: Compressing objects: 100% (42/42), done.        
remote: Total 10776 (delta 58), reused 79 (delta 53), pack-reused 10670        
Receiving objects: 100% (10776/10776), 3.40 MiB | 0 bytes/s, done.
Resolving deltas: 100% (7921/7921), done.
Submodule path 'torch/lib/gloo/third-party/googletest': checked out 'ec44c6c1675c25b9827aacd08c02433cccde7780'
Submodule path 'torch/lib/nanopb': checked out '14efb1a47a496652ab08b1ebcefb0ea24ae4a5e4'
Submodule path 'torch/lib/pybind11': checked out 'add56ccdcac23a6c522a2c1174a866e293c61dab'
Submodule 'tools/clang' (https://github.com/wjakob/clang-cindex-python3) registered for path 'torch/lib/pybind11/tools/clang'
Cloning into '/Users/blake/Dropbox (Personal)/projects/pyro_experiments/pytorch/torch/lib/pybind11/tools/clang'...
remote: Counting objects: 353, done.        
remote: Total 353 (delta 0), reused 0 (delta 0), pack-reused 353        
Receiving objects: 100% (353/353), 119.74 KiB | 0 bytes/s, done.
Resolving deltas: 100% (149/149), done.
Submodule path 'torch/lib/pybind11/tools/clang': checked out '6a00cbc4a9b8e68b71caf7f774b3f9c753ae84d5'
(pyro) dhcp-18-189-61-137:pyro_experiments blake$ cd pytorch/
(pyro) dhcp-18-189-61-137:pytorch blake$ ls
CONTRIBUTING.md		aten			mypy-files.txt		test
Dockerfile		cmake			mypy.ini		tools
LICENSE			docs			requirements.txt	torch
README.md		mypy-README.md		setup.py		tox.ini

(pyro) dhcp-18-189-61-137:pytorch blake$ MACOSX_DEPLOYMENT_TARGET=10.9 CC=clang CXX=clang++ python setup.py install
running install
running build_deps
-- The C compiler identification is AppleClang 8.1.0.8020042
-- The CXX compiler identification is AppleClang 8.1.0.8020042
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -- broken
CMake Error at /Users/blake/anaconda/envs/pyro/share/cmake-3.9/Modules/CMakeTestCCompiler.cmake:51 (message):
  The C compiler
  "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"
  is not able to compile a simple test program.

  It fails with the following output:

   Change Dir: /Users/blake/Dropbox (Personal)/projects/pyro_experiments/pytorch/torch/lib/build/TH/CMakeFiles/CMakeTmp

  

  Run Build Command:"/usr/bin/make" "cmTC_c8054/fast"

  /Applications/Xcode.app/Contents/Developer/usr/bin/make -f
  CMakeFiles/cmTC_c8054.dir/build.make CMakeFiles/cmTC_c8054.dir/build

  Building C object CMakeFiles/cmTC_c8054.dir/testCCompiler.c.o

  
  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
  -DTH_INDEX_BASE=0 -I/Users/blake/Dropbox
  (Personal)/projects/pyro_experiments/pytorch/torch/lib/tmp_install/include
  -I/Users/blake/Dropbox
  (Personal)/projects/pyro_experiments/pytorch/torch/lib/tmp_install/include/TH
  -I/Users/blake/Dropbox
  (Personal)/projects/pyro_experiments/pytorch/torch/lib/tmp_install/include/THC
  -I/Users/blake/Dropbox
  (Personal)/projects/pyro_experiments/pytorch/torch/lib/tmp_install/include/THS
  -I/Users/blake/Dropbox
  (Personal)/projects/pyro_experiments/pytorch/torch/lib/tmp_install/include/THCS
  -I/Users/blake/Dropbox
  (Personal)/projects/pyro_experiments/pytorch/torch/lib/tmp_install/include/THNN
  -I/Users/blake/Dropbox
  (Personal)/projects/pyro_experiments/pytorch/torch/lib/tmp_install/include/THCUNN
  -DOMPI_SKIP_MPICXX=1 -fexceptions -isysroot
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk
  -mmacosx-version-min=10.12 -o CMakeFiles/cmTC_c8054.dir/testCCompiler.c.o
  -c "/Users/blake/Dropbox
  (Personal)/projects/pyro_experiments/pytorch/torch/lib/build/TH/CMakeFiles/CMakeTmp/testCCompiler.c"


  /bin/sh: -c: line 0: syntax error near unexpected token `('

  /bin/sh: -c: line 0:
  `/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
  -DTH_INDEX_BASE=0 -I/Users/blake/Dropbox
  (Personal)/projects/pyro_experiments/pytorch/torch/lib/tmp_install/include
  -I/Users/blake/Dropbox
  (Personal)/projects/pyro_experiments/pytorch/torch/lib/tmp_install/include/TH
  -I/Users/blake/Dropbox
  (Personal)/projects/pyro_experiments/pytorch/torch/lib/tmp_install/include/THC
  -I/Users/blake/Dropbox
  (Personal)/projects/pyro_experiments/pytorch/torch/lib/tmp_install/include/THS
  -I/Users/blake/Dropbox
  (Personal)/projects/pyro_experiments/pytorch/torch/lib/tmp_install/include/THCS
  -I/Users/blake/Dropbox
  (Personal)/projects/pyro_experiments/pytorch/torch/lib/tmp_install/include/THNN
  -I/Users/blake/Dropbox
  (Personal)/projects/pyro_experiments/pytorch/torch/lib/tmp_install/include/THCUNN
  -DOMPI_SKIP_MPICXX=1 -fexceptions -isysroot
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk
  -mmacosx-version-min=10.12 -o CMakeFiles/cmTC_c8054.dir/testCCompiler.c.o
  -c "/Users/blake/Dropbox
  (Personal)/projects/pyro_experiments/pytorch/torch/lib/build/TH/CMakeFiles/CMakeTmp/testCCompiler.c"'


  make[1]: *** [CMakeFiles/cmTC_c8054.dir/testCCompiler.c.o] Error 2

  make: *** [cmTC_c8054/fast] Error 2

  

  

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt


-- Configuring incomplete, errors occurred!
See also "/Users/blake/Dropbox (Personal)/projects/pyro_experiments/pytorch/torch/lib/build/TH/CMakeFiles/CMakeOutput.log".
See also "/Users/blake/Dropbox (Personal)/projects/pyro_experiments/pytorch/torch/lib/build/TH/CMakeFiles/CMakeError.log".
```

Attached are the two log files that it generated:

[CMakeError.log](https://github.com/pytorch/pytorch/files/1834565/CMakeError.log)
[CMakeOutput.log](https://github.com/pytorch/pytorch/files/1834566/CMakeOutput.log)

cc @malfet @seemethere @walterddr