kyegomez / tree-of-thoughts

Plug in and Play Implementation of Tree of Thoughts: Deliberate Problem Solving with Large Language Models that Elevates Model Reasoning by atleast 70%

Home Page:https://discord.gg/qUtxnK2NMf

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build failure on macOS

arthur-brainchain opened this issue · comments

Trying to build this on a macOS with latest OS: MacBook Pro with M2 Max, 64GB RAM

(base) ➜  tree-of-thoughts git:(main) ✗ python3.10 -m pip install -r requirements.txt
Collecting transformers
  Downloading transformers-4.29.2-py3-none-any.whl (7.1 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 7.1/7.1 MB 9.4 MB/s eta 0:00:00
Collecting openai
  Using cached openai-0.27.7-py3-none-any.whl (71 kB)
Collecting guidance
  Downloading guidance-0.0.57-py3-none-any.whl (83 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 83.2/83.2 kB 7.0 MB/s eta 0:00:00
Collecting dotenv
  Using cached dotenv-0.0.5.tar.gz (2.4 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [68 lines of output]
      /opt/homebrew/lib/python3.10/site-packages/setuptools/__init__.py:85: _DeprecatedInstaller: setuptools.installer and fetch_build_eggs are deprecated. Requirements should be satisfied by a PEP 517 installer. If you are using pip, you can try `pip install --use-pep517`.
        dist.fetch_build_eggs(dist.setup_requires)
        error: subprocess-exited-with-error

        × python setup.py egg_info did not run successfully.
        │ exit code: 1
        ╰─> [16 lines of output]
            Traceback (most recent call last):
              File "<string>", line 2, in <module>
              File "<pip-setuptools-caller>", line 14, in <module>
              File "/private/var/folders/_j/gj9symrn0rb44g0xq2m8xvg40000gn/T/pip-wheel-4iezor5a/distribute_2bfca3ddfc384e5fbf51cea6de0ed998/setuptools/__init__.py", line 2, in <module>
                from setuptools.extension import Extension, Library
              File "/private/var/folders/_j/gj9symrn0rb44g0xq2m8xvg40000gn/T/pip-wheel-4iezor5a/distribute_2bfca3ddfc384e5fbf51cea6de0ed998/setuptools/extension.py", line 5, in <module>
                from setuptools.dist import _get_unpatched
              File "/private/var/folders/_j/gj9symrn0rb44g0xq2m8xvg40000gn/T/pip-wheel-4iezor5a/distribute_2bfca3ddfc384e5fbf51cea6de0ed998/setuptools/dist.py", line 7, in <module>
                from setuptools.command.install import install
              File "/private/var/folders/_j/gj9symrn0rb44g0xq2m8xvg40000gn/T/pip-wheel-4iezor5a/distribute_2bfca3ddfc384e5fbf51cea6de0ed998/setuptools/command/__init__.py", line 8, in <module>
                from setuptools.command import install_scripts
              File "/private/var/folders/_j/gj9symrn0rb44g0xq2m8xvg40000gn/T/pip-wheel-4iezor5a/distribute_2bfca3ddfc384e5fbf51cea6de0ed998/setuptools/command/install_scripts.py", line 3, in <module>
                from pkg_resources import Distribution, PathMetadata, ensure_directory
              File "/private/var/folders/_j/gj9symrn0rb44g0xq2m8xvg40000gn/T/pip-wheel-4iezor5a/distribute_2bfca3ddfc384e5fbf51cea6de0ed998/pkg_resources.py", line 1518, in <module>
                register_loader_type(importlib_bootstrap.SourceFileLoader, DefaultProvider)
            AttributeError: module 'importlib._bootstrap' has no attribute 'SourceFileLoader'
            [end of output]

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

      × Encountered error while generating package metadata.
      ╰─> See above for output.

      note: This is an issue with the package mentioned above, not pip.
      hint: See above for details.
      Traceback (most recent call last):
        File "/opt/homebrew/lib/python3.10/site-packages/setuptools/installer.py", line 97, in _fetch_build_egg_no_warn
          subprocess.check_call(cmd)
        File "/opt/homebrew/Cellar/python@3.10/3.10.11/Frameworks/Python.framework/Versions/3.10/lib/python3.10/subprocess.py", line 369, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['/opt/homebrew/opt/python@3.10/bin/python3.10', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/var/folders/_j/gj9symrn0rb44g0xq2m8xvg40000gn/T/tmp1mpplxyx', '--quiet', 'distribute']' returned non-zero exit status 1.

      The above exception was the direct cause of the following exception:

      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/private/var/folders/_j/gj9symrn0rb44g0xq2m8xvg40000gn/T/pip-install-ujzjlglt/dotenv_9e7b51670df642a68d9715c678ee7aa0/setup.py", line 13, in <module>
          setup(name='dotenv',
        File "/opt/homebrew/lib/python3.10/site-packages/setuptools/__init__.py", line 107, in setup
          _install_setup_requires(attrs)
        File "/opt/homebrew/lib/python3.10/site-packages/setuptools/__init__.py", line 80, in _install_setup_requires
          _fetch_build_eggs(dist)
        File "/opt/homebrew/lib/python3.10/site-packages/setuptools/__init__.py", line 85, in _fetch_build_eggs
          dist.fetch_build_eggs(dist.setup_requires)
        File "/opt/homebrew/lib/python3.10/site-packages/setuptools/dist.py", line 894, in fetch_build_eggs
          return _fetch_build_eggs(self, requires)
        File "/opt/homebrew/lib/python3.10/site-packages/setuptools/installer.py", line 39, in _fetch_build_eggs
          resolved_dists = pkg_resources.working_set.resolve(
        File "/opt/homebrew/lib/python3.10/site-packages/pkg_resources/__init__.py", line 827, in resolve
          dist = self._resolve_dist(
        File "/opt/homebrew/lib/python3.10/site-packages/pkg_resources/__init__.py", line 863, in _resolve_dist
          dist = best[req.key] = env.best_match(
        File "/opt/homebrew/lib/python3.10/site-packages/pkg_resources/__init__.py", line 1133, in best_match
          return self.obtain(req, installer)
        File "/opt/homebrew/lib/python3.10/site-packages/pkg_resources/__init__.py", line 1145, in obtain
          return installer(requirement)
        File "/opt/homebrew/lib/python3.10/site-packages/setuptools/installer.py", line 99, in _fetch_build_egg_no_warn
          raise DistutilsError(str(e)) from e
      distutils.errors.DistutilsError: Command '['/opt/homebrew/opt/python@3.10/bin/python3.10', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/var/folders/_j/gj9symrn0rb44g0xq2m8xvg40000gn/T/tmp1mpplxyx', '--quiet', 'distribute']' 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: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

[notice] A new release of pip is available: 23.0.1 -> 23.1.2
[notice] To update, run: python3.10 -m pip install --upgrade pip

Hey please try again! Should work now!

Same error:

Requirement already satisfied: transformers in /Users/arthur/miniconda3/lib/python3.11/site-packages (from -r requirements.txt (line 1)) (4.30.0.dev0)
Requirement already satisfied: openai in /Users/arthur/miniconda3/lib/python3.11/site-packages (from -r requirements.txt (line 2)) (0.27.6)
Requirement already satisfied: guidance in /Users/arthur/miniconda3/lib/python3.11/site-packages (from -r requirements.txt (line 3)) (0.0.43)
Collecting dotenv
  Using cached dotenv-0.0.5.tar.gz (2.4 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [73 lines of output]
      /Users/arthur/miniconda3/lib/python3.11/site-packages/setuptools/installer.py:27: SetuptoolsDeprecationWarning: setuptools.installer is deprecated. Requirements should be satisfied by a PEP 517 installer.
        warnings.warn(
        error: subprocess-exited-with-error

        × python setup.py egg_info did not run successfully.
        │ exit code: 1
        ╰─> [17 lines of output]
            Traceback (most recent call last):
              File "<string>", line 2, in <module>
              File "<pip-setuptools-caller>", line 14, in <module>
              File "/private/var/folders/_j/gj9symrn0rb44g0xq2m8xvg40000gn/T/pip-wheel-zl0pnj7e/distribute_458a3ca987864fe5988326e7fe78c6d5/setuptools/__init__.py", line 2, in <module>
                from setuptools.extension import Extension, Library
              File "/private/var/folders/_j/gj9symrn0rb44g0xq2m8xvg40000gn/T/pip-wheel-zl0pnj7e/distribute_458a3ca987864fe5988326e7fe78c6d5/setuptools/extension.py", line 5, in <module>
                from setuptools.dist import _get_unpatched
              File "/private/var/folders/_j/gj9symrn0rb44g0xq2m8xvg40000gn/T/pip-wheel-zl0pnj7e/distribute_458a3ca987864fe5988326e7fe78c6d5/setuptools/dist.py", line 7, in <module>
                from setuptools.command.install import install
              File "/private/var/folders/_j/gj9symrn0rb44g0xq2m8xvg40000gn/T/pip-wheel-zl0pnj7e/distribute_458a3ca987864fe5988326e7fe78c6d5/setuptools/command/__init__.py", line 8, in <module>
                from setuptools.command import install_scripts
              File "/private/var/folders/_j/gj9symrn0rb44g0xq2m8xvg40000gn/T/pip-wheel-zl0pnj7e/distribute_458a3ca987864fe5988326e7fe78c6d5/setuptools/command/install_scripts.py", line 3, in <module>
                from pkg_resources import Distribution, PathMetadata, ensure_directory
              File "/private/var/folders/_j/gj9symrn0rb44g0xq2m8xvg40000gn/T/pip-wheel-zl0pnj7e/distribute_458a3ca987864fe5988326e7fe78c6d5/pkg_resources.py", line 1518, in <module>
                register_loader_type(importlib_bootstrap.SourceFileLoader, DefaultProvider)
                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
            AttributeError: module 'importlib._bootstrap' has no attribute 'SourceFileLoader'
            [end of output]

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

      × Encountered error while generating package metadata.
      ╰─> See above for output.

      note: This is an issue with the package mentioned above, not pip.
      hint: See above for details.
      Traceback (most recent call last):
        File "/Users/arthur/miniconda3/lib/python3.11/site-packages/setuptools/installer.py", line 82, in fetch_build_egg
          subprocess.check_call(cmd)
        File "/Users/arthur/miniconda3/lib/python3.11/subprocess.py", line 413, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['/Users/arthur/miniconda3/bin/python', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/var/folders/_j/gj9symrn0rb44g0xq2m8xvg40000gn/T/tmpk5_2mhm9', '--quiet', 'distribute']' returned non-zero exit status 1.

      The above exception was the direct cause of the following exception:

      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/private/var/folders/_j/gj9symrn0rb44g0xq2m8xvg40000gn/T/pip-install-0_f4x5w2/dotenv_fc78a45d2976462cb8e66dfe7790e233/setup.py", line 13, in <module>
          setup(name='dotenv',
        File "/Users/arthur/miniconda3/lib/python3.11/site-packages/setuptools/__init__.py", line 86, in setup
          _install_setup_requires(attrs)
        File "/Users/arthur/miniconda3/lib/python3.11/site-packages/setuptools/__init__.py", line 80, in _install_setup_requires
          dist.fetch_build_eggs(dist.setup_requires)
        File "/Users/arthur/miniconda3/lib/python3.11/site-packages/setuptools/dist.py", line 874, in fetch_build_eggs
          resolved_dists = pkg_resources.working_set.resolve(
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/Users/arthur/miniconda3/lib/python3.11/site-packages/pkg_resources/__init__.py", line 815, in resolve
          dist = self._resolve_dist(
                 ^^^^^^^^^^^^^^^^^^^
        File "/Users/arthur/miniconda3/lib/python3.11/site-packages/pkg_resources/__init__.py", line 851, in _resolve_dist
          dist = best[req.key] = env.best_match(
                                 ^^^^^^^^^^^^^^^
        File "/Users/arthur/miniconda3/lib/python3.11/site-packages/pkg_resources/__init__.py", line 1123, in best_match
          return self.obtain(req, installer)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/Users/arthur/miniconda3/lib/python3.11/site-packages/pkg_resources/__init__.py", line 1135, in obtain
          return installer(requirement)
                 ^^^^^^^^^^^^^^^^^^^^^^
        File "/Users/arthur/miniconda3/lib/python3.11/site-packages/setuptools/dist.py", line 944, in fetch_build_egg
          return fetch_build_egg(self, req)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/Users/arthur/miniconda3/lib/python3.11/site-packages/setuptools/installer.py", line 84, in fetch_build_egg
          raise DistutilsError(str(e)) from e
      distutils.errors.DistutilsError: Command '['/Users/arthur/miniconda3/bin/python', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/var/folders/_j/gj9symrn0rb44g0xq2m8xvg40000gn/T/tmpk5_2mhm9', '--quiet', 'distribute']' 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: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.```

With new code, after trying to run the example after running python setup.py install I still get this error:

2023-05-29 20:03:52,494 - INFO - Note: NumExpr detected 12 cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 8.
2023-05-29 20:03:52,494 - INFO - NumExpr defaulting to 8 threads.
Using api_model gpt-3.5-turbo
2023-05-29 20:03:53,429 - INFO - Saving the current tree and metrics.
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ /Users/arthur/AI/Autonomy/tree-of-thoughts/example.py:29 in <module>                             │
│                                                                                                  │
│   26                                                                                             │
│   27 #call the solve emthod with the input problem and other params                              │
│   28                                                                                             │
│ ❱ 29 solution = tree_of_thoughts.solve(input_problem,                                            │
│   30 │   num_thoughts=num_thoughts,                                                              │
│   31 │   max_steps=max_states,                                                                   │
│   32 │   max_states=5,                                                                           │
│                                                                                                  │
│ /Users/arthur/AI/Autonomy/tree-of-thoughts/tree_of_thoughts/treeofthoughts.py:40 in solve        │
│                                                                                                  │
│    37 │   │   try:                                                                               │
│    38 │   │   │   best_thoughts = ""                                                             │
│    39 │   │   │   if self.search_algorithm == 'BFS':                                             │
│ ❱  40 │   │   │   │   result = self.tot_bfs(initial_prompt, num_thoughts, max_steps, max_state   │
│    41 │   │   │   │   if result:                                                                 │
│    42 │   │   │   │   │   self.save_tree_to_json(self.file_name)                                 │
│    43 │   │   │   │   │   best_thoughts = result                                                 │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
TypeError: TreeofThoughts.tot_bfs() takes 6 positional arguments but 7 were given```

yes, this has been fixed now please excuse us!

Can you try again and let me know if it works!