Skip to content

No module named chess #38

@greenonline

Description

@greenonline

No matter how I try to run it, I get the same issue. I am probably missing something obvious... although I've read the readme and I can't see what I am missing.

After having downloaded and unzipped the repo (and not installed using pip, and then following the readme, typing chs obviously will not work, nor will ./chs, as chs is a directory. Assuming the read me actually means chs.py, then

% python2 chs.py 
Traceback (most recent call last):
  File "chs.py", line 3, in <module>
    import chs.__main__
  File "/Users/macbook/Downloads/chs-master/chs/__main__.py", line 3, in <module>
    import chess
ImportError: No module named chess```

and for Python 3

```none
% python3 chs.py
Traceback (most recent call last):
  File "/Users/macbook/Downloads/chs-master/chs.py", line 3, in <module>
    import chs.__main__
  File "/Users/macbook/Downloads/chs-master/chs/__main__.py", line 3, in <module>
    import chess
ModuleNotFoundError: No module named 'chess'

Resorting to running make, that the README makes no mention of, gives:

% make

=-=- Running app -=-=-=-=-=-=-=-=-=-=-= 🚀
Traceback (most recent call last):
  File "/Users/macbook/Downloads/chs-master/chs.py", line 3, in <module>
    import chs.__main__
  File "/Users/macbook/Downloads/chs-master/chs/__main__.py", line 3, in <module>
    import chess
ModuleNotFoundError: No module named 'chess'
make: *** [run] Error 1

IMHO, I think that the README needs updating, or clarifying. Maybe list the module dependancies? Is chess some other third-party chess-module, that is well known in the chess community, but one that mere mortals, who are not grand-masters, are not generally aware of?

Note: I just downloaded the zip and unzipped it. I have not run python3 -m pip install chs. This could be (probably is) the issue.

Note: After trying the pip install method I noticed the following line, which is, presumably, the chess that chs is looking for.:

Downloading python_chess-1.999-py3-none-any.whl (1.4 kB)

However, if I do try to install via pip then I encounter [Failed to build installable wheels for some pyproject.toml based projects ╰─> editdistance #37]{https://github.com/nickzuber/chs/issues/37}

  Building wheel for editdistance (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Building wheel for editdistance (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [94 lines of output]
      Compiling src/editdistance/bycython.pyx because it changed.
      [1/1] Cythonizing src/editdistance/bycython.pyx
      /private/var/folders/6b/9xc3xm_944n6xhwc12_s2c7h0000gn/T/pip-build-env-73mt25ss/normal/lib/python3.14/site-packages/setuptools/config/_apply_pyprojecttoml.py:82: SetuptoolsDeprecationWarning: `project.license` as a TOML table is deprecated
      !!
      
              ********************************************************************************
              Please use a simple string containing a SPDX expression for `project.license`. You can also use `project.license-files`. (Both options available on setuptools>=77.0.0).
      
              By 2027-Feb-18, you need to update your project and remove deprecated calls
              or your builds will no longer be supported.
      
              See https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license for details.
              ********************************************************************************
      
      !!
        corresp(dist, value, root_dir)
      running build
      running build_py
      creating /var/folders/6b/9xc3xm_944n6xhwc12_s2c7h0000gn/T/pdm-build-552butrz/lib.macosx-10.15-x86_64-cpython-314/editdistance
      copying src/editdistance/__init__.py -> /var/folders/6b/9xc3xm_944n6xhwc12_s2c7h0000gn/T/pdm-build-552butrz/lib.macosx-10.15-x86_64-cpython-314/editdistance
      running egg_info
      creating src/editdistance.egg-info
      writing src/editdistance.egg-info/PKG-INFO
      writing dependency_links to src/editdistance.egg-info/dependency_links.txt
      writing top-level names to src/editdistance.egg-info/top_level.txt
      writing manifest file 'src/editdistance.egg-info/SOURCES.txt'
      reading manifest file 'src/editdistance.egg-info/SOURCES.txt'
      adding license file 'LICENSE'
      writing manifest file 'src/editdistance.egg-info/SOURCES.txt'
      copying src/editdistance/__init__.pxd -> /var/folders/6b/9xc3xm_944n6xhwc12_s2c7h0000gn/T/pdm-build-552butrz/lib.macosx-10.15-x86_64-cpython-314/editdistance
      copying src/editdistance/_editdistance.cpp -> /var/folders/6b/9xc3xm_944n6xhwc12_s2c7h0000gn/T/pdm-build-552butrz/lib.macosx-10.15-x86_64-cpython-314/editdistance
      copying src/editdistance/_editdistance.h -> /var/folders/6b/9xc3xm_944n6xhwc12_s2c7h0000gn/T/pdm-build-552butrz/lib.macosx-10.15-x86_64-cpython-314/editdistance
      copying src/editdistance/bycython.cpp -> /var/folders/6b/9xc3xm_944n6xhwc12_s2c7h0000gn/T/pdm-build-552butrz/lib.macosx-10.15-x86_64-cpython-314/editdistance
      copying src/editdistance/bycython.pxd -> /var/folders/6b/9xc3xm_944n6xhwc12_s2c7h0000gn/T/pdm-build-552butrz/lib.macosx-10.15-x86_64-cpython-314/editdistance
      copying src/editdistance/bycython.pyx -> /var/folders/6b/9xc3xm_944n6xhwc12_s2c7h0000gn/T/pdm-build-552butrz/lib.macosx-10.15-x86_64-cpython-314/editdistance
      copying src/editdistance/def.h -> /var/folders/6b/9xc3xm_944n6xhwc12_s2c7h0000gn/T/pdm-build-552butrz/lib.macosx-10.15-x86_64-cpython-314/editdistance
      copying src/editdistance/__init__.py -> /var/folders/6b/9xc3xm_944n6xhwc12_s2c7h0000gn/T/pdm-build-552butrz/lib.macosx-10.15-x86_64-cpython-314/editdistance
      running build_ext
      building 'editdistance.bycython' extension
      creating /var/folders/6b/9xc3xm_944n6xhwc12_s2c7h0000gn/T/pdm-build-552butrz/temp.macosx-10.15-x86_64-cpython-314/src/editdistance
      clang++ -fno-strict-overflow -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -O3 -Wall -Isrc/editdistance -I/Users/macbook/Downloads/chs-master/path/to/venv/include -I/usr/local/opt/python@3.14/Frameworks/Python.framework/Versions/3.14/include/python3.14 -c src/editdistance/_editdistance.cpp -o /var/folders/6b/9xc3xm_944n6xhwc12_s2c7h0000gn/T/pdm-build-552butrz/temp.macosx-10.15-x86_64-cpython-314/src/editdistance/_editdistance.o
      dyld: Library not loaded: /usr/local/opt/z3/lib/libz3.4.13.dylib
        Referenced from: /usr/local/Cellar/llvm/18.1.8/lib/libLLVM.dylib
        Reason: image not found
      error: command '/usr/local/opt/llvm/bin/clang++' failed with exit code -6
      Traceback (most recent call last):
        File "/private/var/folders/6b/9xc3xm_944n6xhwc12_s2c7h0000gn/T/pip-build-env-73mt25ss/overlay/lib/python3.14/site-packages/pdm/backend/hooks/setuptools.py", line 90, in _build_lib
          subprocess.check_call(build_args)
          ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
        File "/usr/local/Cellar/python@3.14/3.14.3_1/Frameworks/Python.framework/Versions/3.14/lib/python3.14/subprocess.py", line 419, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['/Users/macbook/Downloads/chs-master/path/to/venv/bin/python3', '/private/var/folders/6b/9xc3xm_944n6xhwc12_s2c7h0000gn/T/pip-install-peo7zp6s/editdistance_03b322847192463fb88498e30eeb1787/setup.py', 'build', '-b', '/var/folders/6b/9xc3xm_944n6xhwc12_s2c7h0000gn/T/pdm-build-552butrz']' returned non-zero exit status 1.
      
      During handling of the above exception, another exception occurred:
      
      Traceback (most recent call last):
        File "/Users/macbook/Downloads/chs-master/path/to/venv/lib/python3.14/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 389, in <module>
          main()
          ~~~~^^
        File "/Users/macbook/Downloads/chs-master/path/to/venv/lib/python3.14/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 373, in main
          json_out["return_val"] = hook(**hook_input["kwargs"])
                                   ~~~~^^^^^^^^^^^^^^^^^^^^^^^^
        File "/Users/macbook/Downloads/chs-master/path/to/venv/lib/python3.14/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 280, in build_wheel
          return _build_backend().build_wheel(
                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
              wheel_directory, config_settings, metadata_directory
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
          )
          ^
        File "/private/var/folders/6b/9xc3xm_944n6xhwc12_s2c7h0000gn/T/pip-build-env-73mt25ss/overlay/lib/python3.14/site-packages/pdm/backend/__init__.py", line 56, in build_wheel
          return builder.build(
                 ~~~~~~~~~~~~~^
              wheel_directory, metadata_directory=metadata_directory
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
          ).name
          ^
        File "/private/var/folders/6b/9xc3xm_944n6xhwc12_s2c7h0000gn/T/pip-build-env-73mt25ss/overlay/lib/python3.14/site-packages/pdm/backend/base.py", line 220, in build
          files = sorted(self.get_files(context))
        File "/private/var/folders/6b/9xc3xm_944n6xhwc12_s2c7h0000gn/T/pip-build-env-73mt25ss/overlay/lib/python3.14/site-packages/pdm/backend/wheel.py", line 123, in get_files
          yield from super().get_files(context)
                     ~~~~~~~~~~~~~~~~~^^^^^^^^^
        File "/private/var/folders/6b/9xc3xm_944n6xhwc12_s2c7h0000gn/T/pip-build-env-73mt25ss/overlay/lib/python3.14/site-packages/pdm/backend/base.py", line 193, in get_files
          self.call_hook("pdm_build_update_files", context, files)
          ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/private/var/folders/6b/9xc3xm_944n6xhwc12_s2c7h0000gn/T/pip-build-env-73mt25ss/overlay/lib/python3.14/site-packages/pdm/backend/base.py", line 144, in call_hook
          getattr(hook, hook_name)(context, *args, **kwargs)
          ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/private/var/folders/6b/9xc3xm_944n6xhwc12_s2c7h0000gn/T/pip-build-env-73mt25ss/overlay/lib/python3.14/site-packages/pdm/backend/hooks/setuptools.py", line 82, in pdm_build_update_files
          self._build_lib(context)
          ~~~~~~~~~~~~~~~^^^^^^^^^
        File "/private/var/folders/6b/9xc3xm_944n6xhwc12_s2c7h0000gn/T/pip-build-env-73mt25ss/overlay/lib/python3.14/site-packages/pdm/backend/hooks/setuptools.py", line 92, in _build_lib
          raise BuildError(f"Error occurs when running {build_args}:\n{e}")
      pdm.backend.exceptions.BuildError: Error occurs when running ['/Users/macbook/Downloads/chs-master/path/to/venv/bin/python3', '/private/var/folders/6b/9xc3xm_944n6xhwc12_s2c7h0000gn/T/pip-install-peo7zp6s/editdistance_03b322847192463fb88498e30eeb1787/setup.py', 'build', '-b', '/var/folders/6b/9xc3xm_944n6xhwc12_s2c7h0000gn/T/pdm-build-552butrz']:
      Command '['/Users/macbook/Downloads/chs-master/path/to/venv/bin/python3', '/private/var/folders/6b/9xc3xm_944n6xhwc12_s2c7h0000gn/T/pip-install-peo7zp6s/editdistance_03b322847192463fb88498e30eeb1787/setup.py', 'build', '-b', '/var/folders/6b/9xc3xm_944n6xhwc12_s2c7h0000gn/T/pdm-build-552butrz']' 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 editdistance
  Building wheel for chess (pyproject.toml) ... done
  Created wheel for chess: filename=chess-1.11.2-py3-none-any.whl size=147879 sha256=d4310e0b492f2dc24949e4fa2331d84d148d3031c13ce08f6b9db12d37892759
  Stored in directory: /Users/macbook/Library/Caches/pip/wheels/06/53/ec/27b065e5de042efb4c622f661c996599af695bff1b9db4163b
Successfully built chs chess
Failed to build editdistance

[notice] A new release of pip is available: 26.0 -> 26.0.1
[notice] To update, run: pip install --upgrade pip
error: failed-wheel-build-for-install

× Failed to build installable wheels for some pyproject.toml based projects
╰─> editdistance

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions