cshogi icon indicating copy to clipboard operation
cshogi copied to clipboard

cshogi/_cshogi.cpp:778:10: fatal error: 'init.hpp' file not found #include "init.hpp"

Open yo-train-ch opened this issue 1 year ago • 2 comments

pipでのインストール時に以下のエラーが出ます。 ほかの依存しているライブラリはインストール済みです。 初心者ですので、間違っていればご教授いただきたいです。

なお、freeBSDを使用しています。gccではなく、clangを使用中です。

 /usr/local/bin/python3.9 -m pip install --no-cache-dir cshogi
Defaulting to user installation because normal site-packages is not writeable
Collecting cshogi
  Downloading cshogi-0.5.5.tar.gz (107 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 107.8/107.8 kB 10.8 MB/s eta 0:00:00
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: cshogi
  Building wheel for cshogi (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [55 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.freebsd-13.1-RELEASE-p2-amd64-cpython-39
      creating build/lib.freebsd-13.1-RELEASE-p2-amd64-cpython-39/cshogi
      copying cshogi/CSA.py -> build/lib.freebsd-13.1-RELEASE-p2-amd64-cpython-39/cshogi
      copying cshogi/KI2.py -> build/lib.freebsd-13.1-RELEASE-p2-amd64-cpython-39/cshogi
      copying cshogi/KIF.py -> build/lib.freebsd-13.1-RELEASE-p2-amd64-cpython-39/cshogi
      copying cshogi/PGN.py -> build/lib.freebsd-13.1-RELEASE-p2-amd64-cpython-39/cshogi
      copying cshogi/__init__.py -> build/lib.freebsd-13.1-RELEASE-p2-amd64-cpython-39/cshogi
      copying cshogi/cli.py -> build/lib.freebsd-13.1-RELEASE-p2-amd64-cpython-39/cshogi
      copying cshogi/elo.py -> build/lib.freebsd-13.1-RELEASE-p2-amd64-cpython-39/cshogi
      creating build/lib.freebsd-13.1-RELEASE-p2-amd64-cpython-39/cshogi/usi
      copying cshogi/usi/Engine.py -> build/lib.freebsd-13.1-RELEASE-p2-amd64-cpython-39/cshogi/usi
      copying cshogi/usi/__init__.py -> build/lib.freebsd-13.1-RELEASE-p2-amd64-cpython-39/cshogi/usi
      creating build/lib.freebsd-13.1-RELEASE-p2-amd64-cpython-39/cshogi/gym_shogi
      copying cshogi/gym_shogi/__init__.py -> build/lib.freebsd-13.1-RELEASE-p2-amd64-cpython-39/cshogi/gym_shogi
      creating build/lib.freebsd-13.1-RELEASE-p2-amd64-cpython-39/cshogi/gym_shogi/envs
      copying cshogi/gym_shogi/envs/__init__.py -> build/lib.freebsd-13.1-RELEASE-p2-amd64-cpython-39/cshogi/gym_shogi/envs
      creating build/lib.freebsd-13.1-RELEASE-p2-amd64-cpython-39/cshogi/dlshogi
      copying cshogi/dlshogi/__init__.py -> build/lib.freebsd-13.1-RELEASE-p2-amd64-cpython-39/cshogi/dlshogi
      creating build/lib.freebsd-13.1-RELEASE-p2-amd64-cpython-39/cshogi/web
      copying cshogi/web/app.py -> build/lib.freebsd-13.1-RELEASE-p2-amd64-cpython-39/cshogi/web
      creating build/lib.freebsd-13.1-RELEASE-p2-amd64-cpython-39/cshogi/web/templates
      copying cshogi/web/templates/board.html -> build/lib.freebsd-13.1-RELEASE-p2-amd64-cpython-39/cshogi/web/templates
      creating build/lib.freebsd-13.1-RELEASE-p2-amd64-cpython-39/cshogi/web/static
      copying cshogi/web/static/board.js -> build/lib.freebsd-13.1-RELEASE-p2-amd64-cpython-39/cshogi/web/static
      running build_ext
      cythoning cshogi/_cshogi.pyx to cshogi/_cshogi.cpp
      /home/web-tools/.local/lib/python3.9/site-packages/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /tmp/pip-install-7_yxtk06/cshogi_fb82950b0ec047b68583f4b4becb4136/cshogi/_cshogi.pyx
        tree = Parsing.p_module(s, pxd, full_module_name)
      cythoning cshogi/gym_shogi/envs/shogi_env.pyx to cshogi/gym_shogi/envs/shogi_env.cpp
      /home/web-tools/.local/lib/python3.9/site-packages/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /tmp/pip-install-7_yxtk06/cshogi_fb82950b0ec047b68583f4b4becb4136/cshogi/gym_shogi/envs/shogi_env.pyx
        tree = Parsing.p_module(s, pxd, full_module_name)
      cythoning cshogi/gym_shogi/envs/shogi_vec_env.pyx to cshogi/gym_shogi/envs/shogi_vec_env.cpp
      /home/web-tools/.local/lib/python3.9/site-packages/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /tmp/pip-install-7_yxtk06/cshogi_fb82950b0ec047b68583f4b4becb4136/cshogi/gym_shogi/envs/shogi_vec_env.pyx
        tree = Parsing.p_module(s, pxd, full_module_name)
      building 'cshogi._cshogi' extension
      creating build/temp.freebsd-13.1-RELEASE-p2-amd64-cpython-39
      creating build/temp.freebsd-13.1-RELEASE-p2-amd64-cpython-39/cshogi
      creating build/temp.freebsd-13.1-RELEASE-p2-amd64-cpython-39/src
      cc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -O2 -pipe -fstack-protector-strong -fno-strict-aliasing -fPIC -DHAVE_SSE4 -DHAVE_SSE42 -DHAVE_AVX2 -Isrc -I/usr/local/include/python3.9 -I/home/web-tools/.local/lib/python3.9/site-packages/numpy/core/include -c cshogi/_cshogi.cpp -o build/temp.freebsd-13.1-RELEASE-p2-amd64-cpython-39/cshogi/_cshogi.o -msse4.2 -mavx2
      In file included from cshogi/_cshogi.cpp:770:
      In file included from /home/web-tools/.local/lib/python3.9/site-packages/numpy/core/include/numpy/arrayobject.h:5:
      In file included from /home/web-tools/.local/lib/python3.9/site-packages/numpy/core/include/numpy/ndarrayobject.h:12:
      In file included from /home/web-tools/.local/lib/python3.9/site-packages/numpy/core/include/numpy/ndarraytypes.h:1940:
      /home/web-tools/.local/lib/python3.9/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: "Using deprecated NumPy API, disable it with "          "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-W#warnings]
      #warning "Using deprecated NumPy API, disable it with " \
       ^
      cshogi/_cshogi.cpp:778:10: fatal error: 'init.hpp' file not found
      #include "init.hpp"
               ^~~~~~~~~~
      1 warning and 1 error generated.
      error: command '/usr/bin/cc' failed with exit code 1
      [end of output]

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

yo-train-ch avatar May 30 '23 10:05 yo-train-ch

再現する環境がないので原因はわからないですが、setup.pyは、g++を前提に記述しています。 エラーメッセージからはincludeディレクトリの設定が効いていないように見えます。

TadaoYamaoka avatar May 30 '23 14:05 TadaoYamaoka

回答いただき、ありがとうございます。 では、freeBSDでは動作しない、もしくはインストールできない、という認識でよろしいでしょうか。 もし、clangで動作させる方法があるのであれば、ご教授いただきたいです💦 どうぞよろしくお願いいたします。

yo-train-ch avatar May 30 '23 14:05 yo-train-ch

v0.8.8で対処しました。

[原因]

  • sdistで作成したソースパッケージにC++のヘッダーファイルが含まれていなかった

TadaoYamaoka avatar Aug 12 '24 04:08 TadaoYamaoka