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

[BUG] Trying to use mlx gputrace capture, fails #1946

Open
kushalj1997 opened this issue Mar 8, 2025 · 0 comments
Open

[BUG] Trying to use mlx gputrace capture, fails #1946

kushalj1997 opened this issue Mar 8, 2025 · 0 comments

Comments

@kushalj1997
Copy link

When using pip installed mlx (0.23.2) I get an error saying that capturing is not supported, wasn't able to fix via build from source either

    mx.metal.start_capture(self.trace_file)
RuntimeError: [metal::start_capture] Failed to start: Capturing is not supported.

To Reproduce

Just tried the example in Metal Debugger docs section

self.trace_file = "test_mlx_transformers.gputrace"
mx.metal.start_capture(self.trace_file)

Expected behavior
New to this, but expected model to run normally and GPU trace file to generate at ending of training epochs, but doesn't get pas the initial start_capture call

Desktop (please complete the following information):

  • OS Version: [e.g. MacOS 15.4 Beta (24E5222f)]
  • Version [e.g. 0.23.2]

Additional context
I also tried to build and install mlx from source

  • simply running CMAKE_BUILD_PARALLEL_LEVEL=8 pip install . caused me to run into an import error No module named mlx.core
  • running the editable mode dev install fails with this:
      [ 94%] Building CXX object python/src/CMakeFiles/core.dir/ops.cpp.o
      [ 95%] Building CXX object python/src/CMakeFiles/core.dir/stream.cpp.o
      [ 95%] Building CXX object python/src/CMakeFiles/core.dir/transforms.cpp.o
      [ 96%] Building CXX object python/src/CMakeFiles/core.dir/random.cpp.o
      [ 96%] Building CXX object python/src/CMakeFiles/core.dir/linalg.cpp.o
      [ 97%] Building CXX object python/src/CMakeFiles/core.dir/constants.cpp.o
      [ 98%] Building CXX object python/src/CMakeFiles/core.dir/trees.cpp.o
      [ 98%] Building CXX object python/src/CMakeFiles/core.dir/utils.cpp.o
      [100%] Linking CXX shared module /private/var/folders/p6/yl7jn9ns1tx7j9wbcjrs35yw0000gn/T/tmpcsm391jc.build-lib/mlx/core.cpython-313-darwin.so
      [100%] Built target core
      Install the project...
      -- Install configuration: "Release"
      Traceback (most recent call last):
        File "/opt/homebrew/Cellar/python@3.11/3.11.11/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/setuptools/command/editable_wheel.py", line 139, in run
          self._create_wheel_file(bdist_wheel)
        File "/opt/homebrew/Cellar/python@3.11/3.11.11/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/setuptools/command/editable_wheel.py", line 340, in _create_wheel_file
          files, mapping = self._run_build_commands(dist_name, unpacked, lib, tmp)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/opt/homebrew/Cellar/python@3.11/3.11.11/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/setuptools/command/editable_wheel.py", line 263, in _run_build_commands
          self._run_build_subcommands()
        File "/opt/homebrew/Cellar/python@3.11/3.11.11/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/setuptools/command/editable_wheel.py", line 290, in _run_build_subcommands
          self.run_command(name)
        File "/opt/homebrew/Cellar/python@3.11/3.11.11/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/setuptools/_distutils/cmd.py", line 316, in run_command
          self.distribution.run_command(command)
        File "/opt/homebrew/Cellar/python@3.11/3.11.11/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/setuptools/dist.py", line 995, in run_command
          super().run_command(command)
        File "/opt/homebrew/Cellar/python@3.11/3.11.11/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 973, in run_command
          cmd_obj.run()
        File "<string>", line 117, in run
        File "/opt/homebrew/Cellar/python@3.11/3.11.11/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/setuptools/command/build_ext.py", line 102, in run
          self.copy_extensions_to_source()
        File "/opt/homebrew/Cellar/python@3.11/3.11.11/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/setuptools/command/build_ext.py", line 123, in copy_extensions_to_source
          self.copy_file(regular_file, inplace_file, level=self.verbose)
        File "/opt/homebrew/Cellar/python@3.11/3.11.11/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/setuptools/_distutils/cmd.py", line 354, in copy_file
          return file_util.copy_file(
                 ^^^^^^^^^^^^^^^^^^^^
        File "/opt/homebrew/Cellar/python@3.11/3.11.11/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/setuptools/_distutils/file_util.py", line 108, in copy_file
          raise DistutilsFileError(
      distutils.errors.DistutilsFileError: can't copy '/var/folders/p6/yl7jn9ns1tx7j9wbcjrs35yw0000gn/T/tmpcsm391jc.build-lib/mlx/core.cpython-311-darwin.so': doesn't exist or not a regular file
      /opt/homebrew/Cellar/python@3.11/3.11.11/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/setuptools/_distutils/dist.py:973: _DebuggingTips: Problem in editable installation.
      !!
      
              ********************************************************************************
              An error happened while installing `mlx` in editable mode.
      
              The following steps are recommended to help debug this problem:
      
              - Try to install the project normally, without using the editable mode.
                Does the error still persist?
                (If it does, try fixing the problem before attempting the editable mode).
              - If you are using binary extensions, make sure you have all OS-level
                dependencies installed (e.g. compilers, toolchains, binary libraries, ...).
              - Try the latest version of setuptools (maybe the error was already fixed).
              - If you (or your project dependencies) are using any setuptools extension
                or customization, make sure they support the editable mode.
      
              After following the steps above, if the problem still persists and
              you think this is related to how setuptools handles editable installations,
              please submit a reproducible example
              (see https://stackoverflow.com/help/minimal-reproducible-example) to:
      
                  https://github.com/pypa/setuptools/issues
      
              See https://setuptools.pypa.io/en/latest/userguide/development_mode.html for details.
              ********************************************************************************
      
      !!
        cmd_obj.run()
      error: can't copy '/var/folders/p6/yl7jn9ns1tx7j9wbcjrs35yw0000gn/T/tmpcsm391jc.build-lib/mlx/core.cpython-311-darwin.so': doesn't exist or not a regular file
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building editable for mlx
Failed to build mlx
ERROR: Failed to build installable wheels for some pyproject.toml based projects (mlx)
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

1 participant