Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build error: pybind11/cast.h & pybind11.h #65

Closed
zizhao opened this issue Nov 29, 2019 · 13 comments
Closed

build error: pybind11/cast.h & pybind11.h #65

zizhao opened this issue Nov 29, 2019 · 13 comments
Assignees
Labels
bug Something isn't working

Comments

@zizhao
Copy link

zizhao commented Nov 29, 2019

Dear All,
I got the build error on pybind11 when processing the "python setup.py install".
The errors are as follows:
torch/include/pybind11/pytypes.h:1205:395: error: template argument 2 is invalid
torch/include/pybind11/pytypes.h:1205:397: error: template argument 1 is invalid
torch/include/pybind11/pytypes.h:1205:397: error: template argument 2 is invalid
torch/include/pybind11/pytypes.h:1205:412: error: template argument 1 is invalid
/root/miniconda3/envs/kaolin/lib/python3.6/site-packages/torch/include/pybind11/cast.h:776:149: error: expansion pattern ‘std::is_copy_constructible<_Tp>::value’ contains no argument packs
.../torch/include/pybind11pybind11.h:1471:131: error: no matching function for call to ‘pybind11::cpp_function::cpp_function(pybind11::detail::enum_base::init(bool, bool)::<lambda(pybind11::object, pybind11::object)>, pybind11::is_method)’
... pybind11/cast.h:2108:44: error: no matching function for call to ‘collect_arguments(pybind11::object&)’

I have tried built the pybind11 separately, and it's ok, I don't know what's wrong with the pybind11 when combining with the kaolin.
Env:
System: ubuntu 16.04
CUDA Version 10.1
cudnn: 9.0

Anybody know? Thanks very much!

@zizhao zizhao closed this as completed Nov 29, 2019
@zizhao zizhao reopened this Nov 29, 2019
@furaga
Copy link

furaga commented Dec 5, 2019

I had the same error

@Jean-Francois-Lafleche
Copy link
Contributor

Hello @zizhao and @furaga, could you please try replacing all instances of #include <torch/extension.h> with #include <torch/types.h> within files in Kaolin?
(based off of this: pytorch/extension-cpp#35 (comment))

If it helps, I will make a PR to integrate that change. Thanks for bring up this issue!

@Jean-Francois-Lafleche Jean-Francois-Lafleche self-assigned this Dec 5, 2019
@Jean-Francois-Lafleche Jean-Francois-Lafleche added the bug Something isn't working label Dec 5, 2019
@furaga
Copy link

furaga commented Dec 6, 2019

@Jean-Francois-Lafleche Thank you for the information.

I tried the following commands:

$ git checkout .
$ find ./ -name "*.h" | xargs sed -i -e "s/<torch\/extension.h>/<torch\/types.h>/g"
$ find ./ -name "*.cpp" | xargs sed -i -e "s/<torch\/extension.h>/<torch\/types.h>/g"
$ python setup.py install

However, I encountered another error

$ python setup.py install

...
writing manifest file 'kaolin.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
running build_ext
building 'kaolin.cuda.sided_distance' extension
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g  -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time  -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/lib/python3.6/dist-packages/torch/include  -I/usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/api/include  -I/usr/local/lib/python3.6/dist-packages/torch/include/TH  -I/usr/local/lib/python3.6/dist-packages/torch/include/THC  -I/usr/local/cuda/include -I/usr/include/python3.6m -c  kaolin/cuda/sided_distance.cpp -o  build/temp.linux-x86_64-3.6/kaolin/cuda/sided_distance.o  -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=sided_distance  -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++11
kaolin/cuda/sided_distance.cpp:45:16: error: expected constructor, destructor, or  type conversion before '(' token
PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) {
                ^
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

I found my environment is not latest.

Env:
System: ubuntu 16.04
CUDA Version 10.0
cudnn: 7.2.1
pytorch: 1.2.0

I installed pytorch 1.2.0 because I cannot install CUDA 10.1 for some reason.
Do you think the pytorch version is the cause of the error?
If so, do you have any idea to run kaolin in the environment?

@zhuhaozh
Copy link

Hi, @furaga
I met the same issue, did you solve this?

pytorch=1.1.0 
cuda=9.0 
python=3.6

@furaga
Copy link

furaga commented Dec 11, 2019

@zhuhaozh No. I have not tried anything since the above post...

@Jean-Francois-Lafleche
Copy link
Contributor

Can you run nvcc --version and post the output? Thanks! I hope to be able to reproduce this so we can find a solution.

@furaga
Copy link

furaga commented Dec 11, 2019

@Jean-Francois-Lafleche The output is here. Thank you.

$ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2017 NVIDIA Corporation
Built on Fri_Sep__1_21:08:03_CDT_2017
Cuda compilation tools, release 9.0, V9.0.176

@renleidewenming
Copy link

@furaga After replacing all the <torch/extension.h> with <torch/types.h>, I met the same error.

cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
kaolin/cuda/sided_distance.cpp:45:16: error: expected constructor, destructor, or type conversion before ‘(’ token
PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) {
^
error: command 'gcc' failed with exit status 1

My cuda:
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2019 NVIDIA Corporation
Built on Wed_Oct_23_19:24:38_PDT_2019
Cuda compilation tools, release 10.2, V10.2.89

@renleidewenming
Copy link

@furaga I solved the problem by following #4
not all the <torch/extension.h> should be replaced with <torch/types.h>, in fact, only the following files are processed:
kaolin/cuda/util.h
kaolin/cuda/cuda_util.h
kaolin/cuda/mesh_intersection_cuda.cu
kaolin/cuda/sided_distance_cuda.cu

@Jean-Francois-Lafleche
Copy link
Contributor

Thanks @renleidewenming! It seems the trouble is coming from some deprecations that were introduced between PyTorch 1.0 and 1.2. For anyone using PyTorch < 1.2, please follow @renleidewenming's solution. PR #89 will be introduced to increase the minimum requirements of PyTorch to 1.2 and for CUDA 10.0.130.

@porterjenkins
Copy link

I am still seeing this issue with Pytorch 1.3. I also tried modifying the header files like @renleidewenming suggested. Is anyone else still having this issue?

pytorch: 1.3.1 cuda: V10.0.130 python 3.6.9

@clarksandholtz
Copy link

I'm also seeing this issue even after having tried editing the header files.
I'm running on Ubuntu 18.04 with an RTX 2080 Ti.

Cuda printout:

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2018 NVIDIA Corporation
Built on Sat_Aug_25_21:08:01_CDT_2018
Cuda compilation tools, release 10.0, V10.0.130

@Caenorst
Copy link
Collaborator

Hi, thank you for using Kaolin! The library went through a major rewrite with the version 0.9.0, and only the core library components we can thoroughly test and maintain are now part of this repository. Please refer to our latest documentation:
https://kaolin.readthedocs.io/en/latest/

Closing the bug as it is no longer relevant to this repo.

3a1b2c3 pushed a commit to 3a1b2c3/kaolin-windows that referenced this issue Nov 6, 2022
…sforms

Object Transforms for ray traced objects
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

8 participants