ml-explore / mlx

MLX: An array framework for Apple silicon
https://ml-explore.github.io/mlx/
MIT License
14.83k stars 845 forks source link

[BUG] Cannot install MLX locally #1045

Closed NripeshN closed 2 weeks ago

NripeshN commented 3 weeks ago

Hi @awni I am trying to install mlx from the main branch but I am getting the following error


Obtaining file:///Users/nripeshniketan/Documents%20-%20Nripesh%E2%80%99s%20MacBook%20Pro/python_programs/mlx
  Installing build dependencies ... done
  Checking if build backend supports build_editable ... done
  Getting requirements to build editable ... done
  Installing backend dependencies ... done
  Preparing editable metadata (pyproject.toml) ... done
Building wheels for collected packages: mlx
  Building editable for mlx (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building editable for mlx (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [279 lines of output]
      running editable_wheel
      creating /private/var/folders/j_/nbyvxq0j7hl4t1t2px8t3hlm0000gn/T/pip-wheel-7l783k6q/.tmp-t4_c0aaq/mlx.egg-info
      writing /private/var/folders/j_/nbyvxq0j7hl4t1t2px8t3hlm0000gn/T/pip-wheel-7l783k6q/.tmp-t4_c0aaq/mlx.egg-info/PKG-INFO
      writing dependency_links to /private/var/folders/j_/nbyvxq0j7hl4t1t2px8t3hlm0000gn/T/pip-wheel-7l783k6q/.tmp-t4_c0aaq/mlx.egg-info/dependency_links.txt
      writing requirements to /private/var/folders/j_/nbyvxq0j7hl4t1t2px8t3hlm0000gn/T/pip-wheel-7l783k6q/.tmp-t4_c0aaq/mlx.egg-info/requires.txt
      writing top-level names to /private/var/folders/j_/nbyvxq0j7hl4t1t2px8t3hlm0000gn/T/pip-wheel-7l783k6q/.tmp-t4_c0aaq/mlx.egg-info/top_level.txt
      writing manifest file '/private/var/folders/j_/nbyvxq0j7hl4t1t2px8t3hlm0000gn/T/pip-wheel-7l783k6q/.tmp-t4_c0aaq/mlx.egg-info/SOURCES.txt'
      reading manifest file '/private/var/folders/j_/nbyvxq0j7hl4t1t2px8t3hlm0000gn/T/pip-wheel-7l783k6q/.tmp-t4_c0aaq/mlx.egg-info/SOURCES.txt'
      reading manifest template 'MANIFEST.in'
      adding license file 'LICENSE'
      writing manifest file '/private/var/folders/j_/nbyvxq0j7hl4t1t2px8t3hlm0000gn/T/pip-wheel-7l783k6q/.tmp-t4_c0aaq/mlx.egg-info/SOURCES.txt'
      creating '/private/var/folders/j_/nbyvxq0j7hl4t1t2px8t3hlm0000gn/T/pip-wheel-7l783k6q/.tmp-t4_c0aaq/mlx-0.12.0.dev20240428+c4a471c9.dist-info'
      creating /private/var/folders/j_/nbyvxq0j7hl4t1t2px8t3hlm0000gn/T/pip-wheel-7l783k6q/.tmp-t4_c0aaq/mlx-0.12.0.dev20240428+c4a471c9.dist-info/WHEEL
      running build_py
      running build_ext
      -- The C compiler identification is AppleClang 15.0.0.15000309
      -- The CXX compiler identification is AppleClang 15.0.0.15000309
      -- Detecting C compiler ABI info
      -- Detecting C compiler ABI info - done
      -- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped
      -- Detecting C compile features
      -- Detecting C compile features - done
      -- Detecting CXX compiler ABI info
      -- Detecting CXX compiler ABI info - done
      -- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
      -- Detecting CXX compile features
      -- Detecting CXX compile features - done
      -- Building MLX for arm64 processor on Darwin
      -- Building METAL sources
      -- Building with SDK for macOS version 14.4

      -- Accelerate found /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk/System/Library/Frameworks/Accelerate.framework
      -- Downloading json
      -- Using the multi-header code from /private/var/folders/j_/nbyvxq0j7hl4t1t2px8t3hlm0000gn/T/tmp533adx9u.build-temp/mlx.core/_deps/json-src/include/
      -- Downloading gguflib
      -- Building Python bindings.
      -- Found Python: /Users/nripeshniketan/Documents - Nripesh’s MacBook Pro/python_programs/mlx/venv/bin/python3.10 (found suitable version "3.10.14", minimum required is "3.8") found components: Interpreter Development.Module
      -- Configuring done (7.8s)
      -- Generating done (0.0s)
      -- Build files have been written to: /private/var/folders/j_/nbyvxq0j7hl4t1t2px8t3hlm0000gn/T/tmp533adx9u.build-temp/mlx.core
      [  0%] Generating compiled_preamble.cpp
      [  1%] Generating compiled_preamble.cpp
      [  1%] Building C object mlx/io/CMakeFiles/gguflib.dir/__/__/_deps/gguflib-src/fp16.c.o
      [  2%] Building CXX object python/src/CMakeFiles/nanobind-static.dir/private/var/folders/j_/nbyvxq0j7hl4t1t2px8t3hlm0000gn/T/pip-build-env-dwt2v0gd/overlay/lib/python3.10/site-packages/nanobind/src/nb_internals.cpp.o
      [  4%] Building CXX object python/src/CMakeFiles/nanobind-static.dir/private/var/folders/j_/nbyvxq0j7hl4t1t2px8t3hlm0000gn/T/pip-build-env-dwt2v0gd/overlay/lib/python3.10/site-packages/nanobind/src/implicit.cpp.o
      [  4%] Building C object mlx/io/CMakeFiles/gguflib.dir/__/__/_deps/gguflib-src/gguflib.c.o
      [  6%] Building CXX object python/src/CMakeFiles/nanobind-static.dir/private/var/folders/j_/nbyvxq0j7hl4t1t2px8t3hlm0000gn/T/pip-build-env-dwt2v0gd/overlay/lib/python3.10/site-packages/nanobind/src/nb_static_property.cpp.o
      [  6%] Building CXX object python/src/CMakeFiles/nanobind-static.dir/private/var/folders/j_/nbyvxq0j7hl4t1t2px8t3hlm0000gn/T/pip-build-env-dwt2v0gd/overlay/lib/python3.10/site-packages/nanobind/src/nb_ndarray.cpp.o
      [  7%] Building arange.air
      [  8%] Building scatter.air
      [  9%] Building CXX object python/src/CMakeFiles/nanobind-static.dir/private/var/folders/j_/nbyvxq0j7hl4t1t2px8t3hlm0000gn/T/pip-build-env-dwt2v0gd/overlay/lib/python3.10/site-packages/nanobind/src/trampoline.cpp.o
      [  9%] Building steel_gemm_addmm.air
      [ 10%] Building CXX object python/src/CMakeFiles/nanobind-static.dir/private/var/folders/j_/nbyvxq0j7hl4t1t2px8t3hlm0000gn/T/pip-build-env-dwt2v0gd/overlay/lib/python3.10/site-packages/nanobind/src/nb_func.cpp.o
      [ 11%] Building CXX object python/src/CMakeFiles/nanobind-static.dir/private/var/folders/j_/nbyvxq0j7hl4t1t2px8t3hlm0000gn/T/pip-build-env-dwt2v0gd/overlay/lib/python3.10/site-packages/nanobind/src/nb_type.cpp.o
      [ 11%] Building CXX object python/src/CMakeFiles/nanobind-static.dir/private/var/folders/j_/nbyvxq0j7hl4t1t2px8t3hlm0000gn/T/pip-build-env-dwt2v0gd/overlay/lib/python3.10/site-packages/nanobind/src/nb_enum.cpp.o
      [ 11%] Building sort.air
      [ 12%] Building reduce_all.air
      [ 13%] Building reduce_col.air
      [ 14%] Building CXX object python/src/CMakeFiles/nanobind-static.dir/private/var/folders/j_/nbyvxq0j7hl4t1t2px8t3hlm0000gn/T/pip-build-env-dwt2v0gd/overlay/lib/python3.10/site-packages/nanobind/src/common.cpp.o
      [ 14%] Building CXX object python/src/CMakeFiles/nanobind-static.dir/private/var/folders/j_/nbyvxq0j7hl4t1t2px8t3hlm0000gn/T/pip-build-env-dwt2v0gd/overlay/lib/python3.10/site-packages/nanobind/src/error.cpp.o
      [ 14%] Building reduce_init.air
      [ 15%] Building steel_gemm_masked.air
      [ 17%] Building steel_conv_general.air
      [ 17%] Building ternary.air
      [ 18%] Building unary.air
      [ 18%] Building steel_gemm.air
      [ 19%] Building layer_norm.air
      [ 19%] Building scaled_dot_product_attention.air
      [ 20%] Building steel_conv.air
      [ 21%] Building softmax.air
      [ 23%] Building reduce_row.air
      [ 23%] Building steel_gemm_splitk.air
      [ 24%] Building gather.air
      [ 24%] Building quantized.air
      [ 25%] Building binary_two.air
      [ 26%] Building conv.air
      [ 27%] Building gemv.air
      [ 28%] Building rms_norm.air
      [ 29%] Building scan.air
      [ 30%] Building arg_reduce.air
      [ 31%] Building copy.air
      [ 31%] Building fft.air
      [ 32%] Building rope.air
      [ 32%] Building binary.air
      [ 33%] Building random.air
      [ 33%] Built target compiled_preamble
      [ 33%] Built target cpu_compiled_preamble
      [ 34%] Linking C static library libgguflib.a
      [ 34%] Built target gguflib
      [ 35%] Linking CXX static library libnanobind-static.a
      [ 35%] Built target nanobind-static
      [ 36%] Building mlx.metallib
      [ 36%] Built target mlx-metallib
      [ 38%] Building CXX object CMakeFiles/mlx.dir/mlx/allocator.cpp.o
      [ 40%] Building CXX object CMakeFiles/mlx.dir/mlx/scheduler.cpp.o
      [ 38%] Building CXX object CMakeFiles/mlx.dir/mlx/compile.cpp.o
      [ 41%] Building CXX object CMakeFiles/mlx.dir/mlx/array.cpp.o
      [ 42%] Building CXX object CMakeFiles/mlx.dir/mlx/ops.cpp.o
      [ 42%] Building CXX object CMakeFiles/mlx.dir/mlx/transforms.cpp.o
      [ 43%] Building CXX object CMakeFiles/mlx.dir/mlx/dtype.cpp.o
      [ 43%] Building CXX object CMakeFiles/mlx.dir/mlx/fft.cpp.o
      [ 43%] Building CXX object CMakeFiles/mlx.dir/mlx/fast.cpp.o
      [ 43%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/common/compiled.cpp.o
      [ 44%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/common/binary.cpp.o
      [ 46%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/common/quantized.cpp.o
      [ 46%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/common/fft.cpp.o
      [ 46%] Building CXX object CMakeFiles/mlx.dir/mlx/random.cpp.o
      [ 47%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/common/masked_mm.cpp.o
      [ 48%] Building CXX object CMakeFiles/mlx.dir/mlx/graph_utils.cpp.o
      [ 49%] Building CXX object CMakeFiles/mlx.dir/mlx/linalg.cpp.o
      [ 50%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/common/arg_reduce.cpp.o
      [ 50%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/common/reduce.cpp.o
      [ 51%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/common/erf.cpp.o
      [ 52%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/common/conv.cpp.o
      [ 52%] Building CXX object CMakeFiles/mlx.dir/mlx/utils.cpp.o
      [ 53%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/common/inverse.cpp.o
      [ 54%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/common/scan.cpp.o
      [ 55%] Building CXX object CMakeFiles/mlx.dir/mlx/io/gguf.cpp.o
      [ 56%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/common/primitives.cpp.o
      [ 57%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/common/copy.cpp.o
      [ 58%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/common/select.cpp.o
      [ 58%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/common/qrf.cpp.o
      [ 59%] Building CXX object CMakeFiles/mlx.dir/mlx/device.cpp.o
      [ 59%] Building CXX object CMakeFiles/mlx.dir/mlx/primitives.cpp.o
      [ 60%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/common/compiled_preamble.cpp.o
      [ 61%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/common/indexing.cpp.o
      [ 62%] Building CXX object CMakeFiles/mlx.dir/mlx/io/safetensor.cpp.o
      [ 62%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/common/compiled_cpu.cpp.o
      [ 63%] Building CXX object CMakeFiles/mlx.dir/mlx/io/load.cpp.o
      [ 64%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/accelerate/reduce.cpp.o
      [ 64%] Building CXX object CMakeFiles/mlx.dir/mlx/io/gguf_quants.cpp.o
      [ 65%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/metal/scan.cpp.o
      [ 66%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/common/threefry.cpp.o
      [ 66%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/metal/device.cpp.o
      [ 67%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/common/load.cpp.o
      [ 68%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/common/svd.cpp.o
      [ 69%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/common/softmax.cpp.o
      [ 70%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/metal/conv.cpp.o
      [ 71%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/metal/compiled_preamble.cpp.o
      [ 72%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/accelerate/softmax.cpp.o
      [ 73%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/metal/fft.cpp.o
      [ 74%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/accelerate/primitives.cpp.o
      [ 74%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/metal/matmul.cpp.o
      [ 75%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/metal/primitives.cpp.o
      [ 76%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/metal/scaled_dot_product_attention.cpp.o
      [ 77%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/metal/event.cpp.o
      [ 78%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/metal/normalization.cpp.o
      [ 79%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/metal/compiled.cpp.o
      [ 79%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/metal/softmax.cpp.o
      [ 80%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/accelerate/matmul.cpp.o
      [ 81%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/metal/reduce.cpp.o
      [ 81%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/metal/quantized.cpp.o
      [ 82%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/metal/indexing.cpp.o
      [ 82%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/metal/allocator.cpp.o
      [ 83%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/metal/rope.cpp.o
      [ 83%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/accelerate/quantized.cpp.o
      [ 84%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/metal/metal.cpp.o
      [ 84%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/common/sort.cpp.o
      [ 85%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/accelerate/conv.cpp.o
      [ 86%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/metal/copy.cpp.o
      [ 87%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/metal/sort.cpp.o
      /Users/nripeshniketan/Documents - Nripesh’s MacBook Pro/python_programs/mlx/mlx/backend/metal/event.cpp:21:14: error: no member named 'waitUntilSignaledValue' in 'MTL::SharedEvent'
                 ->waitUntilSignaledValue(value(), -1)) {
                   ^
      1 error generated.
      make[2]: *** [CMakeFiles/mlx.dir/mlx/backend/metal/event.cpp.o] Error 1
      make[2]: *** Waiting for unfinished jobs....
      make[1]: *** [CMakeFiles/mlx.dir/all] Error 2
      make: *** [all] Error 2
      Traceback (most recent call last):
        File "/private/var/folders/j_/nbyvxq0j7hl4t1t2px8t3hlm0000gn/T/pip-build-env-dwt2v0gd/overlay/lib/python3.10/site-packages/setuptools/command/editable_wheel.py", line 155, in run
          self._create_wheel_file(bdist_wheel)
        File "/private/var/folders/j_/nbyvxq0j7hl4t1t2px8t3hlm0000gn/T/pip-build-env-dwt2v0gd/overlay/lib/python3.10/site-packages/setuptools/command/editable_wheel.py", line 357, in _create_wheel_file
          files, mapping = self._run_build_commands(dist_name, unpacked, lib, tmp)
        File "/private/var/folders/j_/nbyvxq0j7hl4t1t2px8t3hlm0000gn/T/pip-build-env-dwt2v0gd/overlay/lib/python3.10/site-packages/setuptools/command/editable_wheel.py", line 280, in _run_build_commands
          self._run_build_subcommands()
        File "/private/var/folders/j_/nbyvxq0j7hl4t1t2px8t3hlm0000gn/T/pip-build-env-dwt2v0gd/overlay/lib/python3.10/site-packages/setuptools/command/editable_wheel.py", line 307, in _run_build_subcommands
          self.run_command(name)
        File "/private/var/folders/j_/nbyvxq0j7hl4t1t2px8t3hlm0000gn/T/pip-build-env-dwt2v0gd/overlay/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 316, in run_command
          self.distribution.run_command(command)
        File "/private/var/folders/j_/nbyvxq0j7hl4t1t2px8t3hlm0000gn/T/pip-build-env-dwt2v0gd/overlay/lib/python3.10/site-packages/setuptools/dist.py", line 967, in run_command
          super().run_command(command)
        File "/private/var/folders/j_/nbyvxq0j7hl4t1t2px8t3hlm0000gn/T/pip-build-env-dwt2v0gd/overlay/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "<string>", line 109, in run
        File "/private/var/folders/j_/nbyvxq0j7hl4t1t2px8t3hlm0000gn/T/pip-build-env-dwt2v0gd/overlay/lib/python3.10/site-packages/setuptools/command/build_ext.py", line 91, in run
          _build_ext.run(self)
        File "/private/var/folders/j_/nbyvxq0j7hl4t1t2px8t3hlm0000gn/T/pip-build-env-dwt2v0gd/overlay/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 359, in run
          self.build_extensions()
        File "/private/var/folders/j_/nbyvxq0j7hl4t1t2px8t3hlm0000gn/T/pip-build-env-dwt2v0gd/overlay/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 479, in build_extensions
          self._build_extensions_serial()
        File "/private/var/folders/j_/nbyvxq0j7hl4t1t2px8t3hlm0000gn/T/pip-build-env-dwt2v0gd/overlay/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 505, in _build_extensions_serial
          self.build_extension(ext)
        File "<string>", line 101, in build_extension
        File "/opt/homebrew/Cellar/python@3.10/3.10.14/Frameworks/Python.framework/Versions/3.10/lib/python3.10/subprocess.py", line 526, in run
          raise CalledProcessError(retcode, process.args,
      subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--target', 'install']' returned non-zero exit status 2.
      /private/var/folders/j_/nbyvxq0j7hl4t1t2px8t3hlm0000gn/T/pip-build-env-dwt2v0gd/overlay/lib/python3.10/site-packages/setuptools/_distutils/dist.py:988: _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()
      Traceback (most recent call last):
        File "/Users/nripeshniketan/Documents - Nripesh’s MacBook Pro/python_programs/mlx/venv/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/Users/nripeshniketan/Documents - Nripesh’s MacBook Pro/python_programs/mlx/venv/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/Users/nripeshniketan/Documents - Nripesh’s MacBook Pro/python_programs/mlx/venv/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 273, in build_editable
          return hook(wheel_directory, config_settings, metadata_directory)
        File "/private/var/folders/j_/nbyvxq0j7hl4t1t2px8t3hlm0000gn/T/pip-build-env-dwt2v0gd/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 443, in build_editable
          return self._build_with_temp_dir(
        File "/private/var/folders/j_/nbyvxq0j7hl4t1t2px8t3hlm0000gn/T/pip-build-env-dwt2v0gd/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 395, in _build_with_temp_dir
          self.run_setup()
        File "/private/var/folders/j_/nbyvxq0j7hl4t1t2px8t3hlm0000gn/T/pip-build-env-dwt2v0gd/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 311, in run_setup
          exec(code, locals())
        File "<string>", line 164, in <module>
        File "/private/var/folders/j_/nbyvxq0j7hl4t1t2px8t3hlm0000gn/T/pip-build-env-dwt2v0gd/overlay/lib/python3.10/site-packages/setuptools/__init__.py", line 104, in setup
          return distutils.core.setup(**attrs)
        File "/private/var/folders/j_/nbyvxq0j7hl4t1t2px8t3hlm0000gn/T/pip-build-env-dwt2v0gd/overlay/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 184, in setup
          return run_commands(dist)
        File "/private/var/folders/j_/nbyvxq0j7hl4t1t2px8t3hlm0000gn/T/pip-build-env-dwt2v0gd/overlay/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 200, in run_commands
          dist.run_commands()
        File "/private/var/folders/j_/nbyvxq0j7hl4t1t2px8t3hlm0000gn/T/pip-build-env-dwt2v0gd/overlay/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
          self.run_command(cmd)
        File "/private/var/folders/j_/nbyvxq0j7hl4t1t2px8t3hlm0000gn/T/pip-build-env-dwt2v0gd/overlay/lib/python3.10/site-packages/setuptools/dist.py", line 967, in run_command
          super().run_command(command)
        File "/private/var/folders/j_/nbyvxq0j7hl4t1t2px8t3hlm0000gn/T/pip-build-env-dwt2v0gd/overlay/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/private/var/folders/j_/nbyvxq0j7hl4t1t2px8t3hlm0000gn/T/pip-build-env-dwt2v0gd/overlay/lib/python3.10/site-packages/setuptools/command/editable_wheel.py", line 155, in run
          self._create_wheel_file(bdist_wheel)
        File "/private/var/folders/j_/nbyvxq0j7hl4t1t2px8t3hlm0000gn/T/pip-build-env-dwt2v0gd/overlay/lib/python3.10/site-packages/setuptools/command/editable_wheel.py", line 357, in _create_wheel_file
          files, mapping = self._run_build_commands(dist_name, unpacked, lib, tmp)
        File "/private/var/folders/j_/nbyvxq0j7hl4t1t2px8t3hlm0000gn/T/pip-build-env-dwt2v0gd/overlay/lib/python3.10/site-packages/setuptools/command/editable_wheel.py", line 280, in _run_build_commands
          self._run_build_subcommands()
        File "/private/var/folders/j_/nbyvxq0j7hl4t1t2px8t3hlm0000gn/T/pip-build-env-dwt2v0gd/overlay/lib/python3.10/site-packages/setuptools/command/editable_wheel.py", line 307, in _run_build_subcommands
          self.run_command(name)
        File "/private/var/folders/j_/nbyvxq0j7hl4t1t2px8t3hlm0000gn/T/pip-build-env-dwt2v0gd/overlay/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 316, in run_command
          self.distribution.run_command(command)
        File "/private/var/folders/j_/nbyvxq0j7hl4t1t2px8t3hlm0000gn/T/pip-build-env-dwt2v0gd/overlay/lib/python3.10/site-packages/setuptools/dist.py", line 967, in run_command
          super().run_command(command)
        File "/private/var/folders/j_/nbyvxq0j7hl4t1t2px8t3hlm0000gn/T/pip-build-env-dwt2v0gd/overlay/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "<string>", line 109, in run
        File "/private/var/folders/j_/nbyvxq0j7hl4t1t2px8t3hlm0000gn/T/pip-build-env-dwt2v0gd/overlay/lib/python3.10/site-packages/setuptools/command/build_ext.py", line 91, in run
          _build_ext.run(self)
        File "/private/var/folders/j_/nbyvxq0j7hl4t1t2px8t3hlm0000gn/T/pip-build-env-dwt2v0gd/overlay/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 359, in run
          self.build_extensions()
        File "/private/var/folders/j_/nbyvxq0j7hl4t1t2px8t3hlm0000gn/T/pip-build-env-dwt2v0gd/overlay/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 479, in build_extensions
          self._build_extensions_serial()
        File "/private/var/folders/j_/nbyvxq0j7hl4t1t2px8t3hlm0000gn/T/pip-build-env-dwt2v0gd/overlay/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 505, in _build_extensions_serial
          self.build_extension(ext)
        File "<string>", line 101, in build_extension
        File "/opt/homebrew/Cellar/python@3.10/3.10.14/Frameworks/Python.framework/Versions/3.10/lib/python3.10/subprocess.py", line 526, in run
          raise CalledProcessError(retcode, process.args,
      subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--target', 'install']' returned non-zero exit status 2.
      [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: Could not build wheels for mlx, which is required to install pyproject.toml-based projects```
awni commented 3 weeks ago

Looks like it's not applying the metal-cpp patch properly.

Could you try a couple things:

  1. Wipe the build/ directory and try again?
  2. Check the output of which patch and paste here?
NripeshN commented 3 weeks ago

Looks like it's not applying the metal-cpp patch properly.

Could you try a couple things:

  1. Wipe the build/ directory and try again?
  2. Check the output of which patch and paste here?

I have created new venvs and tried installing without cache too. I still get this error

(venv) nripeshniketan@Nripeshs-MBP ~/D/p/mlx (main) [0|1]> which patch
/opt/homebrew/bin/patch
awni commented 3 weeks ago

🤷‍♂️ not sure why it's not applying the patch. You could try changing this line https://github.com/ml-explore/mlx/blob/main/CMakeLists.txt#L97

to

    PATCH_COMMAND /usr/bin/patch -N -i ${METAL_CPP_PATCH} || true

If that doesn't work, we could try to have you apply the patch manually and see what the error is.

NripeshN commented 3 weeks ago

🤷‍♂️ not sure why it's not applying the patch. You could try changing this line https://github.com/ml-explore/mlx/blob/main/CMakeLists.txt#L97

to

    PATCH_COMMAND /usr/bin/patch -N -i ${METAL_CPP_PATCH} || true

If that doesn't work, we could try to have you apply the patch manually and see what the error is.

This fixed the issue for me

awni commented 3 weeks ago

Good to know. We may need to hard code that path. I don't know why the other version of patch doesn't work ..