Open ts19970816 opened 4 years ago
Hey @ts19970816 could you add a little context about you environment? For example you can download and run our environment collection script and post the output here.
pytorch1.5.0 torchvision0.6.0 python3.6.5 cuda10.2 cudnn7.6.5 g++ 7.5
master
branch while in your last comment you said torchvision==0.6.0
. Which one is correct?linux master 在哪里下载torchvision=0.6.0
Sorry, but I don't speak Chinese, so I'm relying on Google Translator here. Do you have a reason to install from source or could you simply install the pre-compiled binaries? If source is not required you could run
pip install torch==1.5.0 torchvision==0.6.0 -f https://download.pytorch.org/whl/torch_stable.html
thanks,pip install torch-1.5.0-cp36-cp36m-linux_x86_64.whl pip install torchvision-0.6.0-cp36-cp36m-linux_x86_64.whl 这是我的安装方式
Does this mean, that your problem is resolved or are still facing difficulties of any kind?
没有解决,我还是面临这
1.git clone https://github.com/pytorch/vision.git
2 cd vision
3 mkdir build && cd build
4 cmake -DCMAKE_PREFIX_PATH=/path/to/libtorch -DCMAKE_INSTALL_PREFIX=/where/to/install/torchvision -DCMAKE_BUILD_TYPE=Release ..
5.make
在进行第5步的时候make时候出现错误
ts@ts:~/opt/vision-master/build$ make
[ 4%] Building CXX object CMakeFiles/torchvision.dir/torchvision/csrc/vision.cpp.o
In file included from /home/ts/opt/vision-master/torchvision/csrc/vision.cpp:14:0:
/home/ts/opt/vision-master/torchvision/csrc/ROIAlign.h: In function ‘at::Tensor roi_align(const at::Tensor&, const at::Tensor&, double, int64_t, int64_t, int64_t, bool)’:
/home/ts/opt/vision-master/torchvision/csrc/ROIAlign.h:29:25: error: ‘class c10::OperatorHandle’ has no member named ‘typed’
.typed<decltype(roi_align)>();
^~~~~
/home/ts/opt/vision-master/torchvision/csrc/ROIAlign.h:29:31: error: expected primary-expression before ‘decltype’
.typed<decltype(roi_align)>();
^~~~
/home/ts/opt/vision-master/torchvision/csrc/ROIAlign.h: In function ‘at::Tensor _roi_align_backward(const at::Tensor&, const at::Tensor&, double, int64_t, int64_t, int64_t, int64_t, int64_t, int64_t, int64_t, bool)’:
/home/ts/opt/vision-master/torchvision/csrc/ROIAlign.h:77:12: error: ‘class c10::OperatorHandle’ has no member named ‘typed’
.typed<decltype(_roi_align_backward)>();
^~~~~
/home/ts/opt/vision-master/torchvision/csrc/ROIAlign.h:77:18: error: expected primary-expression before ‘decltype’
.typed<decltype(_roi_align_backward)>();
^~~~
In file included from /home/ts/opt/vision-master/torchvision/csrc/vision.cpp:17:0:
/home/ts/opt/vision-master/torchvision/csrc/nms.h: In function ‘at::Tensor nms(const at::Tensor&, const at::Tensor&, double)’:
/home/ts/opt/vision-master/torchvision/csrc/nms.h:19:25: error: ‘class c10::OperatorHandle’ has no member named ‘typed’
.typed<decltype(nms)>();
^~~~~
/home/ts/opt/vision-master/torchvision/csrc/nms.h:19:31: error: expected primary-expression before ‘decltype’
.typed<decltype(nms)>();
^~~~
/home/ts/opt/vision-master/torchvision/csrc/vision.cpp: At global scope:
/home/ts/opt/vision-master/torchvision/csrc/vision.cpp:45:14: error: expected constructor, destructor, or type conversion before ‘(’ token
TORCH_LIBRARY(torchvision, m) {
^
/home/ts/opt/vision-master/torchvision/csrc/vision.cpp:59:19: error: expected constructor, destructor, or type conversion before ‘(’ token
TORCH_LIBRARY_IMPL(torchvision, CPU, m) {
^
/home/ts/opt/vision-master/torchvision/csrc/vision.cpp:82:19: error: expected constructor, destructor, or type conversion before ‘(’ token
TORCH_LIBRARY_IMPL(torchvision, Autograd, m) {
^
CMakeFiles/torchvision.dir/build.make:518: recipe for target 'CMakeFiles/torchvision.dir/torchvision/csrc/vision.cpp.o' failed
make[2]: [CMakeFiles/torchvision.dir/torchvision/csrc/vision.cpp.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/torchvision.dir/all' failed
make[1]: [CMakeFiles/torchvision.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2
@ts19970816 You need to clarify what you want to do:
torchvision==0.6.0
the pip
command from my previous comment is enough.torchvision
from source you will not get 0.6.0
, but rather the current development version (>= 0.8
)-- Caffe2: CUDA detected: 10.2 -- Caffe2: CUDA nvcc is: /usr/local/cuda/bin/nvcc -- Caffe2: CUDA toolkit directory: /usr/local/cuda -- Caffe2: Header version is: 10.2 -- Found cuDNN: v7.6.5 (include: /usr/local/cuda/include, library: /usr/local/cuda/lib64/libcudnn.so) -- Autodetected CUDA architecture(s): 6.1 -- Added CUDA NVCC flags for: -gencode;arch=compute_61,code=sm_61 CMake Error at CMakeLists.txt:7 (find_package): By not providing "FindTorchVision.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "TorchVision", but CMake did not find one.
Could not find a package configuration file provided by "TorchVision" with any of the following names:
TorchVisionConfig.cmake
torchvision-config.cmake
Add the installation prefix of "TorchVision" to CMAKE_PREFIX_PATH or set "TorchVision_DIR" to a directory containing one of the above files. If "TorchVision" provides a separate development package or SDK, be sure it has been installed.
-- Configuring incomplete, errors occurred! See also "/home/ts/examples/build/CMakeFiles/CMakeOutput.log". See also "/home/ts/examples/build/CMakeFiles/CMakeError.log". 我报这种错误,是不是需要源码安装torchvision
但是我在源码编译安装之前,已经通过pip install torchvision-0.6.0-cp36-cp36m-linux_x86_64.whl这种方式安装过了torchvision
Hi,
It's very difficult for someone like @pmeier or myself who doesn't speak chinese to understand what you want to achieve.
Do you want to use the C++ API, or just the Python bindings? If it's just the Python bindings, you can install via setup.py
.
If you want to use the C++ API, what exactly do you want to do, use an operator in C++, run one of the example models, or something else?
One of the errors you got seemed to be indicating that either you were not using a compatible PyTorch version, or you were not compiling with C++14.
但是我在源码编译安装之前,已经通过pip install torchvision-0.6.0-cp36-cp36m-linux_x86_64.whl这种方式安装过了torchvision
@ts19970816 Could you ask questions in English? For this question, I can translate: Before installed from source code, I have installed torchvision with pip.
libtorch=1.5.0-
When i cmake -DCMAKE_PREFIX_PATH="/opt/libtorch-cxx11-abi-shared-with-deps-1.5.0/libtorch;/home/ts/opt/torchvision" -DCMAKE_BUILD_TYPE=Release .., I have this problem CMake Warning at CMakeLists.txt:12 (find_package): By not providing "FindPython3.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "Python3", but CMake did not find one.
Could not find a package configuration file provided by "Python3" with any of the following names:
Python3Config.cmake
python3-config.cmake
Add the installation prefix of "Python3" to CMAKE_PREFIX_PATH or set "Python3_DIR" to a directory containing one of the above files. If "Python3" provides a separate development package or SDK, be sure it has been installed.
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Found CUDA: /usr/local/cuda (found version "10.2")
-- Caffe2: CUDA detected: 10.2
-- Caffe2: CUDA nvcc is: /usr/local/cuda/bin/nvcc
-- Caffe2: CUDA toolkit directory: /usr/local/cuda
-- Caffe2: Header version is: 10.2
-- Found CUDNN: /usr/local/cuda/lib64/libcudnn.so
-- Found cuDNN: v7.6.5 (include: /usr/local/cuda/include, library: /usr/local/cuda/lib64/libcudnn.so)
-- Autodetected CUDA architecture(s): 6.1
-- Added CUDA NVCC flags for: -gencode;arch=compute_61,code=sm_61
-- Found torch: /opt/libtorch-cxx11-abi-shared-with-deps-1.5.0/libtorch/lib/libtorch.so
-- Configuring done
-- Generating done
-- Build files have been written to: /home/ts/project/vision/build
Last error seems to be due to an old cmake version that doesn't have the Python3 module
@andfoy is working on adding CMake tests to CI in https://github.com/pytorch/vision/pull/2577, which will hopefully make it easier to catch bugs and will give some hints to user on how to use our CMake.
/home/ts/Downloads/vision-master/torchvision/csrc/ROIAlign.h: In function ‘at::Tensor roi_align(const at::Tensor&, const at::Tensor&, double, int64_t, int64_t, int64_t, bool)’: /home/ts/Downloads/vision-master/torchvision/csrc/ROIAlign.h:29:25: error: ‘class c10::OperatorHandle’ has no member named ‘typed’ .typed<decltype(roi_align)>(); ^~~~~ /home/ts/Downloads/vision-master/torchvision/csrc/ROIAlign.h:29:31: error: expected primary-expression before ‘decltype’ .typed<decltype(roi_align)>(); ^
~~~ /home/ts/Downloads/vision-master/torchvision/csrc/ROIAlign.h: In function ‘at::Tensor _roi_align_backward(const at::Tensor&, const at::Tensor&, double, int64_t, int64_t, int64_t, int64_t, int64_t, int64_t, int64_t, bool)’: /home/ts/Downloads/vision-master/torchvision/csrc/ROIAlign.h:77:12: error: ‘class c10::OperatorHandle’ has no member named ‘typed’ .typed<decltype(_roi_align_backward)>(); ^~~~~ /home/ts/Downloads/vision-master/torchvision/csrc/ROIAlign.h:77:18: error: expected primary-expression before ‘decltype’ .typed<decltype(_roi_align_backward)>(); ^~~~ In file included from /home/ts/Downloads/vision-master/torchvision/csrc/vision.cpp:17:0: /home/ts/Downloads/vision-master/torchvision/csrc/nms.h: In function ‘at::Tensor nms(const at::Tensor&, const at::Tensor&, double)’: /home/ts/Downloads/vision-master/torchvision/csrc/nms.h:19:25: error: ‘class c10::OperatorHandle’ has no member named ‘typed’ .typed<decltype(nms)>(); ^~~~~ /home/ts/Downloads/vision-master/torchvision/csrc/nms.h:19:31: error: expected primary-expression before ‘decltype’ .typed<decltype(nms)>(); ^~~~ /home/ts/Downloads/vision-master/torchvision/csrc/vision.cpp: At global scope: /home/ts/Downloads/vision-master/torchvision/csrc/vision.cpp:45:14: error: expected constructor, destructor, or type conversion before ‘(’ token TORCH_LIBRARY(torchvision, m) { ^ /home/ts/Downloads/vision-master/torchvision/csrc/vision.cpp:59:19: error: expected constructor, destructor, or type conversion before ‘(’ token TORCH_LIBRARY_IMPL(torchvision, CPU, m) { ^ /home/ts/Downloads/vision-master/torchvision/csrc/vision.cpp:82:19: error: expected constructor, destructor, or type conversion before ‘(’ token TORCH_LIBRARY_IMPL(torchvision, Autograd, m) { ^ CMakeFiles/torchvision.dir/build.make:518: recipe for target 'CMakeFiles/torchvision.dir/torchvision/csrc/vision.cpp.o' failed make[2]: [CMakeFiles/torchvision.dir/torchvision/csrc/vision.cpp.o] Error 1 CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/torchvision.dir/all' failed make[1]: [CMakeFiles/torchvision.dir/all] Error 2 Makefile:129: recipe for target 'all' failed make: *** [all] Error 2