Closed elliottslaughter closed 8 months ago
I'm also seeing this while trying to build legate on the latest control replication
This should have been fixed by https://gitlab.com/StanfordLegion/legion/-/merge_requests/1072, which has been merged to master.
We're having CI issues (P100 is down and legion-nvidia-01's GPU is misbehaving) so I think it may not have merged downstream yet, but you can try a local merge to get around this.
I already upstreamed this to the latest control replication.
@rohany Can you confirm if that fixes it, and if not, what commit are you on and what does the output look like?
I am on a branch off of the latest control replication (based on refctxindex
) and it does not fix it.
Here's the output (from building Legate):
'/usr/local/Cellar/cmake/3.28.1/bin/cmake' '-E' 'env' 'CMAKE_SOURCE_DIR=/Users/rohany/Documents/nvidia/legate.core' 'CMAKE_BUILD_DIR=/Users/rohany/Documents/nvidia/legate.core/_skbuild/macosx-13.0-x86_64-3.11/cmake-build/_deps/legion-build/runtime' 'CMAKE_INSTALL_PREFIX=/Users/rohany/Documents/nvidia/legate.core/_skbuild/macosx-13.0-x86_64-3.11/cmake-install' '/usr/local/anaconda3/envs/fusion/bin/python3' '-m' 'pip' 'install' '--prefix' '/Users/rohany/Documents/nvidia/legate.core/_skbuild/macosx-13.0-x86_64-3.11/cmake-install' '--ignore-installed' '--root' '/' '--prefix' '/usr/local/anaconda3/envs/fusion' '.'
Processing /Users/rohany/Documents/nvidia/legate.core/legion/bindings/python
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'done'
Building wheels for collected packages: legion
Building wheel for legion (setup.py): started
Building wheel for legion (setup.py): finished with status 'error'
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [40 lines of output]
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "/Users/rohany/Documents/nvidia/legate.core/legion/bindings/python/setup.py", line 43, in <module>
setup(name='legion',
File "/usr/local/anaconda3/envs/fusion/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 185, in setup
return run_commands(dist)
^^^^^^^^^^^^^^^^^^
File "/usr/local/anaconda3/envs/fusion/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
dist.run_commands()
File "/usr/local/anaconda3/envs/fusion/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
self.run_command(cmd)
File "/usr/local/anaconda3/envs/fusion/lib/python3.11/site-packages/setuptools/dist.py", line 1244, in run_command
super().run_command(command)
File "/usr/local/anaconda3/envs/fusion/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
cmd_obj.run()
File "/usr/local/anaconda3/envs/fusion/lib/python3.11/site-packages/wheel/bdist_wheel.py", line 343, in run
self.run_command("build")
File "/usr/local/anaconda3/envs/fusion/lib/python3.11/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
self.distribution.run_command(command)
File "/usr/local/anaconda3/envs/fusion/lib/python3.11/site-packages/setuptools/dist.py", line 1244, in run_command
super().run_command(command)
File "/usr/local/anaconda3/envs/fusion/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
cmd_obj.run()
File "/usr/local/anaconda3/envs/fusion/lib/python3.11/site-packages/setuptools/_distutils/command/build.py", line 131, in run
self.run_command(cmd_name)
File "/usr/local/anaconda3/envs/fusion/lib/python3.11/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
self.distribution.run_command(command)
File "/usr/local/anaconda3/envs/fusion/lib/python3.11/site-packages/setuptools/dist.py", line 1244, in run_command
super().run_command(command)
File "/usr/local/anaconda3/envs/fusion/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
cmd_obj.run()
File "/Users/rohany/Documents/nvidia/legate.core/legion/bindings/python/setup.py", line 38, in run
legion_cffi_build.build_cffi(None, cmake_source_dir, cmake_build_dir, self.build_lib, ['legion.h'], ['runtime'], 'legion_builtin_cffi.py')
File "/Users/rohany/Documents/nvidia/legate.core/legion/bindings/python/legion_cffi_build.py", line 45, in build_cffi
prefix_dir, h_path = find_header(header_file, os.path.join(source_dir, search_dir))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/rohany/Documents/nvidia/legate.core/legion/bindings/python/legion_cffi_build.py", line 35, in find_header
raise Exception('Unable to locate header file: ' + filename + ' in: ' + search_dir)
Exception: Unable to locate header file: legion.h in: /Users/rohany/Documents/nvidia/legate.core/runtime
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for legion
Running setup.py clean for legion
Failed to build legion
ERROR: Could not build wheels for legion, which is required to install pyproject.toml-based projects
Does the Legate build suck the entire Legion CMake into the same project as Legate itself? I can try to work around that, but I'm pretty sure I told the Legate team not to do that. The issues with this approach can get really ugly and I won't support fixes (beyond trivial ones) when things go sideways.
cc @manopapad do you know who has the answer to this question?
Does the Legate build suck the entire Legion CMake into the same project as Legate itself? I can try to work around that, but I'm pretty sure I told the Legate team not to do that. The issues with this approach can get really ugly and I won't support fixes (beyond trivial ones) when things go sideways.
@trxcllnt to answer this question.
@rohany Try this diff and see if it fixes the problem:
diff --git a/bindings/python/CMakeLists.txt b/bindings/python/CMakeLists.txt
index a3f1648ea..75a7bf290 100644
--- a/bindings/python/CMakeLists.txt
+++ b/bindings/python/CMakeLists.txt
@@ -75,8 +75,11 @@ endif()
# Note: CMake 3.19 required for COMMAND_ERROR_IS_FATAL argument to execute_process()
cmake_minimum_required(VERSION 3.19)
+cmake_path(GET CMAKE_CURRENT_SOURCE_DIR PARENT_PATH Legion_ROOT_PROJECT_DIR)
+cmake_path(GET Legion_ROOT_PROJECT_DIR PARENT_PATH Legion_ROOT_PROJECT_DIR)
+
# Use setup.py script to install the Python bindings library
-install(CODE "execute_process(COMMAND ${CMAKE_COMMAND} -E env CMAKE_SOURCE_DIR=${CMAKE_SOURCE_DIR} CMAKE_BUILD_DIR=${Legion_BINARY_DIR}/runtime CMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} ${Python3_EXECUTABLE} -m pip install --prefix \"\${CMAKE_INSTALL_PREFIX}\" --ignore-installed ${Legion_PYTHON_EXTRA_INSTALL_ARGS} . WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMAND_ECHO STDOUT COMMAND_ERROR_IS_FATAL ANY)")
+install(CODE "execute_process(COMMAND ${CMAKE_COMMAND} -E env CMAKE_SOURCE_DIR=${Legion_ROOT_PROJECT_DIR} CMAKE_BUILD_DIR=${Legion_BINARY_DIR}/runtime CMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} ${Python3_EXECUTABLE} -m pip install --prefix \"\${CMAKE_INSTALL_PREFIX}\" --ignore-installed ${Legion_PYTHON_EXTRA_INSTALL_ARGS} . WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMAND_ECHO STDOUT COMMAND_ERROR_IS_FATAL ANY)")
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/examples/hello.py
DESTINATION ${CMAKE_INSTALL_DATADIR}/Legion/python/examples
I see
[0/1] /usr/local/Cellar/cmake/3.28.1/bin/cmake --regenerate-during-build -S/Users/rohany/Documents/nvidia/legate.core -B/Users/rohany/Documents/nvidia/legate.core/_skbuild/macosx-13.0-x86_64-3.11/cmake-build
-- Found Python3: /usr/local/anaconda3/envs/fusion/bin/python3 (found version "3.11.3") found components: Interpreter Development Development.Module Development.Embed
-- CPM: adding package Legion@ (/Users/rohany/Documents/nvidia/legate.core/legion)
-- Found Python3: /usr/local/anaconda3/envs/fusion/bin/python3 (found version "3.11.3") found components: Interpreter
CMake Error at legion/bindings/python/CMakeLists.txt:78 (cmake_path):
cmake_path undefined variable for input path.
CMake Error at legion/bindings/python/CMakeLists.txt:79 (cmake_path):
cmake_path undefined variable for input path.
-- Rust Toolchain: stable-x86_64-apple-darwin
-- Rust Target: x86_64-apple-darwin
-- Using Corrosion as a subdirectory
-- CPM: adding package Thrust@1.17.0.0 (1.17.0)
Sorry, I got the order of arguments wrong. I updated the diff in https://github.com/StanfordLegion/legion/issues/1622#issuecomment-1910877792, can you run again?
It does not work, gives me the same error as the beginning:
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [40 lines of output]
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "/Users/rohany/Documents/nvidia/legate.core/legion/bindings/python/setup.py", line 43, in <module>
setup(name='legion',
File "/usr/local/anaconda3/envs/fusion/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 185, in setup
return run_commands(dist)
^^^^^^^^^^^^^^^^^^
File "/usr/local/anaconda3/envs/fusion/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
dist.run_commands()
File "/usr/local/anaconda3/envs/fusion/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
self.run_command(cmd)
File "/usr/local/anaconda3/envs/fusion/lib/python3.11/site-packages/setuptools/dist.py", line 1244, in run_command
super().run_command(command)
File "/usr/local/anaconda3/envs/fusion/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
cmd_obj.run()
File "/usr/local/anaconda3/envs/fusion/lib/python3.11/site-packages/wheel/bdist_wheel.py", line 343, in run
self.run_command("build")
File "/usr/local/anaconda3/envs/fusion/lib/python3.11/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
self.distribution.run_command(command)
File "/usr/local/anaconda3/envs/fusion/lib/python3.11/site-packages/setuptools/dist.py", line 1244, in run_command
super().run_command(command)
File "/usr/local/anaconda3/envs/fusion/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
cmd_obj.run()
File "/usr/local/anaconda3/envs/fusion/lib/python3.11/site-packages/setuptools/_distutils/command/build.py", line 131, in run
self.run_command(cmd_name)
File "/usr/local/anaconda3/envs/fusion/lib/python3.11/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
self.distribution.run_command(command)
File "/usr/local/anaconda3/envs/fusion/lib/python3.11/site-packages/setuptools/dist.py", line 1244, in run_command
super().run_command(command)
File "/usr/local/anaconda3/envs/fusion/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
cmd_obj.run()
File "/Users/rohany/Documents/nvidia/legate.core/legion/bindings/python/setup.py", line 38, in run
legion_cffi_build.build_cffi(None, cmake_source_dir, cmake_build_dir, self.build_lib, ['legion.h'], ['runtime'], 'legion_builtin_cffi.py')
File "/Users/rohany/Documents/nvidia/legate.core/legion/bindings/python/legion_cffi_build.py", line 45, in build_cffi
prefix_dir, h_path = find_header(header_file, os.path.join(source_dir, search_dir))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/rohany/Documents/nvidia/legate.core/legion/bindings/python/legion_cffi_build.py", line 35, in find_header
raise Exception('Unable to locate header file: ' + filename + ' in: ' + search_dir)
Exception: Unable to locate header file: legion.h in: /Users/rohany/Documents/nvidia/legate.core/runtime
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for legion
Running setup.py clean for legion
Failed to build legion
Can you check your CMakeCaches.txt
to see what the value of Legion_BINARY_DIR
is?
Alternatively you could modify bindings/python/CMakeLists.txt
to add something like:
message(FATAL_ERROR "variables: CMAKE_CURRENT_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR} Legion_ROOT_PROJECT_DIR=${Legion_ROOT_PROJECT_DIR} Legion_BINARY_DIR/runtime=${Legion_BINARY_DIR}/runtime CMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}")
Legion_BINARY_DIR:STATIC=/Users/rohany/Documents/nvidia/legate.core/_skbuild/macosx-13.0-x86_64-3.11/cmake-build/_deps/legion-build
Thanks, but I think I need to the output of https://github.com/StanfordLegion/legion/issues/1622#issuecomment-1911091715 (added just before or just after the install(CODE ...)
line) to be able to see what's going wrong.
CMake Error at legion/bindings/python/CMakeLists.txt:78 (message):
variables:
CMAKE_CURRENT_SOURCE_DIR=/Users/rohany/Documents/nvidia/legate.core/legion/bindings/python
Legion_ROOT_PROJECT_DIR=
Legion_BINARY_DIR/runtime=/Users/rohany/Documents/nvidia/legate.core/_skbuild/macosx-13.0-x86_64-3.11/cmake-build/_deps/legion-build/runtime
CMAKE_INSTALL_PREFIX=/Users/rohany/Documents/nvidia/legate.core/_skbuild/macosx-13.0-x86_64-3.11/cmake-install
Er, and is that after the two cmake_path(GET ...)
lines?
I was expecting to see something like Legion_ROOT_PROJECT_DIR=/Users/rohany/Documents/nvidia/legate.core/legion
, which based on my local testing seems to be coming out fine.
Sorry, i didn't also include your patch from above. Here's the updated output:
variables:
CMAKE_CURRENT_SOURCE_DIR=/Users/rohany/Documents/nvidia/legate.core/legion/bindings/python
Legion_ROOT_PROJECT_DIR=/Users/rohany/Documents/nvidia/legate.core/legion
Legion_BINARY_DIR/runtime=/Users/rohany/Documents/nvidia/legate.core/_skbuild/macosx-13.0-x86_64-3.11/cmake-build/_deps/legion-build/runtime
CMAKE_INSTALL_PREFIX=/Users/rohany/Documents/nvidia/legate.core/_skbuild/macosx-13.0-x86_64-3.11/cmake-install
Thanks. Given these values, I'm not sure how you're getting:
Exception: Unable to locate header file: legion.h in: /Users/rohany/Documents/nvidia/legate.core/runtime
From your comment https://github.com/StanfordLegion/legion/issues/1622#issuecomment-1910997135
Because your most recent printout clearly shows .../legion
as the value and that should be what's getting passed in via CMAKE_SOURCE_DIR=${Legion_ROOT_PROJECT_DIR}
in the diff https://github.com/StanfordLegion/legion/issues/1622#issuecomment-1910877792.
I suppose the next thing you could try is resetting the diff to https://github.com/StanfordLegion/legion/issues/1622#issuecomment-1910877792 and then modify setup.py
as follows:
diff --git a/bindings/python/setup.py b/bindings/python/setup.py
index 50fae74cc..bf9420255 100644
--- a/bindings/python/setup.py
+++ b/bindings/python/setup.py
@@ -22,6 +22,8 @@ cmake_source_dir = os.environ.get('CMAKE_SOURCE_DIR')
cmake_build_dir = os.environ.get('CMAKE_BUILD_DIR')
cmake_install_prefix = os.environ.get('CMAKE_INSTALL_PREFIX')
+print('setup.py CMAKE_SOURCE_DIR=%s CMAKE_BUILD_DIR=%s CMAKE_INSTALL_PREFIX=%s' % (cmake_source_dir, cmake_build_dir, cmake_install_prefix))
+
canonical_python_lib = None
system = platform.system()
if system == 'Linux' or system == 'FreeBSD':
We'll just keep peeling back layers of the onion until we find out where it goes bad, I guess.
So I don't know what changed, but the build has started to work for me....
Here's the diff applied on my repo:
➜ legion git:(automatic-tracing-ctx-index-refactor) ✗ cat diff.txt (fusion) 16:35:01
diff --git a/bindings/python/CMakeLists.txt b/bindings/python/CMakeLists.txt
index a3f1648ea..28554476a 100644
--- a/bindings/python/CMakeLists.txt
+++ b/bindings/python/CMakeLists.txt
@@ -75,8 +75,11 @@ endif()
# Note: CMake 3.19 required for COMMAND_ERROR_IS_FATAL argument to execute_process()
cmake_minimum_required(VERSION 3.19)
+cmake_path(GET CMAKE_CURRENT_SOURCE_DIR PARENT_PATH Legion_ROOT_PROJECT_DIR)
+cmake_path(GET Legion_ROOT_PROJECT_DIR PARENT_PATH Legion_ROOT_PROJECT_DIR)
+
# Use setup.py script to install the Python bindings library
-install(CODE "execute_process(COMMAND ${CMAKE_COMMAND} -E env CMAKE_SOURCE_DIR=${CMAKE_SOURCE_DIR} CMAKE_BUILD_DIR=${Legion_BINARY_DIR}/runtime CMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} ${Python3_EXECUTABLE} -m pip install --prefix \"\${CMAKE_INSTALL_PREFIX}\" --ignore-installed ${Legion_PYTHON_EXTRA_INSTALL_ARGS} . WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMAND_ECHO STDOUT COMMAND_ERROR_IS_FATAL ANY)")
+install(CODE "execute_process(COMMAND ${CMAKE_COMMAND} -E env CMAKE_SOURCE_DIR=${Legion_ROOT_PROJECT_DIR} CMAKE_BUILD_DIR=${Legion_BINARY_DIR}/runtime CMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} ${Python3_EXECUTABLE} -m pip install --prefix \"\${CMAKE_INSTALL_PREFIX}\" --ignore-installed ${Legion_PYTHON_EXTRA_INSTALL_ARGS} . WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMAND_ECHO STDOUT COMMAND_ERROR_IS_FATAL ANY)")
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/examples/hello.py
DESTINATION ${CMAKE_INSTALL_DATADIR}/Legion/python/examples
diff --git a/bindings/python/setup.py b/bindings/python/setup.py
index 50fae74cc..bf9420255 100644
--- a/bindings/python/setup.py
+++ b/bindings/python/setup.py
@@ -22,6 +22,8 @@ cmake_source_dir = os.environ.get('CMAKE_SOURCE_DIR')
cmake_build_dir = os.environ.get('CMAKE_BUILD_DIR')
cmake_install_prefix = os.environ.get('CMAKE_INSTALL_PREFIX')
+print('setup.py CMAKE_SOURCE_DIR=%s CMAKE_BUILD_DIR=%s CMAKE_INSTALL_PREFIX=%s' % (cmake_source_dir, cmake_build_dir, cmake_install_prefix))
+
canonical_python_lib = None
system = platform.system()
if system == 'Linux' or system == 'FreeBSD':
I posted the patch here: https://gitlab.com/StanfordLegion/legion/-/merge_requests/1087
Of a related flavor to #1621, but on Sapling (Ubuntu 20.04), I find that I am unable to install Python with CMake:
At the moment, CMake does not even catch the error (!!) and thus we sail right past without realizing we have not installed Python, leaving the installation empty of actual Python files.
It appears that CMake 3.19 supports a new
COMMAND_ERROR_IS_FATAL
attribute which will at least catch the error, but it's surprising that we apparently have a completely broken Python installation.Ubuntu 20.04, Python 3.8. No Conda, no Homebrew, just default system packages.