Skip to content
This repository was archived by the owner on Dec 18, 2019. It is now read-only.

Installation #5

Open
boeddeker opened this issue Dec 10, 2018 · 36 comments
Open

Installation #5

boeddeker opened this issue Dec 10, 2018 · 36 comments

Comments

@boeddeker
Copy link
Contributor

I am interested in complex support for pytorch. I want to translate our Complex differentable operations from Chainer to Pytorch. But I am not familiar with C++.

Can you provide more information, how this complex extension for pytorch can be installed?
I have installed pytorch from git (1.0.0a0+4574ea3) and get the error msg

src/General.h:23:32: fatal error: ATen/core/optional.h: No such file or directory

when I run python setup.py install.

@Roger-luo
Copy link
Owner

Roger-luo commented Dec 10, 2018

It seems that the compiler cannot find your pytorch. Can you compile any other c++ extension of torch? Like the one in torch/test

This extension should just work by running python setup.py install as long as it can find those header files in ATen.

@boeddeker
Copy link
Contributor Author

Did you mean if cd pytorch/test/cpp_extensions && pip install . is working? Yes, the build for that was successful.
I reinstalled pytorch from source, but that does not change something (Notebook, Ubuntu 16, without GPU).
Also I am confused, because I can not find the file ATen/core/optional.h

$ find . -iname "optional.h"
./c10/util/Optional.h
./torch/lib/tmp_install/include/c10/util/Optional.h
./torch/lib/include/c10/util/Optional.h
./build/lib.linux-x86_64-3.6/torch/lib/include/c10/util/Optional.h
./third_party/ideep/tests/rapidcheck/extras/boost/include/rapidcheck/gen/boost/Optional.h

@Roger-luo
Copy link
Owner

Roger-luo commented Dec 10, 2018

It seems this file is changed in 1.0, I'm trying this in latest 1.0. I can compile it with 0.4 tho. I'll try update the name conventions. sorry.

Maybe you could try this branch:

pytorch/pytorch#11641

@Roger-luo
Copy link
Owner

@boeddeker I guess @ezyang just fixed the compilation with pytorch 1.0, let us know if you can compile it now.

@boeddeker
Copy link
Contributor Author

Thanks, now I can compile it.

@ItaiWisense
Copy link

Hi, tried installing with pytorch version 1.0.0a0.

Got this error when using python setup.py install:
c10/core/TensorImpl.h: No such file or directory

Any suggestions?

Thanks

@ezyang
Copy link
Collaborator

ezyang commented Jan 9, 2019

I'm not sure exactly what pytorch version is 1.0.0a0, but you're going to need master for pytorch-complex

@arsenovic
Copy link
Contributor

arsenovic commented Jan 17, 2019

with fixes from #6, i get this upon python setup install

In file included from src/CPUComplexType.h:60:0,
             from src/module.cpp:2:
src/CPUComplexTypeImpl.h:108:74: error: within this context
     StorageImpl *self_storage_ptr = self_->storage_.unsafeGetStorageImpl();

related to pytorch/pytorch#15105?

@Roger-luo
Copy link
Owner

Could you show me the full error msg? I didn't see the rest of the error. I guess there should be some error message address which kind of error is this.

@arsenovic
Copy link
Contributor

running install
running bdist_egg
running egg_info
writing dependency_links to torch_complex.egg-info/dependency_links.txt
writing torch_complex.egg-info/PKG-INFO
writing top-level names to torch_complex.egg-info/top_level.txt
reading manifest file 'torch_complex.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'torch_complex.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
running build_ext
building 'torch_complex.cpp' extension
gcc -pthread -B /home/alex/anaconda3/compiler_compat -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/alex/anaconda3/lib/python3.5/site-packages/torch/lib/include -I/home/alex/anaconda3/lib/python3.5/site-packages/torch/lib/include/torch/csrc/api/include -I/home/alex/anaconda3/lib/python3.5/site-packages/torch/lib/include/TH -I/home/alex/anaconda3/lib/python3.5/site-packages/torch/lib/include/THC -I/home/alex/anaconda3/include/python3.5m -c src/module.cpp -o build/temp.linux-x86_64-3.5/src/module.o -g -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=cpp -std=c++11
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
In file included from /home/alex/anaconda3/lib/python3.5/site-packages/torch/lib/include/ATen/core/Tensor.h:10:0,
                 from /home/alex/anaconda3/lib/python3.5/site-packages/torch/lib/include/ATen/core/Type.h:594,
                 from /home/alex/anaconda3/lib/python3.5/site-packages/torch/lib/include/ATen/Type.h:2,
                 from /home/alex/anaconda3/lib/python3.5/site-packages/torch/lib/include/ATen/Context.h:4,
                 from /home/alex/anaconda3/lib/python3.5/site-packages/torch/lib/include/ATen/ATen.h:5,
                 from /home/alex/anaconda3/lib/python3.5/site-packages/torch/lib/include/torch/csrc/api/include/torch/types.h:3,
                 from /home/alex/anaconda3/lib/python3.5/site-packages/torch/lib/include/torch/csrc/api/include/torch/data/dataloader_options.h:4,
                 from /home/alex/anaconda3/lib/python3.5/site-packages/torch/lib/include/torch/csrc/api/include/torch/data/dataloader/base.h:3,
                 from /home/alex/anaconda3/lib/python3.5/site-packages/torch/lib/include/torch/csrc/api/include/torch/data/dataloader/stateful.h:3,
                 from /home/alex/anaconda3/lib/python3.5/site-packages/torch/lib/include/torch/csrc/api/include/torch/data/dataloader.h:3,
                 from /home/alex/anaconda3/lib/python3.5/site-packages/torch/lib/include/torch/csrc/api/include/torch/data.h:3,
                 from /home/alex/anaconda3/lib/python3.5/site-packages/torch/lib/include/torch/csrc/api/include/torch/all.h:4,
                 from /home/alex/anaconda3/lib/python3.5/site-packages/torch/lib/include/torch/extension.h:4,
                 from src/module.cpp:1:
src/CPUComplexTypeImpl.h: In instantiation of ‘at::Tensor& at::CPUComplexType<PrecisionType>::set_(at::Tensor&, c10::Storage, int64_t, c10::IntList, c10::IntList) const [with PrecisionType = float; int64_t = long int; c10::IntList = c10::ArrayRef<long int>]’:
src/module.cpp:22:1:   required from here
/home/alex/anaconda3/lib/python3.5/site-packages/torch/lib/include/c10/core/TensorImpl.h:1349:11: error: ‘c10::Storage c10::TensorImpl::storage_’ is protected
   Storage storage_;
           ^
In file included from src/CPUComplexType.h:60:0,
                 from src/module.cpp:2:
src/CPUComplexTypeImpl.h:108:74: error: within this context
     StorageImpl *self_storage_ptr = self_->storage_.unsafeGetStorageImpl();
                                                                          ^
In file included from /home/alex/anaconda3/lib/python3.5/site-packages/torch/lib/include/ATen/core/Tensor.h:10:0,
                 from /home/alex/anaconda3/lib/python3.5/site-packages/torch/lib/include/ATen/core/Type.h:594,
                 from /home/alex/anaconda3/lib/python3.5/site-packages/torch/lib/include/ATen/Type.h:2,
                 from /home/alex/anaconda3/lib/python3.5/site-packages/torch/lib/include/ATen/Context.h:4,
                 from /home/alex/anaconda3/lib/python3.5/site-packages/torch/lib/include/ATen/ATen.h:5,
                 from /home/alex/anaconda3/lib/python3.5/site-packages/torch/lib/include/torch/csrc/api/include/torch/types.h:3,
                 from /home/alex/anaconda3/lib/python3.5/site-packages/torch/lib/include/torch/csrc/api/include/torch/data/dataloader_options.h:4,
                 from /home/alex/anaconda3/lib/python3.5/site-packages/torch/lib/include/torch/csrc/api/include/torch/data/dataloader/base.h:3,
                 from /home/alex/anaconda3/lib/python3.5/site-packages/torch/lib/include/torch/csrc/api/include/torch/data/dataloader/stateful.h:3,
                 from /home/alex/anaconda3/lib/python3.5/site-packages/torch/lib/include/torch/csrc/api/include/torch/data/dataloader.h:3,
                 from /home/alex/anaconda3/lib/python3.5/site-packages/torch/lib/include/torch/csrc/api/include/torch/data.h:3,
                 from /home/alex/anaconda3/lib/python3.5/site-packages/torch/lib/include/torch/csrc/api/include/torch/all.h:4,
                 from /home/alex/anaconda3/lib/python3.5/site-packages/torch/lib/include/torch/extension.h:4,
                 from src/module.cpp:1:
/home/alex/anaconda3/lib/python3.5/site-packages/torch/lib/include/c10/core/TensorImpl.h:1349:11: error: ‘c10::Storage c10::TensorImpl::storage_’ is protected
   Storage storage_;
           ^
In file included from src/CPUComplexType.h:60:0,
                 from src/module.cpp:2:
src/CPUComplexTypeImpl.h:117:25: error: within this context
         self_->storage_ = at::Storage(c10::intrusive_ptr<THStorage>::reclaim(storage_ptr));
                         ^
In file included from /home/alex/anaconda3/lib/python3.5/site-packages/torch/lib/include/ATen/core/Tensor.h:10:0,
                 from /home/alex/anaconda3/lib/python3.5/site-packages/torch/lib/include/ATen/core/Type.h:594,
                 from /home/alex/anaconda3/lib/python3.5/site-packages/torch/lib/include/ATen/Type.h:2,
                 from /home/alex/anaconda3/lib/python3.5/site-packages/torch/lib/include/ATen/Context.h:4,
                 from /home/alex/anaconda3/lib/python3.5/site-packages/torch/lib/include/ATen/ATen.h:5,
                 from /home/alex/anaconda3/lib/python3.5/site-packages/torch/lib/include/torch/csrc/api/include/torch/types.h:3,
                 from /home/alex/anaconda3/lib/python3.5/site-packages/torch/lib/include/torch/csrc/api/include/torch/data/dataloader_options.h:4,
                 from /home/alex/anaconda3/lib/python3.5/site-packages/torch/lib/include/torch/csrc/api/include/torch/data/dataloader/base.h:3,
                 from /home/alex/anaconda3/lib/python3.5/site-packages/torch/lib/include/torch/csrc/api/include/torch/data/dataloader/stateful.h:3,
                 from /home/alex/anaconda3/lib/python3.5/site-packages/torch/lib/include/torch/csrc/api/include/torch/data/dataloader.h:3,
                 from /home/alex/anaconda3/lib/python3.5/site-packages/torch/lib/include/torch/csrc/api/include/torch/data.h:3,
                 from /home/alex/anaconda3/lib/python3.5/site-packages/torch/lib/include/torch/csrc/api/include/torch/all.h:4,
                 from /home/alex/anaconda3/lib/python3.5/site-packages/torch/lib/include/torch/extension.h:4,
                 from src/module.cpp:1:
src/CPUComplexTypeImpl.h: In instantiation of ‘at::Tensor& at::CPUComplexType<PrecisionType>::set_(at::Tensor&, c10::Storage, int64_t, c10::IntList, c10::IntList) const [with PrecisionType = double; int64_t = long int; c10::IntList = c10::ArrayRef<long int>]’:
src/module.cpp:22:1:   required from here
/home/alex/anaconda3/lib/python3.5/site-packages/torch/lib/include/c10/core/TensorImpl.h:1349:11: error: ‘c10::Storage c10::TensorImpl::storage_’ is protected
   Storage storage_;
           ^
In file included from src/CPUComplexType.h:60:0,
                 from src/module.cpp:2:
src/CPUComplexTypeImpl.h:108:74: error: within this context
     StorageImpl *self_storage_ptr = self_->storage_.unsafeGetStorageImpl();
                                                                          ^
In file included from /home/alex/anaconda3/lib/python3.5/site-packages/torch/lib/include/ATen/core/Tensor.h:10:0,
                 from /home/alex/anaconda3/lib/python3.5/site-packages/torch/lib/include/ATen/core/Type.h:594,
                 from /home/alex/anaconda3/lib/python3.5/site-packages/torch/lib/include/ATen/Type.h:2,
                 from /home/alex/anaconda3/lib/python3.5/site-packages/torch/lib/include/ATen/Context.h:4,
                 from /home/alex/anaconda3/lib/python3.5/site-packages/torch/lib/include/ATen/ATen.h:5,
                 from /home/alex/anaconda3/lib/python3.5/site-packages/torch/lib/include/torch/csrc/api/include/torch/types.h:3,
                 from /home/alex/anaconda3/lib/python3.5/site-packages/torch/lib/include/torch/csrc/api/include/torch/data/dataloader_options.h:4,
                 from /home/alex/anaconda3/lib/python3.5/site-packages/torch/lib/include/torch/csrc/api/include/torch/data/dataloader/base.h:3,
                 from /home/alex/anaconda3/lib/python3.5/site-packages/torch/lib/include/torch/csrc/api/include/torch/data/dataloader/stateful.h:3,
                 from /home/alex/anaconda3/lib/python3.5/site-packages/torch/lib/include/torch/csrc/api/include/torch/data/dataloader.h:3,
                 from /home/alex/anaconda3/lib/python3.5/site-packages/torch/lib/include/torch/csrc/api/include/torch/data.h:3,
                 from /home/alex/anaconda3/lib/python3.5/site-packages/torch/lib/include/torch/csrc/api/include/torch/all.h:4,
                 from /home/alex/anaconda3/lib/python3.5/site-packages/torch/lib/include/torch/extension.h:4,
                 from src/module.cpp:1:
/home/alex/anaconda3/lib/python3.5/site-packages/torch/lib/include/c10/core/TensorImpl.h:1349:11: error: ‘c10::Storage c10::TensorImpl::storage_’ is protected
   Storage storage_;
           ^
In file included from src/CPUComplexType.h:60:0,
                 from src/module.cpp:2:
src/CPUComplexTypeImpl.h:117:25: error: within this context
         self_->storage_ = at::Storage(c10::intrusive_ptr<THStorage>::reclaim(storage_ptr));
                         ^
error: command 'gcc' failed with exit status 1

@ItaiWisense
Copy link

ItaiWisense commented Jan 22, 2019

Using fix#6 and running python setup.py install . Got the error below, what do you think?

running install
running bdist_egg
running egg_info
writing torch_complex.egg-info/PKG-INFO
writing dependency_links to torch_complex.egg-info/dependency_links.txt
writing top-level names to torch_complex.egg-info/top_level.txt
reading manifest file 'torch_complex.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'torch_complex.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
running build_ext
building 'torch_complex.cpp' extension
gcc -pthread -B /opt/conda/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/opt/conda/lib/python3.6/site-packages/torch/lib/include -I/opt/conda/lib/python3.6/site-packages/torch/lib/include/torch/csrc/api/include -I/opt/conda/lib/python3.6/site-packages/torch/lib/include/TH -I/opt/conda/lib/python3.6/site-packages/torch/lib/include/THC -I/opt/conda/include/python3.6m -c src/module.cpp -o build/temp.linux-x86_64-3.6/src/module.o -g -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=cpp -std=c++11
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
In file included from src/CPUComplexType.h:4:0,
from src/module.cpp:2:
src/General.h:12:33: fatal error: c10/core/TensorImpl.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1

@arsenovic
Copy link
Contributor

you can try to find the missing file with find ../ -iname "Half.h", then modify the includes in General.h appropriately.

@alidiak
Copy link

alidiak commented Jan 26, 2019

I have the exact same compilation issue as ItaiWisense. Arsenovic, I am not sure how to get to General.h or exactly what you mean by modifying the includes. I just made a Virtualenv on ubuntu for windows and downloaded the most recent version of torch and torchvision. If anyone has any suggestions, I'd much appreciate it. Thank you.

@arsenovic
Copy link
Contributor

the error from @ItaiWisense looks just like a missing header, which i had at first also. so you just need to modify the General.h to point the correct location of the missing header. you can use the find command to locate both General.h and the missing header[s].

@williamFalcon
Copy link
Collaborator

williamFalcon commented Feb 1, 2019

hi, @Roger-luo Trying out your package.

However, I get this error when installing on Macbook pro and our compute cluster

➜  pytorch-complex git:(master) python3 setup.py install

running install
running bdist_egg
running egg_info
writing torch_complex.egg-info/PKG-INFO
writing dependency_links to torch_complex.egg-info/dependency_links.txt
writing top-level names to torch_complex.egg-info/top_level.txt
reading manifest file 'torch_complex.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'torch_complex.egg-info/SOURCES.txt'
installing library code to build/bdist.macosx-10.7-x86_64/egg
running install_lib
running build_py
running build_ext
building 'torch_complex.cpp' extension
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/anaconda3/envs/organics/include -arch x86_64 -I/anaconda3/envs/organics/include -arch x86_64 -I/anaconda3/envs/organics/lib/python3.6/site-packages/torch/include -I/anaconda3/envs/organics/lib/python3.6/site-packages/torch/include/torch/csrc/api/include -I/anaconda3/envs/organics/lib/python3.6/site-packages/torch/include/TH -I/anaconda3/envs/organics/lib/python3.6/site-packages/torch/include/THC -I/anaconda3/envs/organics/include/python3.6m -c src/module.cpp -o build/temp.macosx-10.7-x86_64-3.6/src/module.o -g -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=cpp -std=c++11
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
In file included from src/CPUComplexType.h:4:0,
                 from src/module.cpp:2:
src/General.h:14:28: fatal error: ATen/Allocator.h: No such file or directory
 #include <ATen/Allocator.h>
                            ^
compilation terminated.
error: command 'gcc' failed with exit status 1
(organics) ➜  pytorch-complex git:(master) python setup install
python: can't open file 'setup': [Errno 2] No such file or directory
(organics) ➜  pytorch-complex git:(master) python3 setup.py install

running install
running bdist_egg
running egg_info
writing torch_complex.egg-info/PKG-INFO
writing dependency_links to torch_complex.egg-info/dependency_links.txt
writing top-level names to torch_complex.egg-info/top_level.txt
reading manifest file 'torch_complex.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'torch_complex.egg-info/SOURCES.txt'
installing library code to build/bdist.macosx-10.7-x86_64/egg
running install_lib
running build_py
running build_ext
building 'torch_complex.cpp' extension
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/anaconda3/envs/organics/include -arch x86_64 -I/anaconda3/envs/organics/include -arch x86_64 -I/anaconda3/envs/organics/lib/python3.6/site-packages/torch/include -I/anaconda3/envs/organics/lib/python3.6/site-packages/torch/include/torch/csrc/api/include -I/anaconda3/envs/organics/lib/python3.6/site-packages/torch/include/TH -I/anaconda3/envs/organics/lib/python3.6/site-packages/torch/include/THC -I/anaconda3/envs/organics/include/python3.6m -c src/module.cpp -o build/temp.macosx-10.7-x86_64-3.6/src/module.o -g -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=cpp -std=c++11
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
In file included from src/CPUComplexType.h:4:0,
                 from src/module.cpp:2:
src/General.h:14:28: fatal error: ATen/Allocator.h: No such file or directory
 #include <ATen/Allocator.h>
                            ^
compilation terminated.
error: command 'gcc' failed with exit status 1

@ezyang
Copy link
Collaborator

ezyang commented Feb 2, 2019

I'll take a pass and update the includes for master this weekend. In the future, we should advertise a specific commit hash of PyTorch or nightly which this extension is known to work with.

@Roger-luo
Copy link
Owner

Roger-luo commented Feb 2, 2019

@ezyang Maybe we should have a fork or a branch for now, which will make this extension work temporarily to try it out? I've updated this extension for several times as well, sometimes it's hard to notice patches in the main tree will cause this extension fail. I only got one alert once...

@ezyang
Copy link
Collaborator

ezyang commented Feb 2, 2019

Yes, we could do that too. There's so much stuff changing on master it's hard to keep up otherwise. It's a little bit of a shame because the extension can be used with a stock build of PyTorch... but only a very specific stock build :)

@williamFalcon
Copy link
Collaborator

williamFalcon commented Feb 3, 2019

why not just make a tag release and set the dependencies to the proper pytorch version?

Is the master version no compilable?

@Roger-luo
Copy link
Owner

As what's README says, this package is work in progress and requires some patches in the main tree in the future. There's no proper release of pytorch for this extension yet.

@williamFalcon
Copy link
Collaborator

That’s cool, I saw that. I guess I was more wondering if you guys pushed the header fixes so we can build.

@ezyang
Copy link
Collaborator

ezyang commented Feb 4, 2019

I pushed an update for latest master just now. Give it a try.

@ezyang
Copy link
Collaborator

ezyang commented Feb 5, 2019

Huh, I've never seen that one before. What compiler are you compiling with?

@williamFalcon
Copy link
Collaborator

ok, just rebuilt pytorch (to the hash listed), and I'm still getting the following compile error:

(pytorch_complex) ➜  pytorch-complex git:(master) python setup.py install

running install
running bdist_egg
running egg_info
writing torch_complex.egg-info/PKG-INFO
writing dependency_links to torch_complex.egg-info/dependency_links.txt
writing top-level names to torch_complex.egg-info/top_level.txt
reading manifest file 'torch_complex.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'torch_complex.egg-info/SOURCES.txt'
installing library code to build/bdist.macosx-10.7-x86_64/egg
running install_lib
running build_py
running build_ext
building 'torch_complex.cpp' extension
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/anaconda3/envs/pytorch_complex/include -arch x86_64 -I/anaconda3/envs/pytorch_complex/include -arch x86_64 -I/anaconda3/envs/pytorch_complex/lib/python3.7/site-packages/torch/include -I/anaconda3/envs/pytorch_complex/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/anaconda3/envs/pytorch_complex/lib/python3.7/site-packages/torch/include/TH -I/anaconda3/envs/pytorch_complex/lib/python3.7/site-packages/torch/include/THC -I/anaconda3/envs/pytorch_complex/include/python3.7m -c src/module.cpp -o build/temp.macosx-10.7-x86_64-3.7/src/module.o -g -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=cpp -std=c++11
warning: include path for stdlibc++ headers not found; pass '-std=libc++' on the command line to use
      the libc++ standard library instead [-Wstdlibcxx-not-found]
