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

getting error during "python3 setup.py build_ext --inplace" #3

Open
smartblockdev opened this issue May 7, 2021 · 5 comments
Open

Comments

@smartblockdev
Copy link

(my_env) user@userM-I-85:~/Downloads/DeepRule-master/models/py_utils/_cpools$ python3 setup.py build_ext --inplace
running build_ext
building 'top_pool' extension
gcc -pthread -B /home/user/anaconda3/envs/my_env/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/user/anaconda3/envs/my_env/lib/python3.6/site-packages/torch/include -I/home/user/anaconda3/envs/my_env/lib/python3.6/site-packages/torch/include/torch/csrc/api/include -I/home/user/anaconda3/envs/my_env/lib/python3.6/site-packages/torch/include/TH -I/home/user/anaconda3/envs/my_env/lib/python3.6/site-packages/torch/include/THC -I/home/user/anaconda3/envs/my_env/include/python3.6m -c src/top_pool.cpp -o build/temp.linux-x86_64-3.6/src/top_pool.o -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=top_pool -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++11
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
In file included from src/top_pool.cpp:1:0:
/home/user/anaconda3/envs/my_env/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/torch.h:7:2: warning: #warning "Including torch/torch.h for C++ extensions is deprecated. Please include torch/extension.h" [-Wcpp]
#warning
^~~~~~~
src/top_pool.cpp: In function ‘std::vectorat::Tensor top_pool_backward(at::Tensor, at::Tensor)’:
src/top_pool.cpp:44:41: error: could not convert ‘at::CUDA((c10::ScalarType)6)’ from ‘at::DeprecatedTypeProperties’ to ‘c10::IntArrayRef {aka c10::ArrayRef}’
auto max_val = at::zeros(torch::CUDA(at::kFloat), {batch, channel, width});
~~~~~~~~~~~^~~~~~~~~~~~
src/top_pool.cpp:45:41: error: could not convert ‘at::CUDA((c10::ScalarType)4)’ from ‘at::DeprecatedTypeProperties’ to ‘c10::IntArrayRef {aka c10::ArrayRef}’
auto max_ind = at::zeros(torch::CUDA(at::kLong), {batch, channel, width});
~~~~~~~~~~~^~~~~~~~~~~
src/top_pool.cpp:57:44: error: could not convert ‘at::CUDA((c10::ScalarType)0)’ from ‘at::DeprecatedTypeProperties’ to ‘c10::IntArrayRef {aka c10::ArrayRef}’
auto gt_mask = at::zeros(torch::CUDA(at::kByte), {batch, channel, width});
~~~~~~~~~~~^~~~~~~~~~~
src/top_pool.cpp:58:44: error: could not convert ‘at::CUDA((c10::ScalarType)6)’ from ‘at::DeprecatedTypeProperties’ to ‘c10::IntArrayRef {aka c10::ArrayRef}’
auto max_temp = at::zeros(torch::CUDA(at::kFloat), {batch, channel, width});
~~~~~~~~~~~^~~~~~~~~~~~
error: command 'gcc' failed with exit status 1

@Void-Mohit
Copy link

Void-Mohit commented May 7, 2021

At this file op_pool.cpp on location models/py_utils/_cpools/src/ replace line 44,45 by
auto max_val = at::zeros( {batch, channel, height}, torch::CUDA(at::kFloat));
auto max_ind = at::zeros( {batch, channel, width}, torch::CUDA(at::kLong));

replace line no 57,58 ### by

auto gt_mask = at::zeros( {batch, channel, width} ,torch::CUDA(at::kByte));
auto max_temp = at::zeros( {batch, channel, width} ,torch::CUDA(at::kFloat));

If error occure then perform changes in bottom_pool.cpp,left_pool.cpp,right_pool.cpp files

@ddecatur
Copy link

ddecatur commented Jun 7, 2021

I am getting a similar error during "python setup.py build_ext --inplace"
Is there a similar fix for this?

(DeepRuleVenv) ddecatur@server:/local/ddecatur/DeepRule/models/py_utils/_cpools$ python setup.py build_ext --inplace
running build_ext
building 'top_pool' extension
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/local/ddecatur/DeepRule/DeepRuleVenv/lib/python3.8/site-packages/torch/include -I/local/ddecatur/DeepRule/DeepRuleVenv/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -I/local/ddecatur/DeepRule/DeepRuleVenv/lib/python3.8/site-packages/torch/include/TH -I/local/ddecatur/DeepRule/DeepRuleVenv/lib/python3.8/site-packages/torch/include/THC -I/local/ddecatur/DeepRule/DeepRuleVenv/include -I/usr/include/python3.8 -c src/top_pool.cpp -o build/temp.linux-x86_64-3.8/src/top_pool.o -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=top_pool -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++11
src/top_pool.cpp: In function ‘std::vectorat::Tensor top_pool_backward(at::Tensor, at::Tensor)’:
src/top_pool.cpp:44:78: error: no matching function for call to ‘zeros(at::DeprecatedTypeProperties&, )’
44 | auto max_val = at::zeros(torch::CUDA(at::kFloat), {batch, channel, width});
| ^
In file included from /local/ddecatur/DeepRule/DeepRuleVenv/lib/python3.8/site-packages/torch/include/ATen/ATen.h:12,
from /local/ddecatur/DeepRule/DeepRuleVenv/lib/python3.8/site-packages/torch/include/torch/csrc/api/include/torch/types.h:3,
from /local/ddecatur/DeepRule/DeepRuleVenv/lib/python3.8/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader_options.h:4,
from /local/ddecatur/DeepRule/DeepRuleVenv/lib/python3.8/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/base.h:3,
from /local/ddecatur/DeepRule/DeepRuleVenv/lib/python3.8/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/stateful.h:3,
from /local/ddecatur/DeepRule/DeepRuleVenv/lib/python3.8/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader.h:3,
from /local/ddecatur/DeepRule/DeepRuleVenv/lib/python3.8/site-packages/torch/include/torch/csrc/api/include/torch/data.h:3,
from /local/ddecatur/DeepRule/DeepRuleVenv/lib/python3.8/site-packages/torch/include/torch/csrc/api/include/torch/all.h:4,
from /local/ddecatur/DeepRule/DeepRuleVenv/lib/python3.8/site-packages/torch/include/torch/csrc/api/include/torch/torch.h:3,
from src/top_pool.cpp:1:
/local/ddecatur/DeepRule/DeepRuleVenv/lib/python3.8/site-packages/torch/include/ATen/Functions.h:9169:22: note: candidate: ‘at::Tensor at::zeros(c10::IntArrayRef, c10::optional<c10::ArrayRefat::Dimname >, const c10::TensorOptions&)’
9169 | static inline Tensor zeros(IntArrayRef size, c10::optional names, const TensorOptions & options) {
| ^~~~~
/local/ddecatur/DeepRule/DeepRuleVenv/lib/python3.8/site-packages/torch/include/ATen/Functions.h:9169:40: note: no known conversion for argument 1 from ‘at::DeprecatedTypeProperties’ to ‘c10::IntArrayRef’ {aka ‘c10::ArrayRef’}
9169 | static inline Tensor zeros(IntArrayRef size, c10::optional names, const TensorOptions & options) {
| ~~~~~~~~~~~~^~~~
/local/ddecatur/DeepRule/DeepRuleVenv/lib/python3.8/site-packages/torch/include/ATen/Functions.h:9182:22: note: candidate: ‘at::Tensor at::zeros(c10::IntArrayRef, const c10::TensorOptions&)’
9182 | static inline Tensor zeros(IntArrayRef size, const TensorOptions & options) {
| ^~~~~
/local/ddecatur/DeepRule/DeepRuleVenv/lib/python3.8/site-packages/torch/include/ATen/Functions.h:9182:40: note: no known conversion for argument 1 from ‘at::DeprecatedTypeProperties’ to ‘c10::IntArrayRef’ {aka ‘c10::ArrayRef’}
9182 | static inline Tensor zeros(IntArrayRef size, const TensorOptions & options) {
| ~~~~~~~~~~~~^~~~
src/top_pool.cpp:45:78: error: no matching function for call to ‘zeros(at::DeprecatedTypeProperties&, )’
45 | auto max_ind = at::zeros(torch::CUDA(at::kLong), {batch, channel, width});
| ^
In file included from /local/ddecatur/DeepRule/DeepRuleVenv/lib/python3.8/site-packages/torch/include/ATen/ATen.h:12,
from /local/ddecatur/DeepRule/DeepRuleVenv/lib/python3.8/site-packages/torch/include/torch/csrc/api/include/torch/types.h:3,
from /local/ddecatur/DeepRule/DeepRuleVenv/lib/python3.8/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader_options.h:4,
from /local/ddecatur/DeepRule/DeepRuleVenv/lib/python3.8/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/base.h:3,
from /local/ddecatur/DeepRule/DeepRuleVenv/lib/python3.8/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/stateful.h:3,
from /local/ddecatur/DeepRule/DeepRuleVenv/lib/python3.8/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader.h:3,
from /local/ddecatur/DeepRule/DeepRuleVenv/lib/python3.8/site-packages/torch/include/torch/csrc/api/include/torch/data.h:3,
from /local/ddecatur/DeepRule/DeepRuleVenv/lib/python3.8/site-packages/torch/include/torch/csrc/api/include/torch/all.h:4,
from /local/ddecatur/DeepRule/DeepRuleVenv/lib/python3.8/site-packages/torch/include/torch/csrc/api/include/torch/torch.h:3,
from src/top_pool.cpp:1:
/local/ddecatur/DeepRule/DeepRuleVenv/lib/python3.8/site-packages/torch/include/ATen/Functions.h:9169:22: note: candidate: ‘at::Tensor at::zeros(c10::IntArrayRef, c10::optional<c10::ArrayRefat::Dimname >, const c10::TensorOptions&)’
9169 | static inline Tensor zeros(IntArrayRef size, c10::optional names, const TensorOptions & options) {
| ^~~~~
/local/ddecatur/DeepRule/DeepRuleVenv/lib/python3.8/site-packages/torch/include/ATen/Functions.h:9169:40: note: no known conversion for argument 1 from ‘at::DeprecatedTypeProperties’ to ‘c10::IntArrayRef’ {aka ‘c10::ArrayRef’}
9169 | static inline Tensor zeros(IntArrayRef size, c10::optional names, const TensorOptions & options) {
| ~~~~~~~~~~~~^~~~
/local/ddecatur/DeepRule/DeepRuleVenv/lib/python3.8/site-packages/torch/include/ATen/Functions.h:9182:22: note: candidate: ‘at::Tensor at::zeros(c10::IntArrayRef, const c10::TensorOptions&)’
9182 | static inline Tensor zeros(IntArrayRef size, const TensorOptions & options) {
| ^~~~~
/local/ddecatur/DeepRule/DeepRuleVenv/lib/python3.8/site-packages/torch/include/ATen/Functions.h:9182:40: note: no known conversion for argument 1 from ‘at::DeprecatedTypeProperties’ to ‘c10::IntArrayRef’ {aka ‘c10::ArrayRef’}
9182 | static inline Tensor zeros(IntArrayRef size, const TensorOptions & options) {
| ~~~~~~~~~~~~^~~~
src/top_pool.cpp:57:81: error: no matching function for call to ‘zeros(at::DeprecatedTypeProperties&, )’
57 | auto gt_mask = at::zeros(torch::CUDA(at::kByte), {batch, channel, width});
| ^
In file included from /local/ddecatur/DeepRule/DeepRuleVenv/lib/python3.8/site-packages/torch/include/ATen/ATen.h:12,
from /local/ddecatur/DeepRule/DeepRuleVenv/lib/python3.8/site-packages/torch/include/torch/csrc/api/include/torch/types.h:3,
from /local/ddecatur/DeepRule/DeepRuleVenv/lib/python3.8/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader_options.h:4,
from /local/ddecatur/DeepRule/DeepRuleVenv/lib/python3.8/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/base.h:3,
from /local/ddecatur/DeepRule/DeepRuleVenv/lib/python3.8/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/stateful.h:3,
from /local/ddecatur/DeepRule/DeepRuleVenv/lib/python3.8/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader.h:3,
from /local/ddecatur/DeepRule/DeepRuleVenv/lib/python3.8/site-packages/torch/include/torch/csrc/api/include/torch/data.h:3,
from /local/ddecatur/DeepRule/DeepRuleVenv/lib/python3.8/site-packages/torch/include/torch/csrc/api/include/torch/all.h:4,
from /local/ddecatur/DeepRule/DeepRuleVenv/lib/python3.8/site-packages/torch/include/torch/csrc/api/include/torch/torch.h:3,
from src/top_pool.cpp:1:
/local/ddecatur/DeepRule/DeepRuleVenv/lib/python3.8/site-packages/torch/include/ATen/Functions.h:9169:22: note: candidate: ‘at::Tensor at::zeros(c10::IntArrayRef, c10::optional<c10::ArrayRefat::Dimname >, const c10::TensorOptions&)’
9169 | static inline Tensor zeros(IntArrayRef size, c10::optional names, const TensorOptions & options) {
| ^~~~~
/local/ddecatur/DeepRule/DeepRuleVenv/lib/python3.8/site-packages/torch/include/ATen/Functions.h:9169:40: note: no known conversion for argument 1 from ‘at::DeprecatedTypeProperties’ to ‘c10::IntArrayRef’ {aka ‘c10::ArrayRef’}
9169 | static inline Tensor zeros(IntArrayRef size, c10::optional names, const TensorOptions & options) {
| ~~~~~~~~~~~~^~~~
/local/ddecatur/DeepRule/DeepRuleVenv/lib/python3.8/site-packages/torch/include/ATen/Functions.h:9182:22: note: candidate: ‘at::Tensor at::zeros(c10::IntArrayRef, const c10::TensorOptions&)’
9182 | static inline Tensor zeros(IntArrayRef size, const TensorOptions & options) {
| ^~~~~
/local/ddecatur/DeepRule/DeepRuleVenv/lib/python3.8/site-packages/torch/include/ATen/Functions.h:9182:40: note: no known conversion for argument 1 from ‘at::DeprecatedTypeProperties’ to ‘c10::IntArrayRef’ {aka ‘c10::ArrayRef’}
9182 | static inline Tensor zeros(IntArrayRef size, const TensorOptions & options) {
| ~~~~~~~~~~~~^~~~
src/top_pool.cpp:58:81: error: no matching function for call to ‘zeros(at::DeprecatedTypeProperties&, )’
58 | auto max_temp = at::zeros(torch::CUDA(at::kFloat), {batch, channel, width});
| ^
In file included from /local/ddecatur/DeepRule/DeepRuleVenv/lib/python3.8/site-packages/torch/include/ATen/ATen.h:12,
from /local/ddecatur/DeepRule/DeepRuleVenv/lib/python3.8/site-packages/torch/include/torch/csrc/api/include/torch/types.h:3,
from /local/ddecatur/DeepRule/DeepRuleVenv/lib/python3.8/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader_options.h:4,
from /local/ddecatur/DeepRule/DeepRuleVenv/lib/python3.8/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/base.h:3,
from /local/ddecatur/DeepRule/DeepRuleVenv/lib/python3.8/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/stateful.h:3,
from /local/ddecatur/DeepRule/DeepRuleVenv/lib/python3.8/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader.h:3,
from /local/ddecatur/DeepRule/DeepRuleVenv/lib/python3.8/site-packages/torch/include/torch/csrc/api/include/torch/data.h:3,
from /local/ddecatur/DeepRule/DeepRuleVenv/lib/python3.8/site-packages/torch/include/torch/csrc/api/include/torch/all.h:4,
from /local/ddecatur/DeepRule/DeepRuleVenv/lib/python3.8/site-packages/torch/include/torch/csrc/api/include/torch/torch.h:3,
from src/top_pool.cpp:1:
/local/ddecatur/DeepRule/DeepRuleVenv/lib/python3.8/site-packages/torch/include/ATen/Functions.h:9169:22: note: candidate: ‘at::Tensor at::zeros(c10::IntArrayRef, c10::optional<c10::ArrayRefat::Dimname >, const c10::TensorOptions&)’
9169 | static inline Tensor zeros(IntArrayRef size, c10::optional names, const TensorOptions & options) {
| ^~~~~
/local/ddecatur/DeepRule/DeepRuleVenv/lib/python3.8/site-packages/torch/include/ATen/Functions.h:9169:40: note: no known conversion for argument 1 from ‘at::DeprecatedTypeProperties’ to ‘c10::IntArrayRef’ {aka ‘c10::ArrayRef’}
9169 | static inline Tensor zeros(IntArrayRef size, c10::optional names, const TensorOptions & options) {
| ~~~~~~~~~~~~^~~~
/local/ddecatur/DeepRule/DeepRuleVenv/lib/python3.8/site-packages/torch/include/ATen/Functions.h:9182:22: note: candidate: ‘at::Tensor at::zeros(c10::IntArrayRef, const c10::TensorOptions&)’
9182 | static inline Tensor zeros(IntArrayRef size, const TensorOptions & options) {
| ^~~~~
/local/ddecatur/DeepRule/DeepRuleVenv/lib/python3.8/site-packages/torch/include/ATen/Functions.h:9182:40: note: no known conversion for argument 1 from ‘at::DeprecatedTypeProperties’ to ‘c10::IntArrayRef’ {aka ‘c10::ArrayRef’}
9182 | static inline Tensor zeros(IntArrayRef size, const TensorOptions & options) {
| ~~~~~~~~~~~~^~~~
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

@soap117
Copy link
Owner

soap117 commented Jun 9, 2021

Please refer to this link
princeton-vl/CornerNet#65

@soap117
Copy link
Owner

soap117 commented Jun 9, 2021

To update the cpp file for the new pytorch version.

@bachish
Copy link

bachish commented Feb 7, 2023

Have the same problem. After previous fixes still don't working
It's help to me (python 3.6, pytorch 1.13.1):

I found what was wrong and I fixed it. The whole problem lies in the fact that Anaconda distribution comes with its own ld linker that is located in /opt/anaconda/compiler_compat/ and it overshadows system ld residing at /usr/bin.

To fix my error I ran python setup.py clean and then I temporarily renamed Anaconda's ld linker to ld-old to make it invisible during PyTorch installation.

https://stackoverflow.com/questions/54492378/problem-with-building-pytorch-from-source-on-linux

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

No branches or pull requests

5 participants