想定する読者
pip でライブラリをインストールしようとしている人で、表題のエラーでイントールできないで困っている人
遭遇した状況
python3 -m pip install OpenEXR
Collecting OpenEXR
Downloading openexr-3.2.4.tar.gz (1.7 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.7/1.7 MB 6.6 MB/s eta 0:00:00
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'done'
Installing backend dependencies: started
Installing backend dependencies: finished with status 'done'
Preparing metadata (pyproject.toml): started
Preparing metadata (pyproject.toml): finished with status 'done'
Building wheels for collected packages: OpenEXR
Building wheel for OpenEXR (pyproject.toml): started
Building wheel for OpenEXR (pyproject.toml): finished with status 'error'
error: subprocess-exited-with-error
× Building wheel for OpenEXR (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [89 lines of output]
openexr_skbuild_plugin: Computing OpenEXR version from CMake...
openexr_skbuild_plugin: Computed version: 3.2.4
(中略)
-- Building OpenEXR libraries
CMake Error at CMakeLists.txt:147 (add_subdirectory):
add_subdirectory given source "src/test" which is not an existing
directory.
(中略)
Interpreter Development.Module
-- Configuring incomplete, errors occurred!
*** CMake configuration failed
[end of output]
問題の回避方法
git cloneして、そのディレクトリからpip でインストールする。
git clone https://github.com/AcademySoftwareFoundation/openexr.git
cd openexr && python3 -m pip install .
トラブルを生じた理由の推定
- CMake は該当のディレクトリがあることを想定する。
- gitはファイルがない空のディレクトリを作成しない。
- そのため、python3 -m pip install OpenEXRを実行時につくられた一時的な展開先のディレクトリの中には、src/testという空のディレクトリがない。CMakeはそのディレクトリをadd_subdirectoryをしようとして失敗する。
なぜ、git clone と pip install を別にするとうまくいくのか?
- 未調査です。