PyTorch-Encoding
PyTorch-Encoding copied to clipboard
Cannot import encoding
Hi, I can run "python setup.py install" with no errors, but when i try to "import encoding". I got the error like this. Could you help me with that, thanks.
Please install ninja 1.8.2 by following the instructions https://www.claudiokuenzler.com/blog/756/install-newer-ninja-build-tools-ubuntu-14.04-trusty#.WxYrvFMvzJw
I installed the ninja 1.8.2 by the instructions you mentioned, but got the same error @zhanghang1989.
I have got the same error, and I changed ['ninja', '-v'] to ['ninja', '--v'],but the main error also exists, when I try "import encoding", I got error " ImportError: No module named 'enclib_cpu' ", it seems must have one of this
but I have none.
I have run "python setup.py install" with no errors and my ninja version is 1.8.2.
@zhanghang1989 @OasisYang Have you solved it?
Are you using the PyTorch master branch?
@zhanghang1989 I am having the same issues described above. At first I had the RuntimeError: Error building extension 'enclib_cpu'
just like @OasisYang described. Then I tried replacing ['ninja', '-v']
by ['ninja', '--v']
like @liyingying05 did, and also had the ImportError: No module named 'enclib_cpu'
.
I have ninja 1.8.2 installed. I pip-installed torch-encoding with no errors. Also tried installing via setup.py
, which worked fine. I'm working on the Pytorch master branch. Do any of you have solved it?
@vribeiro1 I have solved it using the PyTorch master branch, and the ['ninja', '-v'] should not be changed.
I have successful installed pytorch 0.5 and ninja 1.8.2,however when I import encoding, there has also problems.
`Traceback (most recent call last): File "/home/wuxinting/anaconda3/envs/pytorch-master/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 742, in _build_extension_module ['ninja', '-v'], stderr=subprocess.STDOUT, cwd=build_directory) File "/home/wuxinting/anaconda3/envs/pytorch-master/lib/python3.7/subprocess.py", line 376, in check_output **kwargs).stdout File "/home/wuxinting/anaconda3/envs/pytorch-master/lib/python3.7/subprocess.py", line 468, in run output=stdout, stderr=stderr) subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "
/home/wuxinting/anaconda3/envs/pytorch-master/lib/python3.7/site-packages/encoding/lib/gpu/encoding_kernel.cu(341): error: class "at::Context" has no member "getCurrentCUDAStream"
/home/wuxinting/anaconda3/envs/pytorch-master/lib/python3.7/site-packages/encoding/lib/gpu/encoding_kernel.cu(364): error: class "at::Context" has no member "getCurrentCUDAStream"
/home/wuxinting/anaconda3/envs/pytorch-master/lib/python3.7/site-packages/encoding/lib/gpu/encoding_kernel.cu(391): error: class "at::Context" has no member "getCurrentCUDAStream"
4 errors detected in the compilation of "/tmp/tmpxft_00005f49_00000000-6_encoding_kernel.cpp1.ii". [2/4] /usr/local/cuda/bin/nvcc -DTORCH_EXTENSION_NAME=enclib_gpu -I/home/wuxinting/anaconda3/envs/pytorch-master/lib/python3.7/site-packages/torch/lib/include -I/home/wuxinting/anaconda3/envs/pytorch-master/lib/python3.7/site-packages/torch/lib/include/TH -I/home/wuxinting/anaconda3/envs/pytorch-master/lib/python3.7/site-packages/torch/lib/include/THC -I/usr/local/cuda/include -I/home/wuxinting/anaconda3/envs/pytorch-master/include/python3.7m --compiler-options '-fPIC' -std=c++11 -c /home/wuxinting/anaconda3/envs/pytorch-master/lib/python3.7/site-packages/encoding/lib/gpu/syncbn_kernel.cu -o syncbn_kernel.cuda.o FAILED: syncbn_kernel.cuda.o /usr/local/cuda/bin/nvcc -DTORCH_EXTENSION_NAME=enclib_gpu -I/home/wuxinting/anaconda3/envs/pytorch-master/lib/python3.7/site-packages/torch/lib/include -I/home/wuxinting/anaconda3/envs/pytorch-master/lib/python3.7/site-packages/torch/lib/include/TH -I/home/wuxinting/anaconda3/envs/pytorch-master/lib/python3.7/site-packages/torch/lib/include/THC -I/usr/local/cuda/include -I/home/wuxinting/anaconda3/envs/pytorch-master/include/python3.7m --compiler-options '-fPIC' -std=c++11 -c /home/wuxinting/anaconda3/envs/pytorch-master/lib/python3.7/site-packages/encoding/lib/gpu/syncbn_kernel.cu -o syncbn_kernel.cuda.o /home/wuxinting/anaconda3/envs/pytorch-master/lib/python3.7/site-packages/encoding/lib/gpu/syncbn_kernel.cu(183): error: class "at::Context" has no member "getCurrentCUDAStream"
/home/wuxinting/anaconda3/envs/pytorch-master/lib/python3.7/site-packages/encoding/lib/gpu/syncbn_kernel.cu(217): error: class "at::Context" has no member "getCurrentCUDAStream"
/home/wuxinting/anaconda3/envs/pytorch-master/lib/python3.7/site-packages/encoding/lib/gpu/syncbn_kernel.cu(249): error: class "at::Context" has no member "getCurrentCUDAStream"
/home/wuxinting/anaconda3/envs/pytorch-master/lib/python3.7/site-packages/encoding/lib/gpu/syncbn_kernel.cu(272): error: class "at::Context" has no member "getCurrentCUDAStream"
4 errors detected in the compilation of "/tmp/tmpxft_00005f4a_00000000-6_syncbn_kernel.cpp1.ii". [3/4] /usr/local/cuda/bin/nvcc -DTORCH_EXTENSION_NAME=enclib_gpu -I/home/wuxinting/anaconda3/envs/pytorch-master/lib/python3.7/site-packages/torch/lib/include -I/home/wuxinting/anaconda3/envs/pytorch-master/lib/python3.7/site-packages/torch/lib/include/TH -I/home/wuxinting/anaconda3/envs/pytorch-master/lib/python3.7/site-packages/torch/lib/include/THC -I/usr/local/cuda/include -I/home/wuxinting/anaconda3/envs/pytorch-master/include/python3.7m --compiler-options '-fPIC' -std=c++11 -c /home/wuxinting/anaconda3/envs/pytorch-master/lib/python3.7/site-packages/encoding/lib/gpu/roi_align_kernel.cu -o roi_align_kernel.cuda.o FAILED: roi_align_kernel.cuda.o /usr/local/cuda/bin/nvcc -DTORCH_EXTENSION_NAME=enclib_gpu -I/home/wuxinting/anaconda3/envs/pytorch-master/lib/python3.7/site-packages/torch/lib/include -I/home/wuxinting/anaconda3/envs/pytorch-master/lib/python3.7/site-packages/torch/lib/include/TH -I/home/wuxinting/anaconda3/envs/pytorch-master/lib/python3.7/site-packages/torch/lib/include/THC -I/usr/local/cuda/include -I/home/wuxinting/anaconda3/envs/pytorch-master/include/python3.7m --compiler-options '-fPIC' -std=c++11 -c /home/wuxinting/anaconda3/envs/pytorch-master/lib/python3.7/site-packages/encoding/lib/gpu/roi_align_kernel.cu -o roi_align_kernel.cuda.o /home/wuxinting/anaconda3/envs/pytorch-master/lib/python3.7/site-packages/encoding/lib/gpu/roi_align_kernel.cu(373): error: class "at::Context" has no member "getCurrentCUDAStream"
/home/wuxinting/anaconda3/envs/pytorch-master/lib/python3.7/site-packages/encoding/lib/gpu/roi_align_kernel.cu(373): error: class "at::Context" has no member "getCurrentCUDAStream"
/home/wuxinting/anaconda3/envs/pytorch-master/lib/python3.7/site-packages/encoding/lib/gpu/roi_align_kernel.cu(420): error: class "at::Context" has no member "getCurrentCUDAStream"
/home/wuxinting/anaconda3/envs/pytorch-master/lib/python3.7/site-packages/encoding/lib/gpu/roi_align_kernel.cu(420): error: class "at::Context" has no member "getCurrentCUDAStream"
4 errors detected in the compilation of "/tmp/tmpxft_00005f4b_00000000-6_roi_align_kernel.cpp1.ii". ninja: build stopped: subcommand failed.`
Please install ninja 1.8.2 by following the instructions https://www.claudiokuenzler.com/blog/756/install-newer-ninja-build-tools-ubuntu-14.04-trusty#.WxYrvFMvzJw
@zhanghang1989 Thank you for your reply, I tried in this way, but it doesn't work for me. The main problem for me is enclib_gpu cannot be installed, class "at::Context" has no member "getCurrentCUDAStream". Then I search for the sorece code in pytorch-master, finding that the API has been change to at::cuda::getCurrentCUDAStream, so I replace all the at::globalContext.getCurrentCUDAStream() to at::cuda::getCurrentCUDAStream and edd the header file #include "ATen/cuda/CUDAContext.h" , it is work for me. I think maybe the master branch of pytorch has make some change with the version before?
Thanks a lot @XindyTT ! I will update the repo in next release.
use pytorch=0.4.1 will be ok. My python version is 3.6.7.
This issue should have been fixed by previous PR.
I'm also getting this error: ImportError: No module named 'enclib_cpu'. I did a source install from the Pytorch master branch and installed ninja 1.8.2 as per the link above. Any suggestions?
Maybe it is related to this https://github.com/zhanghang1989/PyTorch-Encoding/issues/140#issuecomment-438373706
i have met the same problem. i have try it on pytorch0.4.1 and pytorch1.0, and also rename torch.h to extension.h, but i still cannot solve it. if anyone solve it?
@zhanghang1989 Thank you for your reply, I tried in this way, but it doesn't work for me. The main problem for me is enclib_gpu cannot be installed, class "at::Context" has no member "getCurrentCUDAStream". Then I search for the sorece code in pytorch-master, finding that the API has been change to at::cuda::getCurrentCUDAStream, so I replace all the at::globalContext.getCurrentCUDAStream() to at::cuda::getCurrentCUDAStream and edd the header file #include "ATen/cuda/CUDAContext.h" , it is work for me. I think maybe the master branch of pytorch has make some change with the version b
@vribeiro1 I have solved it using the PyTorch master branch, and the ['ninja', '-v'] should not be changed.
Hello. What do you mean by using Pytroch master? Do I need uninstall the current Pytorch and install a new version?
@zhanghang1989 Thank you for your reply, I tried in this way, but it doesn't work for me. The main problem for me is enclib_gpu cannot be installed, class "at::Context" has no member "getCurrentCUDAStream". Then I search for the sorece code in pytorch-master, finding that the API has been change to at::cuda::getCurrentCUDAStream, so I replace all the at::globalContext.getCurrentCUDAStream() to at::cuda::getCurrentCUDAStream and edd the header file #include "ATen/cuda/CUDAContext.h" , it is work for me. I think maybe the master branch of pytorch has make some change with the version b
@vribeiro1 I have solved it using the PyTorch master branch, and the ['ninja', '-v'] should not be changed.
Hello. What do you mean by using Pytroch master? Do I need uninstall the current Pytorch and install a new version?
master is the branch of Pytorch in git. However, the API and variable may change if pytorch's version update. I tried the repo in June, where the master of pytorch is version 0.5. And now the version may be higher.
@zhanghang1989 Thank you for your reply, I tried in this way, but it doesn't work for me. The main problem for me is enclib_gpu cannot be installed, class "at::Context" has no member "getCurrentCUDAStream". Then I search for the sorece code in pytorch-master, finding that the API has been change to at::cuda::getCurrentCUDAStream, so I replace all the at::globalContext.getCurrentCUDAStream() to at::cuda::getCurrentCUDAStream and edd the header file #include "ATen/cuda/CUDAContext.h" , it is work for me. I think maybe the master branch of pytorch has make some change with the version b
@vribeiro1 I have solved it using the PyTorch master branch, and the ['ninja', '-v'] should not be changed.
Hello. What do you mean by using Pytroch master? Do I need uninstall the current Pytorch and install a new version?
master is the branch of Pytorch in git. However, the API and variable may change if pytorch's version update. I tried the repo in June, where the master of pytorch is version 0.5. And now the version may be higher.
I see. Thanks for your kind reply.
@vribeiro1 I have solved it using the PyTorch master branch, and the ['ninja', '-v'] should not be changed.
hi,Could you tell me how you solved this problem?ubuntu==16.04,python==3.5,gcc==5.4.0 cuda==9.0 torch-encoding Version is 1.0.0
same problem with torchvision-0.5.0 pytorch-1.4.0 and ninjia 1.8.2
Hi, did you follow the instructions at https://hangzhang.org/PyTorch-Encoding/notes/compile.html
I suggest using the latest anaconda with CUDA 10.0 on ubuntu 16.04.
it doesn't work ,i have tried No module named 'enclib_gpu' @zhanghang1989
do you have saved this problem? @OasisYang
@zhanghang1989 I am having the same issues described above. At first I had the
RuntimeError: Error building extension 'enclib_cpu'
just like @OasisYang described. Then I tried replacing['ninja', '-v']
by['ninja', '--v']
like @liyingying05 did, and also had theImportError: No module named 'enclib_cpu'
.I have ninja 1.8.2 installed. I pip-installed torch-encoding with no errors. Also tried installing via
setup.py
, which worked fine. I'm working on the Pytorch master branch. Do any of you have solved it?
i also meet this problem,have you solved it
what's the mean of PR @zhanghang1989
same problem with torchvision-0.5.0 pytorch-1.4.0 and ninjia 1.8.2
me too
Hi, did you follow the instructions at https://hangzhang.org/PyTorch-Encoding/notes/compile.html
I suggest using the latest anaconda with CUDA 10.0 on ubuntu 16.04.
it doesn't work
Please use pytorch 1.4.0. PyTorch 1.5 is not supported yet.
I am facing an issue like this during my installation of Pytorch_Encoding. I am trying to run this module in Windows. And I am using Anaconda for this purpose. Could someone of you please give me a detailed set of instructions as to how I properly install it and resolve the issue that I captured below:
This is the error I am getting for the installation:
INFO: pip is looking at multiple versions of <Python from Requires-Python> to determine which version is compatible with other requirements. This could take a while. INFO: pip is looking at multiple versions of torch-encoding to determine which version is compatible with other requirements. This could take a while. ERROR: Cannot install torch-encoding and torch-encoding==1.2.2b20210226 because these package versions have conflicting dependencies.
The conflict is caused by: torch-encoding 1.2.2b20210226 depends on torch>=1.4.0 torchvision 0.5.0 depends on torch==1.4.0
To fix this you could try to:
- loosen the range of package versions you've specified
- remove package versions to allow pip attempt to solve the dependency conflict
ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/user_guide/#fixing-conflicting-dependencies
Please uninstall all the existing versions torch-encoding
library in your machine. Then follow the instructions:
https://hangzhang.org/PyTorch-Encoding/notes/compile.html