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

subprocess.CalledProcessError: Command '['where', 'cl']' returned non-zero exit status 1. #39

Open
WitGotFlg opened this issue Aug 7, 2019 · 17 comments

Comments

@WitGotFlg
Copy link

Thanks for your appealing work, but I encountered a problem when having a try on training your code. Here is the error informations:
`
Frame skipped from debugging during step-in.
Note: may have been skipped because of "justMyCode" option (default == true).
F:\anaconda3\lib\site-packages\torch\utils\cpp_extension.py:184: UserWarning: Error checking compiler version for cl: [WinError 2] 系统找不到指定的文件。
warnings.warn('Error checking compiler version for {}: {}'.format(compiler, error))
Traceback (most recent call last):
File "c:\Users\msi-pc.vscode\extensions\ms-python.python-2019.8.29288\pythonFiles\ptvsd_launcher.py", line 43, in
main(ptvsdArgs)
File "c:\Users\msi-pc.vscode\extensions\ms-python.python-2019.8.29288\pythonFiles\lib\python\ptvsd_main_.py", line 432, in main
run()
File "c:\Users\msi-pc.vscode\extensions\ms-python.python-2019.8.29288\pythonFiles\lib\python\ptvsd_main_.py", line 316, in run_file
runpy.run_path(target, run_name='main')
File "F:\anaconda3\lib\runpy.py", line 263, in run_path
pkg_name=pkg_name, script_name=fname)
File "F:\anaconda3\lib\runpy.py", line 96, in run_module_code
mod_name, mod_spec, pkg_name, script_name)
File "F:\anaconda3\lib\runpy.py", line 85, in run_code
exec(code, run_globals)
File "f:\缩小版备份\研究生\19年暑假\HRNet-Semantic-Segmentation-master\tools\train.py", line 27, in
import models
File "f:\缩小版备份\研究生\19年暑假\HRNet-Semantic-Segmentation-master\tools..\lib\models_init
.py", line 11, in
import models.seg_hrnet
File "f:\缩小版备份\研究生\19年暑假\HRNet-Semantic-Segmentation-master\tools..\lib\models\seg_hrnet.py", line 22, in
from .sync_bn.inplace_abn.bn import InPlaceABNSync
File "f:\缩小版备份\研究生\19年暑假\HRNet-Semantic-Segmentation-master\tools..\lib\models\sync_bn_init
.py", line 1, in
from .inplace_abn import bn
File "f:\缩小版备份\研究生\19年暑假\HRNet-Semantic-Segmentation-master\tools..\lib\models\sync_bn\inplace_abn_init_.py", line 1, in
from .bn import ABN, InPlaceABN, InPlaceABNSync
File "f:\缩小版备份\研究生\19年暑假\HRNet-Semantic-Segmentation-master\tools..\lib\models\sync_bn\inplace_abn\bn.py", line 14, in
from functions import *
File "f:\缩小版备份\研究生\19年暑假\HRNet-Semantic-Segmentation-master\lib\models\sync_bn\inplace_abn\functions.py", line 16, in
extra_cuda_cflags=["--expt-extended-lambda"])
File "F:\anaconda3\lib\site-packages\torch\utils\cpp_extension.py", line 644, in load
is_python_module)
File "F:\anaconda3\lib\site-packages\torch\utils\cpp_extension.py", line 813, in _jit_compile
with_cuda=with_cuda)
File "F:\anaconda3\lib\site-packages\torch\utils\cpp_extension.py", line 862, in _write_ninja_file_and_build
with_cuda=with_cuda)
File "F:\anaconda3\lib\site-packages\torch\utils\cpp_extension.py", line 1072, in _write_ninja_file
'cl']).decode().split('\r\n')
File "F:\anaconda3\lib\subprocess.py", line 336, in check_output
**kwargs).stdout
File "F:\anaconda3\lib\subprocess.py", line 418, in run
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['where', 'cl']' returned non-zero exit status 1.

`
How can I fix this problem? ( My pytorch version is 1.1.0, cuda is 9.0) Looking forward to your reply.

@zhangyunming
Copy link

i have also the problem , how ?

@1023198294
Copy link

Same problem, not solved yet

@shuangshuangguo
Copy link

I faced the same problem on windows system, and I solved it through setting environment variables.
Please see more details in https://thebadzhang.github.io/Blog/17/04/CL_CL_VS17.html.

@twister1606
Copy link

Traceback (most recent call last):
File "eval.py", line 185, in
main()
File "eval.py", line 86, in main
model = neurvps.models.VanishingNet(
File "C:\Users\Dimple\neurvps\neurvps\models\vanishing_net.py", line 23, in init
self.anet = ApolloniusNet(output_stride, upsample_scale)
File "C:\Users\Dimple\neurvps\neurvps\models\vanishing_net.py", line 90, in init
self.conv00 = ConicConv(32, 32)
File "C:\Users\Dimple\neurvps\neurvps\models\conic.py", line 12, in init
self.deform_conv = DeformConv(
File "C:\Users\Dimple\neurvps\neurvps\models\deformable.py", line 132, in init
DCN = load_cpp_ext("DCN")
File "C:\Users\Dimple\neurvps\neurvps\models\deformable.py", line 24, in load_cpp_ext
ext = load(
File "C:\Users\Dimple\anaconda3\envs\neurvps\lib\site-packages\torch\utils\cpp_extension.py", line 986, in load
return _jit_compile(
File "C:\Users\Dimple\anaconda3\envs\neurvps\lib\site-packages\torch\utils\cpp_extension.py", line 1193, in _jit_compile
_write_ninja_file_and_build_library(
File "C:\Users\Dimple\anaconda3\envs\neurvps\lib\site-packages\torch\utils\cpp_extension.py", line 1285, in _write_ninja_file_and_build_library
_write_ninja_file_to_build_library(
File "C:\Users\Dimple\anaconda3\envs\neurvps\lib\site-packages\torch\utils\cpp_extension.py", line 1679, in _write_ninja_file_to_build_library
_write_ninja_file(
File "C:\Users\Dimple\anaconda3\envs\neurvps\lib\site-packages\torch\utils\cpp_extension.py", line 1790, in _write_ninja_file
cl_paths = subprocess.check_output(['where',
File "C:\Users\Dimple\anaconda3\envs\neurvps\lib\subprocess.py", line 411, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File "C:\Users\Dimple\anaconda3\envs\neurvps\lib\subprocess.py", line 512, in run
raise CalledProcessError(retcode, process.args, output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['where', 'cl']' returned non-zero exit status 1.

Got this error while working on this project: https://github.com/zhou13/neurvps
Please help us resolve it ASAP

@SUNNYDAY-4176
Copy link

Have you solve this problem?

@JotaCe7
Copy link

JotaCe7 commented Apr 4, 2021

Hi. For this to work you have to make sure that cl command can be called from your prompt. This and this shows solutions for windows 10. But the easiest workaround I found is just add cl.exe dir path to the environmental variables. Default path is "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.22.27905\bin...". choose the right one accordingly to your architecture.

@mohammadrezanaderi4
Copy link

For few of us who cannot read Chinese :

  1. Add two paths to the Path item in the environment variable (remember to add a semicolon):
    E:\VS2017\VC\Tools\MSVC\14.10.25017\bin\HostX64\x64;
    E:\VS2017\Common7\IDE
    The first line is the directory of the compiler, choose it according to the computer, but at least HostX86\x86 is available for all platforms, and the 64-bit system is filled in as in the example

  2. Create a new LIB variable in the environment variable and add three paths (remember to add a semicolon):
    C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\lib\x64;
    C:\Program Files (x86)\Windows Kits\10\Lib\10.0.14393.0\ucrt\x86;
    C:\Program Files (x86)\Windows Kits\8.1\Lib\winv6.3\um\x86;
    The first path is the lib path, if HostX64\x64 is filled in the path variable, then x64 lib is used
    I don’t know if the second path is filled in, but if I fill in the latest version, no problem is found so far.

  3. Create a new INCLUDE variable in the environment variable and add two paths (remember to add a semicolon):
    E:\VS2017\VC\Tools\MSVC\14.10.25017\include;
    C:\Program Files (x86)\Windows Kits\10\Include\10.0.14393.0\ucrt;
    The second path corresponds to the second path above

  4. Click the batch program vcvarall.bat in the path E:\VS2017\VC\Auxiliary\Build. Then open the command line, enter cl, if no error is reported, the configuration is successful...

@bmquynhlinh
Copy link

@mohammadrezanaderi4 thank you! problem solved!

@FilipeF12
Copy link

@mohammadrezanaderi4 thanks for your solution

but did not fully work for me on windows 10. after I removed the semicolon* and ran the bat as follows:

vcvarsall.bat x86_amd64

then I could run 'cl' in a new command prompt successfully.

*semicolon problem for windows 10 mentioned here:
https://stackoverflow.com/questions/8756828/visual-studio-command-prompt-gives-common-was-unexpected-at-this-time

@MationPlays
Copy link

For few of us who cannot read Chinese :

  1. Add two paths to the Path item in the environment variable (remember to add a semicolon):
    E:\VS2017\VC\Tools\MSVC\14.10.25017\bin\HostX64\x64;
    E:\VS2017\Common7\IDE
    The first line is the directory of the compiler, choose it according to the computer, but at least HostX86\x86 is available for all platforms, and the 64-bit system is filled in as in the example
  2. Create a new LIB variable in the environment variable and add three paths (remember to add a semicolon):
    C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\lib\x64;
    C:\Program Files (x86)\Windows Kits\10\Lib\10.0.14393.0\ucrt\x86;
    C:\Program Files (x86)\Windows Kits\8.1\Lib\winv6.3\um\x86;
    The first path is the lib path, if HostX64\x64 is filled in the path variable, then x64 lib is used
    I don’t know if the second path is filled in, but if I fill in the latest version, no problem is found so far.
  3. Create a new INCLUDE variable in the environment variable and add two paths (remember to add a semicolon):
    E:\VS2017\VC\Tools\MSVC\14.10.25017\include;
    C:\Program Files (x86)\Windows Kits\10\Include\10.0.14393.0\ucrt;
    The second path corresponds to the second path above
  4. Click the batch program vcvarall.bat in the path E:\VS2017\VC\Auxiliary\Build. Then open the command line, enter cl, if no error is reported, the configuration is successful...

I use Visual Studio Code does someone have the Paths for VSCode?

@JomanaWael14
Copy link

For few of us who cannot read Chinese :

  1. Add two paths to the Path item in the environment variable (remember to add a semicolon):
    E:\VS2017\VC\Tools\MSVC\14.10.25017\bin\HostX64\x64;
    E:\VS2017\Common7\IDE
    The first line is the directory of the compiler, choose it according to the computer, but at least HostX86\x86 is available for all platforms, and the 64-bit system is filled in as in the example
  2. Create a new LIB variable in the environment variable and add three paths (remember to add a semicolon):
    C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\lib\x64;
    C:\Program Files (x86)\Windows Kits\10\Lib\10.0.14393.0\ucrt\x86;
    C:\Program Files (x86)\Windows Kits\8.1\Lib\winv6.3\um\x86;
    The first path is the lib path, if HostX64\x64 is filled in the path variable, then x64 lib is used
    I don’t know if the second path is filled in, but if I fill in the latest version, no problem is found so far.
  3. Create a new INCLUDE variable in the environment variable and add two paths (remember to add a semicolon):
    E:\VS2017\VC\Tools\MSVC\14.10.25017\include;
    C:\Program Files (x86)\Windows Kits\10\Include\10.0.14393.0\ucrt;
    The second path corresponds to the second path above
  4. Click the batch program vcvarall.bat in the path E:\VS2017\VC\Auxiliary\Build. Then open the command line, enter cl, if no error is reported, the configuration is successful...

I use Visual Studio Code does someone have the Paths for VSCode?

did you find a solution please , I am stuck in this error ?

@claus25
Copy link

claus25 commented May 3, 2022

hello
thank you for your solution. but I don't know how to implement for solve this problem I'm working on RGBD Semantic Segmentation I'm still stuck. please explain me well. thanks for your time

@claus25
Copy link

claus25 commented May 3, 2022

'pwd' is not recognized as an internal or external command,
operable program or batch file.
C:\Users\claus\miniconda3\lib\site-packages\torch\utils\cpp_extension.py:317: UserWarning: Error checking compiler version for cl: [WinError 2] The system cannot find the file specified
warnings.warn(f'Error checking compiler version for {compiler}: {error}')
INFO: Could not find files for the given pattern(s).
Traceback (most recent call last):
File "D:\courses\machine learning\RGBD_Semantic_Segmentation_PyTorch-master\model\SA-Gate.nyu.432\train.py", line 22, in
from furnace.seg_opr.sync_bn.parallel import DataParallelModel, Reduce
File "D:\courses\machine learning\RGBD_Semantic_Segmentation_PyTorch-master\furnace\seg_opr\sync_bn_init_.py", line 8, in
from furnace.seg_opr.sync_bn.syncbn import *
File "D:\courses\machine learning\RGBD_Semantic_Segmentation_PyTorch-master\furnace\seg_opr\sync_bn\syncbn.py", line 17, in
from furnace.seg_opr.sync_bn.functions import *
File "D:\courses\machine learning\RGBD_Semantic_Segmentation_PyTorch-master\furnace\seg_opr\sync_bn\functions.py", line 13, in
from furnace.seg_opr.sync_bn.src import *
File "D:\courses\machine learning\RGBD_Semantic_Segmentation_PyTorch-master\furnace\seg_opr\sync_bn\src_init_.py", line 11, in
cpu = load('syncbn_cpu', [
File "C:\Users\claus\miniconda3\lib\site-packages\torch\utils\cpp_extension.py", line 1125, in load
return _jit_compile(
File "C:\Users\claus\miniconda3\lib\site-packages\torch\utils\cpp_extension.py", line 1338, in _jit_compile
_write_ninja_file_and_build_library(
File "C:\Users\claus\miniconda3\lib\site-packages\torch\utils\cpp_extension.py", line 1437, in _write_ninja_file_and_build_library
_write_ninja_file_to_build_library(
File "C:\Users\claus\miniconda3\lib\site-packages\torch\utils\cpp_extension.py", line 1876, in _write_ninja_file_to_build_library
_write_ninja_file(
File "C:\Users\claus\miniconda3\lib\site-packages\torch\utils\cpp_extension.py", line 2000, in _write_ninja_file
cl_paths = subprocess.check_output(['where',
File "C:\Users\claus\miniconda3\lib\subprocess.py", line 424, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File "C:\Users\claus\miniconda3\lib\subprocess.py", line 531, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['where', 'cl']' returned non-zero exit status 1.

this is the error

@claus25
Copy link

claus25 commented May 3, 2022

oohh I forgot. I have MSV2022

@Latias201
Copy link

'pwd' is not recognized as an internal or external command, operable program or batch file. C:\Users\claus\miniconda3\lib\site-packages\torch\utils\cpp_extension.py:317: UserWarning: Error checking compiler version for cl: [WinError 2] The system cannot find the file specified warnings.warn(f'Error checking compiler version for {compiler}: {error}') INFO: Could not find files for the given pattern(s). Traceback (most recent call last): File "D:\courses\machine learning\RGBD_Semantic_Segmentation_PyTorch-master\model\SA-Gate.nyu.432\train.py", line 22, in from furnace.seg_opr.sync_bn.parallel import DataParallelModel, Reduce File "D:\courses\machine learning\RGBD_Semantic_Segmentation_PyTorch-master\furnace\seg_opr\sync_bn__init__.py", line 8, in from furnace.seg_opr.sync_bn.syncbn import * File "D:\courses\machine learning\RGBD_Semantic_Segmentation_PyTorch-master\furnace\seg_opr\sync_bn\syncbn.py", line 17, in from furnace.seg_opr.sync_bn.functions import * File "D:\courses\machine learning\RGBD_Semantic_Segmentation_PyTorch-master\furnace\seg_opr\sync_bn\functions.py", line 13, in from furnace.seg_opr.sync_bn.src import * File "D:\courses\machine learning\RGBD_Semantic_Segmentation_PyTorch-master\furnace\seg_opr\sync_bn\src__init__.py", line 11, in cpu = load('syncbn_cpu', [ File "C:\Users\claus\miniconda3\lib\site-packages\torch\utils\cpp_extension.py", line 1125, in load return _jit_compile( File "C:\Users\claus\miniconda3\lib\site-packages\torch\utils\cpp_extension.py", line 1338, in _jit_compile _write_ninja_file_and_build_library( File "C:\Users\claus\miniconda3\lib\site-packages\torch\utils\cpp_extension.py", line 1437, in _write_ninja_file_and_build_library _write_ninja_file_to_build_library( File "C:\Users\claus\miniconda3\lib\site-packages\torch\utils\cpp_extension.py", line 1876, in _write_ninja_file_to_build_library _write_ninja_file( File "C:\Users\claus\miniconda3\lib\site-packages\torch\utils\cpp_extension.py", line 2000, in _write_ninja_file cl_paths = subprocess.check_output(['where', File "C:\Users\claus\miniconda3\lib\subprocess.py", line 424, in check_output return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, File "C:\Users\claus\miniconda3\lib\subprocess.py", line 531, in run raise CalledProcessError(retcode, process.args, subprocess.CalledProcessError: Command '['where', 'cl']' returned non-zero exit status 1.

this is the error

do you find a solution, I also encounter this problem

@FilipeF12
Copy link

FilipeF12 commented Feb 27, 2023 via email

@j71200
Copy link

j71200 commented Jan 30, 2024

I have encountered this problem(on Windows) in other python project. In my case, I solved it by

  1. change OS like ubuntu. WSL works in my situation.
    or
  2. run python code in "x64 Native Tools Command Prompt for VS 2019" which comes from Visual Studio 2019.
    or
  3. Add "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\Hostx86\x86" into "Path" of your environment variables.

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