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

CMake Error at /usr/local/share/cmake-3.18/Modules/FindPython/Support.cmake:615 (if): #2701

Closed
xkszltl opened this issue Sep 23, 2020 · 8 comments · Fixed by #2739
Closed

Comments

@xkszltl
Copy link
Contributor

xkszltl commented Sep 23, 2020

🐛 Bug

This is a recent issue.

CMake Error at /usr/local/share/cmake-3.18/Modules/FindPython/Support.cmake:615 (if):
  Syntax error in cmake code at

    /usr/local/share/cmake-3.18/Modules/FindPython/Support.cmake:615 

  when parsing string

    python${version_major}\.${version_minor}+([dmu]*)

  Invalid escape sequence \.
Call Stack (most recent call first):
  /usr/local/share/cmake-3.18/Modules/FindPython/Support.cmake:2756 (_python_get_version)
  /usr/local/share/cmake-3.18/Modules/FindPython3.cmake:389 (include)
  CMakeLists.txt:14 (find_package)


-- Configuring incomplete, errors occurred!

Given 3.18.3 is recently released (we use latest, was 3.18.2), we're not sure whether it's from torchvision or cmake.

Environment

  • PyTorch / torchvision Version (e.g., 1.0 / 0.4.0): master/master
  • OS (e.g., Linux): CentOS 7 / Ubuntu 18.04
  • How you installed PyTorch / torchvision (conda, pip, source): source
  • Build command you used (if compiling from source): cmake-3.18.3 + ninja + (gcc-9 from devtoolset-9/stock gcc-8)
  • Python version: Distro stock python3.
  • CUDA/cuDNN version: 11.0/8
@xkszltl
Copy link
Contributor Author

xkszltl commented Sep 23, 2020

Note pytorch was built just fine. Only torchvision has the issue.

@xkszltl
Copy link
Contributor Author

xkszltl commented Sep 23, 2020

Also filed the issue here in case it's caused by cmake bug: https://gitlab.kitware.com/cmake/cmake/-/issues/21223

@fmassa
Copy link
Member

fmassa commented Sep 24, 2020

Could you try seeing if #2684 is the culprit, and if reverting it makes it work for you?

@xkszltl
Copy link
Contributor Author

xkszltl commented Sep 25, 2020

That's probably not the root cause.
CMake side found their regex bug in 3.18.3.

@xkszltl
Copy link
Contributor Author

xkszltl commented Sep 25, 2020

I tried their patch and works.

@xkszltl
Copy link
Contributor Author

xkszltl commented Sep 25, 2020

Meanwhile there's a hack to make it work in 3.18.3 without patching cmake.
The issue is there's \. which should be \\. instead.
Could you change this line to 3.1?

cmake_minimum_required(VERSION 3.0)

That will set CMP0053=New, which makes the \. recognizable as . (escaped .), and matches everything in regex, including a dot in version.
https://cmake.org/cmake/help/v3.18/policy/CMP0053.html

@fmassa
Copy link
Member

fmassa commented Sep 30, 2020

@xkszltl can you send a PR with the proposed fix, linking to this issue?

xkszltl added a commit to xkszltl/vision that referenced this issue Oct 1, 2020
This is to workaround CMake 3.18.3 bug with a bad regex, which happens to be valid with new parser.
Since probably any distro with CMake 3 won't stuck with 3.0, there shall be no real impact with this increase.
Fix pytorch#2701
@xkszltl
Copy link
Contributor Author

xkszltl commented Oct 1, 2020

Sure, I thought you guys would just put it in whatever PR that comes next.

fmassa pushed a commit that referenced this issue Oct 1, 2020
This is to workaround CMake 3.18.3 bug with a bad regex, which happens to be valid with new parser.
Since probably any distro with CMake 3 won't stuck with 3.0, there shall be no real impact with this increase.
Fix #2701
bryant1410 pushed a commit to bryant1410/vision-1 that referenced this issue Nov 22, 2020
This is to workaround CMake 3.18.3 bug with a bad regex, which happens to be valid with new parser.
Since probably any distro with CMake 3 won't stuck with 3.0, there shall be no real impact with this increase.
Fix pytorch#2701
vfdev-5 pushed a commit to Quansight/vision that referenced this issue Dec 4, 2020
This is to workaround CMake 3.18.3 bug with a bad regex, which happens to be valid with new parser.
Since probably any distro with CMake 3 won't stuck with 3.0, there shall be no real impact with this increase.
Fix pytorch#2701
frostida04 added a commit to frostida04/Vision_Development that referenced this issue Sep 18, 2024
This is to workaround CMake 3.18.3 bug with a bad regex, which happens to be valid with new parser.
Since probably any distro with CMake 3 won't stuck with 3.0, there shall be no real impact with this increase.
Fix pytorch/vision#2701
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants