Error with cpp_extentions

I encountered this problem first.

>>> from setuptools import setup, Extension
>>> from torch.utils import cpp_extension
INFO: Could not find files for the given pattern(s).

And when I’m trying to use code here to compile a simple extension, I encountered this issue, which I suspect is related to the problem above. But I’m not sure what is it exactly.

UserWarning: Error checking compiler version for cl: [WinError 2] The system cannot find the file specified

I googled this issue but didn’t find a satisfactory answer.

1 Like

Seems related to this issue. And apparently the solution was to upgrade python.

Thanks 4 ur reply.
I’m using Python 3.7.3 with Pytorch 1.1.0 on windows 10, which version of Python should I use with torch 1.1.0?

The reason is that it needs to find the compiler for the cpp_extension, which is called cl. You should have VS 2017 installed, start “x64 Native Tools Command Prompt for VS 2017” and run python in that environment.

2 Likes

Thanks for replying!
Sadly I’m still getting that “INFO” thing even though I ran it in the cmd prompt u mentioned.

The corresponding code: https://github.com/pytorch/pytorch/blob/master/torch/utils/cpp_extension.py#L24-L50. Looks like we didn’t suppress the output of where nvcc. Fix: https://github.com/pytorch/pytorch/pull/32620.

Judging from the code, this warning will display if I don’t have CUDA, correct?

Yes. It will display the warning message if the command where nvcc fails. It may be a result of missing CUDA installation.

Thx. That explains. I’m using cpu version on my pc, because I don’t have cuda installed.

I do have cuda installed. I also have Visual Studio 2019 installed. But, I still get the following error. Any idea why?

C:\Users\myusername\AppData\Local\Continuum\anaconda3\envs\myenvname\lib\site-packages\torch\utils\cpp_extension.py:238: UserWarning: Error checking compiler version for cl: [WinError 2] The system cannot find the file specified
warnings.warn(‘Error checking compiler version for {}: {}’.format(compiler, error))

Hi,
I also got this error:

UserWarning: Error checking compiler version for cl: [WinError 2] The system cannot find the file specified.

How to fix this issue?

Please help.

Thanks

Thanks, it works for me!

Did you fix this? I am having the same issue.