In file included from src/module.cpp:1:
In file included from /anaconda3/envs/pytorch_complex/lib/python3.7/site-packages/torch/include/torch/extension.h:4:
In file included from /anaconda3/envs/pytorch_complex/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/all.h:3:
/anaconda3/envs/pytorch_complex/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/cuda.h:5:10: fatal error:
      'cstddef' file not found
#include <cstddef>
         ^~~~~~~~~
1 warning and 1 error generated.
error: command 'gcc' failed with exit status 1

@ezyang
Copy link
Collaborator

ezyang commented Feb 5, 2019

There is something wrong with your C++ installation:

  warning: include path for stdlibc++ headers not found; pass '-std=libc++' on the command line to use
        the libc++ standard library instead [-Wstdlibcxx-not-found]

@williamFalcon
Copy link
Collaborator

ok sad... haha.

This probably has something to do with Xcode and Mojave. Any suggestions on what to google or how to fix?

@williamFalcon
Copy link
Collaborator

williamFalcon commented Feb 6, 2019

Fixed...

For anyone else with this issue: This is a Mac Mojave specific issue where the latest XCode changes the compiler defaults.

To fix:
In setup.py file, change line 62 from:

        extra_compile_args=["-g"],

to

        extra_compile_args=["-g", "-stdlib=libc++", "-std=c++11"],

See #7

@Zellar209
Copy link

Hi, tried installing with pytorch version 1.0.0a0.

Got this error when using python setup.py install:
c10/core/TensorImpl.h: No such file or directory

Any suggestions?

Thanks

Hi, I encountered the same problem. Have you fixed it?
Sincerely hope for your answers. Many thanks!

@Roger-luo
Copy link
Owner

@Zellar209 yes, if you are using the specific commit in README, this should be fixed.

@Roger-luo
Copy link
Owner

The remained problem for this issue is something related to pytorch/pytorch#16805 on MacOS. Have no clue on this yet.

@Zellar209
Copy link

Fixed...

For anyone else with this issue: This is a Mac Mojave specific issue where the latest XCode changes the compiler defaults.

To fix:
In setup.py file, change line 62 from:

        extra_compile_args=["-g"],

to

        extra_compile_args=["-g", "-stdlib=libc++", "-std=c++11"],

See #7

I fixed the problem by changing
extra_compile_args=["-g", "-stdlib=libc++", "-std=c++11"],
to
extra_compile_args=["-g"],
Thank you for your valuable solution!

@Roger-luo
Copy link
Owner

@Zellar209 what's your OS? MacOS or Linux?

@Roger-luo
Copy link
Owner

@Zellar209 What's your pytorch version? and what's your clang version? Could you post these reports here? The original issue #755 is not quite related and already pretty long to read.

@Haydnspass
Copy link

@Roger-luo I am not @Zellar209 but maybe I can answer:
I run macOS and had the same problem. Using the extra compiler arguments suggested by @Zellar209 fixed this, until the recent Xcode update ...
I use libtorch 1.0.0

$ clang --version
Apple LLVM version 10.0.1 (clang-1001.0.46.3)
Target: x86_64-apple-darwin18.5.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

@Zellar209
Copy link

@Zellar209 what's your OS? MacOS or Linux?

I am using

MacOS 14.04

torch.version
'1.1.0a0+ffc7158'

clang version 4.0.1 (tags/RELEASE_401/final)
Target: x86_64-apple-darwin18.5.0
Thread model: posix
InstalledDir: /anaconda3/bin

Thank you very much.

@Roger-luo
Copy link
Owner

Roger-luo commented Apr 4, 2019

@Zellar209 could you checkout to this commit 6cb593b88cb0c411690b4957850058329526d87b ? and build pytorch from source? Your torch version doesn't look correct.

@Haydnspass yes, I noticed that with some Xcode (even on my own laptop), even the pytorch's cpp extension test won't pass (torch itself is fine...). I'm sure there's some problem with Xcode... but I haven't figured out what's the problem and how to fix it.

But @Zellar209 's errors seems to be that he is not using the correct commit.

And please notice, this package is far from practical usage, so please do not use this in practical code. It probably give you the wrong results due to its lack of test and functionality.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants