abdeladim-s / pyllamacpp

Python bindings for llama.cpp
https://abdeladim-s.github.io/pyllamacpp/
MIT License
62 stars 21 forks source link

Cannot install on Windows with Python 3.12.1 #33

Open rlondner opened 7 months ago

rlondner commented 7 months ago

I get the following error message when running pip install pyllamacpp or pip install git+https://github.com/abdeladim-s/pyllamacpp.git:

pip install git+https://github.com/abdeladim-s/pyllamacpp.git Collecting git+https://github.com/abdeladim-s/pyllamacpp.git Cloning https://github.com/abdeladim-s/pyllamacpp.git to h:\users\raphael\appdata\local\temp\pip-req-build-glz0imed Running command git clone --filter=blob:none --quiet https://github.com/abdeladim-s/pyllamacpp.git 'H:\Users\Raphael\AppData\Local\Temp\pip-req-build-glz0imed' Resolved https://github.com/abdeladim-s/pyllamacpp.git to commit 40ae3baf6c70d7cb8c5cebb9ea58bd26fc454549 Running command git submodule update --init --recursive -q Installing build dependencies ... done Getting requirements to build wheel ... error error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> [161 lines of output] H:\Users\Raphael\AppData\Local\Temp\pip-build-env-a25gkb1p\overlay\Lib\site-packages\setuptools\config_apply_pyprojecttoml.py:76: _MissingDynamic: description defined outside of pyproject.toml is ignored. !!

          ********************************************************************************
          The following seems to be defined outside of `pyproject.toml`:

          `description = 'Python bindings for llama.cpp'`

          According to the spec (see the link below), however, setuptools CANNOT
          consider this value unless `description` is listed as `dynamic`.

          https://packaging.python.org/en/latest/specifications/pyproject-toml/#declaring-project-metadata-the-project-table        

          To prevent this problem, you can list `description` under `dynamic` or alternatively
          remove the `[project]` table from your file and rely entirely on other means of
          configuration.
          ********************************************************************************

  !!
    _handle_missing_dynamic(dist, project_table)
  H:\Users\Raphael\AppData\Local\Temp\pip-build-env-a25gkb1p\overlay\Lib\site-packages\setuptools\config\_apply_pyprojecttoml.py:76: _MissingDynamic: `requires-python` defined outside of `pyproject.toml` is ignored.
  !!

          ********************************************************************************
          The following seems to be defined outside of `pyproject.toml`:

          `requires-python = '>=3.8'`

          According to the spec (see the link below), however, setuptools CANNOT
          consider this value unless `requires-python` is listed as `dynamic`.

          https://packaging.python.org/en/latest/specifications/pyproject-toml/#declaring-project-metadata-the-project-table        

          To prevent this problem, you can list `requires-python` under `dynamic` or alternatively
          remove the `[project]` table from your file and rely entirely on other means of
          configuration.
          ********************************************************************************

  !!
    _handle_missing_dynamic(dist, project_table)
  H:\Users\Raphael\AppData\Local\Temp\pip-build-env-a25gkb1p\overlay\Lib\site-packages\setuptools\config\_apply_pyprojecttoml.py:76: _MissingDynamic: `license` defined outside of `pyproject.toml` is ignored.
  !!

          ********************************************************************************
          The following seems to be defined outside of `pyproject.toml`:

          `license = 'MIT'`

          According to the spec (see the link below), however, setuptools CANNOT
          consider this value unless `license` is listed as `dynamic`.

          https://packaging.python.org/en/latest/specifications/pyproject-toml/#declaring-project-metadata-the-project-table        

          To prevent this problem, you can list `license` under `dynamic` or alternatively
          remove the `[project]` table from your file and rely entirely on other means of
          configuration.
          ********************************************************************************

  !!
    _handle_missing_dynamic(dist, project_table)
  H:\Users\Raphael\AppData\Local\Temp\pip-build-env-a25gkb1p\overlay\Lib\site-packages\setuptools\config\_apply_pyprojecttoml.py:76: _MissingDynamic: `authors` defined outside of `pyproject.toml` is ignored.
  !!

          ********************************************************************************
          The following seems to be defined outside of `pyproject.toml`:

          `authors = 'Abdeladim Sadiki'`

          According to the spec (see the link below), however, setuptools CANNOT
          consider this value unless `authors` is listed as `dynamic`.

          https://packaging.python.org/en/latest/specifications/pyproject-toml/#declaring-project-metadata-the-project-table        

          To prevent this problem, you can list `authors` under `dynamic` or alternatively
          remove the `[project]` table from your file and rely entirely on other means of
          configuration.
          ********************************************************************************

  !!
    _handle_missing_dynamic(dist, project_table)
  H:\Users\Raphael\AppData\Local\Temp\pip-build-env-a25gkb1p\overlay\Lib\site-packages\setuptools\config\_apply_pyprojecttoml.py:76: _MissingDynamic: `urls` defined outside of `pyproject.toml` is ignored.
  !!

          ********************************************************************************
          The following seems to be defined outside of `pyproject.toml`:

          `urls = {'Documentation': 'https://abdeladim-s.github.io/pyllamacpp', 'Source': 'https://github.com/abdeladim-s/pyllamacpp', 'Tracker': 'https://github.com/abdeladim-s/pyllamacpp/issues'}`

          According to the spec (see the link below), however, setuptools CANNOT
          consider this value unless `urls` is listed as `dynamic`.

          https://packaging.python.org/en/latest/specifications/pyproject-toml/#declaring-project-metadata-the-project-table        

          To prevent this problem, you can list `urls` under `dynamic` or alternatively
          remove the `[project]` table from your file and rely entirely on other means of
          configuration.
          ********************************************************************************

  !!
    _handle_missing_dynamic(dist, project_table)
  H:\Users\Raphael\AppData\Local\Temp\pip-build-env-a25gkb1p\overlay\Lib\site-packages\setuptools\config\_apply_pyprojecttoml.py:76: _MissingDynamic: `scripts` defined outside of `pyproject.toml` is ignored.
  !!

          ********************************************************************************
          The following seems to be defined outside of `pyproject.toml`:

          `scripts = ['pyllamacpp=pyllamacpp.cli:main']`

          According to the spec (see the link below), however, setuptools CANNOT
          consider this value unless `scripts` is listed as `dynamic`.

          https://packaging.python.org/en/latest/specifications/pyproject-toml/#declaring-project-metadata-the-project-table        

          To prevent this problem, you can list `scripts` under `dynamic` or alternatively
          remove the `[project]` table from your file and rely entirely on other means of
          configuration.
          ********************************************************************************

  !!
    _handle_missing_dynamic(dist, project_table)
  Traceback (most recent call last):
    File "H:\Users\Raphael\OneDrive\Perso\Technical\AI\Training\GenAI\Activeloop\venv\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
      main()
    File "H:\Users\Raphael\OneDrive\Perso\Technical\AI\Training\GenAI\Activeloop\venv\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "H:\Users\Raphael\OneDrive\Perso\Technical\AI\Training\GenAI\Activeloop\venv\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 118, in get_requires_for_build_wheel
      return hook(config_settings)
             ^^^^^^^^^^^^^^^^^^^^^
    File "H:\Users\Raphael\AppData\Local\Temp\pip-build-env-a25gkb1p\overlay\Lib\site-packages\setuptools\build_meta.py", line 325, in get_requires_for_build_wheel
      return self._get_build_requires(config_settings, requirements=['wheel'])
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "H:\Users\Raphael\AppData\Local\Temp\pip-build-env-a25gkb1p\overlay\Lib\site-packages\setuptools\build_meta.py", line 295, in _get_build_requires
      self.run_setup()
    File "H:\Users\Raphael\AppData\Local\Temp\pip-build-env-a25gkb1p\overlay\Lib\site-packages\setuptools\build_meta.py", line 311, in run_setup
      exec(code, locals())
    File "<string>", line 132, in <module>
    File "H:\Users\Raphael\AppData\Local\Temp\pip-build-env-a25gkb1p\overlay\Lib\site-packages\setuptools\__init__.py", line 103, in setup
      return distutils.core.setup(**attrs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "H:\Users\Raphael\AppData\Local\Temp\pip-build-env-a25gkb1p\overlay\Lib\site-packages\setuptools\_distutils\core.py", line 159, in setup
      dist.parse_config_files()
    File "H:\Users\Raphael\OneDrive\Perso\Technical\AI\Training\GenAI\Activeloop\venv\Lib\site-packages\_virtualenv.py", line 23, in parse_config_files
      result = old_parse_config_files(self, *args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "H:\Users\Raphael\AppData\Local\Temp\pip-build-env-a25gkb1p\overlay\Lib\site-packages\setuptools\dist.py", line 627, in parse_config_files
      pyprojecttoml.apply_configuration(self, filename, ignore_option_errors)
    File "H:\Users\Raphael\AppData\Local\Temp\pip-build-env-a25gkb1p\overlay\Lib\site-packages\setuptools\config\pyprojecttoml.py", line 68, in apply_configuration
      return _apply(dist, config, filepath)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "H:\Users\Raphael\AppData\Local\Temp\pip-build-env-a25gkb1p\overlay\Lib\site-packages\setuptools\config\_apply_pyprojecttoml.py", line 57, in apply
      _apply_project_table(dist, config, root_dir)
    File "H:\Users\Raphael\AppData\Local\Temp\pip-build-env-a25gkb1p\overlay\Lib\site-packages\setuptools\config\_apply_pyprojecttoml.py", line 83, in _apply_project_table
      corresp(dist, value, root_dir)
    File "H:\Users\Raphael\AppData\Local\Temp\pip-build-env-a25gkb1p\overlay\Lib\site-packages\setuptools\config\_apply_pyprojecttoml.py", line 212, in _python_requires
      _set_config(dist, "python_requires", SpecifierSet(val))
                                           ^^^^^^^^^^^^^^^^^
    File "H:\Users\Raphael\AppData\Local\Temp\pip-build-env-a25gkb1p\overlay\Lib\site-packages\setuptools\_vendor\packaging\specifiers.py", line 708, irs.pyrs.py", line 708, in __init__
      split_specifiers = [s.strip() for s in specifiers.split(",") if s.strip()]
                                             ^^^^^^^^^^^^^^^^
  AttributeError: 'NoneType' object has no attribute 'split'
  [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

abdeladim-s commented 7 months ago

Thanks @rlondner for reporting the issue. Apparently there is something happening with setuptools in python 3.12. Please give it a try now

pip install git+https://github.com/abdeladim-s/pyllamacpp.git

If you are using Windows, please consider using WSL as well.

rlondner commented 7 months ago

Thank you @abdeladim-s !

I got a bit further, but I still run into an error:

pip install git+https://github.com/abdeladim-s/pyllamacpp.git Collecting git+https://github.com/abdeladim-s/pyllamacpp.git Cloning https://github.com/abdeladim-s/pyllamacpp.git to h:\users\raphael\appdata\local\temp\pip-req-build-g87jc7sn Running command git clone --filter=blob:none --quiet https://github.com/abdeladim-s/pyllamacpp.git 'H:\Users\Raphael\AppData\Local\Temp\pip-req-build-g87jc7sn' Resolved https://github.com/abdeladim-s/pyllamacpp.git to commit 8a8078be363229318abcdb0d71830ba5d158a029 Running command git submodule update --init --recursive -q Installing build dependencies ... done Getting requirements to build wheel ... done Preparing metadata (pyproject.toml) ... done Building wheels for collected packages: pyllamacpp Building wheel for pyllamacpp (pyproject.toml) ... error error: subprocess-exited-with-error

× Building wheel for pyllamacpp (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [90 lines of output] running bdist_wheel running build running build_py creating build creating build\lib.win-amd64-cpython-312 creating build\lib.win-amd64-cpython-312\pyllamacpp copying .\pyllamacpp\cli.py -> build\lib.win-amd64-cpython-312\pyllamacpp copying .\pyllamacpp\constants.py -> build\lib.win-amd64-cpython-312\pyllamacpp copying .\pyllamacpp\langchain_llm.py -> build\lib.win-amd64-cpython-312\pyllamacpp copying .\pyllamacpp\model.py -> build\lib.win-amd64-cpython-312\pyllamacpp copying .\pyllamacpp\utils.py -> build\lib.win-amd64-cpython-312\pyllamacpp copying .\pyllamacpp\webui.py -> build\lib.win-amd64-cpython-312\pyllamacpp copying .\pyllamacpp_logger.py -> build\lib.win-amd64-cpython-312\pyllamacpp copying .\pyllamacpp__init__.py -> build\lib.win-amd64-cpython-312\pyllamacpp running build_ext -- Building for: NMake Makefiles CMake Error at CMakeLists.txt:8 (project): Generator

      NMake Makefiles

    does not support platform specification, but platform

      x64

    was specified.

  CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
  CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
  -- Configuring incomplete, errors occurred!
  Traceback (most recent call last):
    File "H:\Users\Raphael\OneDrive\Perso\Technical\AI\Training\GenAI\Activeloop\venv\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
      main()
    File "H:\Users\Raphael\OneDrive\Perso\Technical\AI\Training\GenAI\Activeloop\venv\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "H:\Users\Raphael\OneDrive\Perso\Technical\AI\Training\GenAI\Activeloop\venv\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 251, in build_wheel
      return _build_backend().build_wheel(wheel_directory, config_settings,
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "H:\Users\Raphael\AppData\Local\Temp\pip-build-env-23lglpo6\overlay\Lib\site-packages\setuptools\build_meta.py", line 410, in build_wheel
      return self._build_with_temp_dir(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "H:\Users\Raphael\AppData\Local\Temp\pip-build-env-23lglpo6\overlay\Lib\site-packages\setuptools\build_meta.py", line 395, in _build_with_temp_dir
      self.run_setup()
    File "H:\Users\Raphael\AppData\Local\Temp\pip-build-env-23lglpo6\overlay\Lib\site-packages\setuptools\build_meta.py", line 311, in run_setup
      exec(code, locals())
    File "<string>", line 132, in <module>
    File "H:\Users\Raphael\AppData\Local\Temp\pip-build-env-23lglpo6\overlay\Lib\site-packages\setuptools\__init__.py", line 103, in setup
      return distutils.core.setup(**attrs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "H:\Users\Raphael\AppData\Local\Temp\pip-build-env-23lglpo6\overlay\Lib\site-packages\setuptools\_distutils\core.py", line 185, in setup
      return run_commands(dist)
             ^^^^^^^^^^^^^^^^^^
    File "H:\Users\Raphael\AppData\Local\Temp\pip-build-env-23lglpo6\overlay\Lib\site-packages\setuptools\_distutils\core.py", line 201, in run_commands
      dist.run_commands()
    File "H:\Users\Raphael\AppData\Local\Temp\pip-build-env-23lglpo6\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 969, in run_commands
      self.run_command(cmd)
    File "H:\Users\Raphael\AppData\Local\Temp\pip-build-env-23lglpo6\overlay\Lib\site-packages\setuptools\dist.py", line 963, in run_command
      super().run_command(command)
    File "H:\Users\Raphael\AppData\Local\Temp\pip-build-env-23lglpo6\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
      cmd_obj.run()
    File "H:\Users\Raphael\AppData\Local\Temp\pip-build-env-23lglpo6\overlay\Lib\site-packages\wheel\bdist_wheel.py", line 368, in run
      self.run_command("build")
    File "H:\Users\Raphael\AppData\Local\Temp\pip-build-env-23lglpo6\overlay\Lib\site-packages\setuptools\_distutils\cmd.py", line 318, in run_command
      self.distribution.run_command(command)
    File "H:\Users\Raphael\AppData\Local\Temp\pip-build-env-23lglpo6\overlay\Lib\site-packages\setuptools\dist.py", line 963, in run_command
      super().run_command(command)
    File "H:\Users\Raphael\AppData\Local\Temp\pip-build-env-23lglpo6\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
      cmd_obj.run()
    File "H:\Users\Raphael\AppData\Local\Temp\pip-build-env-23lglpo6\overlay\Lib\site-packages\setuptools\_distutils\command\build.py", line 131, in run
      self.run_command(cmd_name)
    File "H:\Users\Raphael\AppData\Local\Temp\pip-build-env-23lglpo6\overlay\Lib\site-packages\setuptools\_distutils\cmd.py", line 318, in run_command
      self.distribution.run_command(command)
    File "H:\Users\Raphael\AppData\Local\Temp\pip-build-env-23lglpo6\overlay\Lib\site-packages\setuptools\dist.py", line 963, in run_command
      super().run_command(command)
    File "H:\Users\Raphael\AppData\Local\Temp\pip-build-env-23lglpo6\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
      cmd_obj.run()
    File "H:\Users\Raphael\AppData\Local\Temp\pip-build-env-23lglpo6\overlay\Lib\site-packages\setuptools\command\build_ext.py", line 89, in run
      _build_ext.run(self)
    File "H:\Users\Raphael\AppData\Local\Temp\pip-build-env-23lglpo6\overlay\Lib\site-packages\setuptools\_distutils\command\build_ext.py", line 345, in run
      self.build_extensions()
    File "H:\Users\Raphael\AppData\Local\Temp\pip-build-env-23lglpo6\overlay\Lib\site-packages\setuptools\_distutils\command\build_ext.py", line 467, in build_extensions
      self._build_extensions_serial()
    File "H:\Users\Raphael\AppData\Local\Temp\pip-build-env-23lglpo6\overlay\Lib\site-packages\setuptools\_distutils\command\build_ext.py", line 493, in _build_extensions_serial
      self.build_extension(ext)
    File "<string>", line 118, in build_extension
    File "H:\Users\Raphael\AppData\Local\Programs\Python\Python312\Lib\subprocess.py", line 571, in run
      raise CalledProcessError(retcode, process.args,
  subprocess.CalledProcessError: Command '['cmake', 'H:\\Users\\Raphael\\AppData\\Local\\Temp\\pip-req-build-g87jc7sn', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=H:\\Users\\Raphael\\AppData\\Local\\Temp\\pip-req-build-g87jc7sn\\build\\lib.win-amd64-cpython-312\\', '-DPYTHON_EXECUTABLE=H:\\Users\\Raphael\\OneDrive\\Perso\\Technical\\AI\\Training\\GenAI\\Activeloop\\venv\\Scripts\\python.exe', '-DCMAKE_BUILD_TYPE=Release', '-DEXAMPLE_VERSION_INFO=2.4.2', '-A', 'x64', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=H:\\Users\\Raphael\\AppData\\Local\\Temp\\pip-req-build-g87jc7sn\\build\\lib.win-amd64-cpython-312']' returned non-zero exit status 1.
  [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for pyllamacpp Failed to build pyllamacpp ERROR: Could not build wheels for pyllamacpp, which is required to install pyproject.toml-based projects

abdeladim-s commented 7 months ago

@rlondner, what machine are you using ? Please make sure that you can compile llama.cpp before trying to build the project.

In any case, I've updated the github action and pushed a new version to PyPI, pre-built wheels for Python 3.12 should be available now. You can install it as usual:

pip install pyllamacpp==2.4.3