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

[Caffe2] cmake3 detection error? #13226

Open
apiszcz opened this issue Oct 28, 2018 · 1 comment
Open

[Caffe2] cmake3 detection error? #13226

apiszcz opened this issue Oct 28, 2018 · 1 comment
Labels

Comments

@apiszcz
Copy link

apiszcz commented Oct 28, 2018

cmake 3 is detected however version check fails?

$ python setup.py install
Building wheel torch-1.0.0a0+1fe8278
running install
setup.py::run()
running build_deps
setup.py::build_deps::run()
+ SYNC_COMMAND=cp
++ command -v rsync
+ '[' -x /usr/bin/rsync ']'
+ SYNC_COMMAND='rsync -lptgoD'
+ CMAKE_COMMAND=cmake
++ command -v cmake3
+ [[ -x /usr/bin/cmake3 ]]
++ command -v cmake
+ [[ -x /usr/bin/cmake ]]
++ cmake --version
++ grep version
++ awk '{print $3}'
+ CMAKE_VERSION=2.8.12.2
++ cmake3 --version
++ awk '{print $3}'
++ grep version
+ CMAKE3_VERSION=3.12.1
++ /home/apiszcz/p/vx/lib/a3/bin/python -c 'from distutils.version import StrictVersion; print(1 if StrictVersion("2.8.12.2") < StrictVersion("3.5.0") and StrictVersion("3.12.1") > StrictVersion("2.8.12.2") else 0)'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/apiszcz/p/vx/lib/a3/lib/python3.5/distutils/version.py", line 40, in __init__
    self.parse(vstring)
  File "/home/apiszcz/p/vx/lib/a3/lib/python3.5/distutils/version.py", line 137, in parse
    raise ValueError("invalid version number '%s'" % vstring)
ValueError: invalid version number '2.8.12.2'
+ CMAKE3_NEEDED=
Failed to run 'bash ../tools/build_pytorch_libs.sh --use-cuda --use-nnpack --use-qnnpack nccl caffe2'
@jgong5
Copy link
Collaborator

jgong5 commented Nov 22, 2018

@apiszcz Try the patch below:

diff --git a/tools/build_pytorch_libs.sh b/tools/build_pytorch_libs.sh
index 39edc5d..69e11d4 100755
--- a/tools/build_pytorch_libs.sh
+++ b/tools/build_pytorch_libs.sh
@@ -28,8 +28,8 @@ if [[ -x "$(command -v cmake3)" ]]; then
         #   cmake3 version 3.11.0 CMake suite maintained and supported by Kitware (kitware.com/cmake).
         # Thus we extract the line that has 'version' in it and hope the actual
         # version number is gonna be the 3rd element
-        CMAKE_VERSION=$(cmake --version | grep 'version' | awk '{print $3}')
-        CMAKE3_VERSION=$(cmake3 --version | grep 'version' | awk '{print $3}')
+        CMAKE_VERSION=$(cmake --version | grep 'version' | awk '{print $3}' | awk -F. '{print $1"."$2"."$3}')
+        CMAKE3_VERSION=$(cmake3 --version | grep 'version' | awk '{print $3}' | awk -F. '{print $1"."$2"."$3}')
         CMAKE3_NEEDED=$($PYTORCH_PYTHON -c "from distutils.version import StrictVersion; print(1 if StrictVersion(\"${CMAKE_VERSION}\") < StrictVersion(\"3.5.0\") and StrictVersion(\"${CMAKE3_VERSION}\") > Stri
     else
         # don't have cmake

facebook-github-bot pushed a commit that referenced this issue Nov 28, 2018
#14331)

Summary:
See #13226
Pull Request resolved: #14331

Differential Revision: D13234639

Pulled By: orionr

fbshipit-source-id: 87880057e84242e4af5ad6bf87e08831aa2c5459
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants