Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

install apex error #720

Open
lshangguan opened this issue Apr 26, 2019 · 12 comments · May be fixed by #1117
Open

install apex error #720

lshangguan opened this issue Apr 26, 2019 · 12 comments · May be fixed by #1117

Comments

@lshangguan
Copy link

lshangguan commented Apr 26, 2019

When I install apex, and type in python setup.py install --cuda_ext --cpp_ext. There is an error as follows:

File "setup.py", line 60, in
raise RuntimeError("--cuda_ext was requested, but nvcc was not found.

I indeed follow the install instruction and install the cudatoolkit in my environment, as shown below:

Name Version Build Channel
backcall 0.1.0 py37_0
blas 1.0 mkl
ca-certificates 2019.1.23 0
certifi 2019.3.9 py37_0
cffi 1.12.3 py37h2e261b9_0
cudatoolkit 10.0.130 0

Can you point out how to fix that? Thanks.

@lzhbrian
Copy link

Same issue here, seems like anaconda installed cudatoolkit does not contain nvcc bin.
Anyone has a proper way to fix this?

@shanggdlk
Copy link

Same issue here, seems like anaconda installed cudatoolkit does not contain nvcc bin.
Anyone has a proper way to fix this?

I think I partially solve it. When you install apex, do this:
python setup.py install instead of python setup.py install --cuda_ext --cpp_ext

@lvpinrui
Copy link

lvpinrui commented May 5, 2019

D:\VS2015\VC\BIN\x86_amd64\link.exe /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:C:\Anaconda3\envs\test\lib\site-packages\torch\lib "/LIBPATH:C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\lib/x64" /LIBPATH:C:\Anaconda3\envs\test\libs /LIBPATH:C:\Anaconda3\envs\test\PCbuild\amd64 /LIBPATH:D:\VS2015\VC\LIB\amd64 /LIBPATH:D:\VS2015\VC\ATLMFC\LIB\amd64 "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.17763.0\ucrt\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\lib\um\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.17763.0\um\x64" cudart.lib c10.lib caffe2.lib torch.lib torch_python.lib caffe2_gpu.lib _C.lib /EXPORT:PyInit_amp_C build\temp.win-amd64-3.7\Release\csrc/amp_C_frontend.obj build\temp.win-amd64-3.7\Release\csrc/multi_tensor_scale_kernel.obj build\temp.win-amd64-3.7\Release\csrc/multi_tensor_axpby_kernel.obj build\temp.win-amd64-3.7\Release\csrc/multi_tensor_l2norm_kernel.obj /OUT:build\lib.win-amd64-3.7\amp_C.cp37-win_amd64.pyd /IMPLIB:build\temp.win-amd64-3.7\Release\csrc\amp_C.cp37-win_amd64.lib
amp_C_frontend.obj : warning LNK4197: 多次指定导出“PyInit_amp_C”;使用第一个规范
正在创建库 build\temp.win-amd64-3.7\Release\csrc\amp_C.cp37-win_amd64.lib 和对象 build\temp.win-amd64-3.7\Release\csrc\amp_C.cp37-win_amd64.exp
multi_tensor_scale_kernel.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: struct CUstream_st * __cdecl c10::cuda::CUDAStream::stream(void)const " (_imp?stream@CUDAStream@cuda@c10@@QEBAPEAUCUstream_st@@xz)
multi_tensor_axpby_kernel.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: struct CUstream_st * __cdecl c10::cuda::CUDAStream::stream(void)const " (_imp?stream@CUDAStream@cuda@c10@@QEBAPEAUCUstream_st@@xz)
multi_tensor_l2norm_kernel.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: struct CUstream_st * __cdecl c10::cuda::CUDAStream::stream(void)const " (_imp?stream@CUDAStream@cuda@c10@@QEBAPEAUCUstream_st@@xz)
multi_tensor_scale_kernel.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) class c10::cuda::CUDAStream __cdecl c10::cuda::getCurrentCUDAStream(short)" (_imp?getCurrentCUDAStream@cuda@c10@@ya?AVCUDAStream@12@F@Z)
multi_tensor_axpby_kernel.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) class c10::cuda::CUDAStream __cdecl c10::cuda::getCurrentCUDAStream(short)" (_imp?getCurrentCUDAStream@cuda@c10@@ya?AVCUDAStream@12@F@Z)
multi_tensor_l2norm_kernel.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) class c10::cuda::CUDAStream __cdecl c10::cuda::getCurrentCUDAStream(short)" (_imp?getCurrentCUDAStream@cuda@c10@@ya?AVCUDAStream@12@F@Z)
build\lib.win-amd64-3.7\amp_C.cp37-win_amd64.pyd : fatal error LNK1120: 2 个无法解析的外部命令
error: command 'D:\VS2015\VC\BIN\x86_amd64\link.exe' failed with exit status 1120

@abcxs
Copy link

abcxs commented May 5, 2019

Same issue here, seems like anaconda installed cudatoolkit does not contain nvcc bin.
Anyone has a proper way to fix this?

I think I partially solve it. When you install apex, do this:
python setup.py install instead of python setup.py install --cuda_ext --cpp_ext

Great, it solves my question

@ztt0821
Copy link

ztt0821 commented Jun 19, 2019

D:\VS2015\VC\BIN\x86_amd64\link.exe /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:C:\Anaconda3\envs\test\lib\site-packages\torch\lib "/LIBPATH:C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\lib/x64" /LIBPATH:C:\Anaconda3\envs\test\libs /LIBPATH:C:\Anaconda3\envs\test\PCbuild\amd64 /LIBPATH:D:\VS2015\VC\LIB\amd64 /LIBPATH:D:\VS2015\VC\ATLMFC\LIB\amd64 "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.17763.0\ucrt\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\lib\um\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.17763.0\um\x64" cudart.lib c10.lib caffe2.lib torch.lib torch_python.lib caffe2_gpu.lib _C.lib /EXPORT:PyInit_amp_C build\temp.win-amd64-3.7\Release\csrc/amp_C_frontend.obj build\temp.win-amd64-3.7\Release\csrc/multi_tensor_scale_kernel.obj build\temp.win-amd64-3.7\Release\csrc/multi_tensor_axpby_kernel.obj build\temp.win-amd64-3.7\Release\csrc/multi_tensor_l2norm_kernel.obj /OUT:build\lib.win-amd64-3.7\amp_C.cp37-win_amd64.pyd /IMPLIB:build\temp.win-amd64-3.7\Release\csrc\amp_C.cp37-win_amd64.lib
amp_C_frontend.obj : warning LNK4197: 多次指定导出“PyInit_amp_C”;使用第一个规范
正在创建库 build\temp.win-amd64-3.7\Release\csrc\amp_C.cp37-win_amd64.lib 和对象 build\temp.win-amd64-3.7\Release\csrc\amp_C.cp37-win_amd64.exp
multi_tensor_scale_kernel.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: struct CUstream_st * __cdecl c10::cuda::CUDAStream::stream(void)const " (_imp?stream@CUDAStream@cuda@c10@@QEBAPEAUCUstream_st@@xz)
multi_tensor_axpby_kernel.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: struct CUstream_st * __cdecl c10::cuda::CUDAStream::stream(void)const " (_imp?stream@CUDAStream@cuda@c10@@QEBAPEAUCUstream_st@@xz)
multi_tensor_l2norm_kernel.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: struct CUstream_st * __cdecl c10::cuda::CUDAStream::stream(void)const " (_imp?stream@CUDAStream@cuda@c10@@QEBAPEAUCUstream_st@@xz)
multi_tensor_scale_kernel.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) class c10::cuda::CUDAStream __cdecl c10::cuda::getCurrentCUDAStream(short)" (_imp?getCurrentCUDAStream@cuda@c10@@ya?AVCUDAStream@12@F@Z)
multi_tensor_axpby_kernel.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) class c10::cuda::CUDAStream __cdecl c10::cuda::getCurrentCUDAStream(short)" (_imp?getCurrentCUDAStream@cuda@c10@@ya?AVCUDAStream@12@F@Z)
multi_tensor_l2norm_kernel.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) class c10::cuda::CUDAStream __cdecl c10::cuda::getCurrentCUDAStream(short)" (_imp?getCurrentCUDAStream@cuda@c10@@ya?AVCUDAStream@12@F@Z)
build\lib.win-amd64-3.7\amp_C.cp37-win_amd64.pyd : fatal error LNK1120: 2 个无法解析的外部命令
error: command 'D:\VS2015\VC\BIN\x86_amd64\link.exe' failed with exit status 1120

I found the same problems, I use vs2017,cuda 10. cudnn7.4.1 python3.6 pytorch1.0.1

@satyajithj
Copy link

@shanggdlk

I think I partially solve it. When you install apex, do this:
python setup.py install instead of python setup.py install --cuda_ext --cpp_ext

Do you not lose CUDA support with this installation procedure?

@shanggdlk
Copy link

@shanggdlk

I think I partially solve it. When you install apex, do this:
python setup.py install instead of python setup.py install --cuda_ext --cpp_ext

Do you not lose CUDA support with this installation procedure?

Hi, I remember everything works fine with CUDA support.

timotheecour added a commit to timotheecour/maskrcnn-benchmark that referenced this issue Oct 1, 2019
@timotheecour timotheecour linked a pull request Oct 1, 2019 that will close this issue
@ada2718
Copy link

ada2718 commented Oct 18, 2019

D:\VS2015\VC\BIN\x86_amd64\link.exe /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:C:\Anaconda3\envs\test\lib\site-packages\torch\lib "/LIBPATH:C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\lib/x64" /LIBPATH:C:\Anaconda3\envs\test\libs /LIBPATH:C:\Anaconda3\envs\test\PCbuild\amd64 /LIBPATH:D:\VS2015\VC\LIB\amd64 /LIBPATH:D:\VS2015\VC\ATLMFC\LIB\amd64 "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.17763.0\ucrt\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\lib\um\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.17763.0\um\x64" cudart.lib c10.lib caffe2.lib torch.lib torch_python.lib caffe2_gpu.lib _C.lib /EXPORT:PyInit_amp_C build\temp.win-amd64-3.7\Release\csrc/amp_C_frontend.obj build\temp.win-amd64-3.7\Release\csrc/multi_tensor_scale_kernel.obj build\temp.win-amd64-3.7\Release\csrc/multi_tensor_axpby_kernel.obj build\temp.win-amd64-3.7\Release\csrc/multi_tensor_l2norm_kernel.obj /OUT:build\lib.win-amd64-3.7\amp_C.cp37-win_amd64.pyd /IMPLIB:build\temp.win-amd64-3.7\Release\csrc\amp_C.cp37-win_amd64.lib
amp_C_frontend.obj : warning LNK4197: 多次指定导出“PyInit_amp_C”;使用第一个规范
正在创建库 build\temp.win-amd64-3.7\Release\csrc\amp_C.cp37-win_amd64.lib 和对象 build\temp.win-amd64-3.7\Release\csrc\amp_C.cp37-win_amd64.exp
multi_tensor_scale_kernel.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: struct CUstream_st * __cdecl c10::cuda::CUDAStream::stream(void)const " (_imp?stream@CUDAStream@cuda@c10@@QEBAPEAUCUstream_st@@xz)
multi_tensor_axpby_kernel.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: struct CUstream_st * __cdecl c10::cuda::CUDAStream::stream(void)const " (_imp?stream@CUDAStream@cuda@c10@@QEBAPEAUCUstream_st@@xz)
multi_tensor_l2norm_kernel.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: struct CUstream_st * __cdecl c10::cuda::CUDAStream::stream(void)const " (_imp?stream@CUDAStream@cuda@c10@@QEBAPEAUCUstream_st@@xz)
multi_tensor_scale_kernel.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) class c10::cuda::CUDAStream __cdecl c10::cuda::getCurrentCUDAStream(short)" (_imp?getCurrentCUDAStream@cuda@c10@@ya?AVCUDAStream@12@F@Z)
multi_tensor_axpby_kernel.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) class c10::cuda::CUDAStream __cdecl c10::cuda::getCurrentCUDAStream(short)" (_imp?getCurrentCUDAStream@cuda@c10@@ya?AVCUDAStream@12@F@Z)
multi_tensor_l2norm_kernel.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) class c10::cuda::CUDAStream __cdecl c10::cuda::getCurrentCUDAStream(short)" (_imp?getCurrentCUDAStream@cuda@c10@@ya?AVCUDAStream@12@F@Z)
build\lib.win-amd64-3.7\amp_C.cp37-win_amd64.pyd : fatal error LNK1120: 2 个无法解析的外部命令
error: command 'D:\VS2015\VC\BIN\x86_amd64\link.exe' failed with exit status 1120

I found the same problems, I use vs2017,cuda 10. cudnn7.4.1 python3.6 pytorch1.0.1

pytorch1.1.0

@lvpinrui
Copy link

lvpinrui commented Oct 18, 2019 via email

@kilarinikhil
Copy link

When I install apex, and type in python setup.py install --cuda_ext --cpp_ext. There is an error as follows:

File "setup.py", line 60, in raise RuntimeError("--cuda_ext was requested, but nvcc was not found.

I indeed follow the install instruction and install the cudatoolkit in my environment, as shown below:

Name Version Build Channel
backcall 0.1.0 py37_0
blas 1.0 mkl
ca-certificates 2019.1.23 0
certifi 2019.3.9 py37_0
cffi 1.12.3 py37h2e261b9_0
cudatoolkit 10.0.130 0

Can you point out how to fix that? Thanks.

I had exactly same problem but finally after hours of exploration I found the solution
You need to follow two things:
Step 1:

Run my shell sciript to install CUDA 10.0 without any issues. It also purges all other versions and ensures clean installation.

Step 2:
Then follow the steps
1.Open terminal
nano /home/$USER/.bashrc
2.Inside there add the following lines
export PATH=/usr/local/cuda-10.0/bin${PATH:+:${PATH}}$
export LD_LIBRARY_PATH=/usr/local/cuda10.0/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
3.Save and close the editor

On you keyboard press the following: 

ctrl + o             --> save 
enter or return key  --> accept changes
ctrl + x             --> close editor
  1. Now either do source .bashrc or close and open another terminal
  2. Now run nvcc --version

@BystanderJ
Copy link

@shanggdlk
I ran into the same problem.
When I installed apex the way you told to , it worked.
But when I ran another program that used apex, it showed this problem: "AttributeError: 'NoneType' object has no attribute 'split'". It's exactly the same problem @Donglin-Wang met. It seems that you would lose CUDA support with this installation procedure. Could you offer another solution please?

@edgarschnfld
Copy link

Same issue here, seems like anaconda installed cudatoolkit does not contain nvcc bin.
Anyone has a proper way to fix this?

I think I partially solve it. When you install apex, do this:
python setup.py install instead of python setup.py install --cuda_ext --cpp_ext

This solved it for me! I'm not even using this mask-rcnn repo... google just brought me here.
First, I tried to install apex as specified on their github page:

git clone https://github.com/NVIDIA/apex
$ cd apex
$ pip install -v --disable-pip-version-check --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" ./

This lengthy pip install command failed. However, simply using python setup.py install made it work.

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

Successfully merging a pull request may close this issue.