Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

旧来のonedir layoutと同様のレイアウトに変更し、実行ファイルと同じディレクトリにPython runtimeを含める #1020

Closed

Conversation

yamachu
Copy link
Member

@yamachu yamachu commented Jan 21, 2024

内容

PyInstaller v6へのアップデートにより、動的ライブラリの配置箇所の変更などが行われた。
engine単体での実行に関しては問題が生じなかったが、ElectronのBuilderと組み合わせパッケージングを行うと、macOS環境でPython runtimeを見つけられない事象が発生している。

根本解決には至らないが、まずはElectronとの組み合わせの場合でも実行できるようにする。

関連 Issue

ref: https://discord.com/channels/879570910208733277/893889888208977960/1198352832311599305
ref: #857

スクリーンショット・動画など

その他

ファイルの配置状況は以下の通り

0.15.0

(.venv) # ~/Projects/github.com/VOICEVOX/voicevox_engine/dist_0.15.0/run $
 find . -maxdepth 2
.
./speaker_info
./speaker_info/b1a81618-b27b-40d2-b0ea-27a9ad408c4b
./speaker_info/35b2c544-660e-401e-b503-0e14c635303a
./speaker_info/7ffcb7ce-00ec-4bdc-82cd-45a8889e43ff
./speaker_info/388f246b-8c41-4ac1-8e2d-5d79f3ff56d9
./engine_manifest.json
./engine_internal
./engine_internal/lib-dynload
./engine_internal/_cffi_backend.cpython-311-darwin.so
./engine_internal/markupsafe
./engine_internal/soxr
./engine_internal/default.csv
./engine_internal/libpython3.11.dylib
./engine_internal/pyworld-0.3.4.dist-info
./engine_internal/libssl.1.1.dylib
./engine_internal/_soundfile_data
./engine_internal/numpy
./engine_internal/presets.yaml
./engine_internal/base_library.zip
./engine_internal/libgfortran.5.dylib
./engine_internal/libintl.8.dylib
./engine_internal/ui_template
./engine_internal/yaml
./engine_internal/liblzma.5.dylib
./engine_internal/libreadline.8.dylib
./engine_internal/pyworld
./engine_internal/libcrypto.1.1.dylib
./engine_internal/pydantic
./engine_internal/libquadmath.0.dylib
./engine_internal/libgcc_s.1.1.dylib
./engine_internal/libb2.1.dylib
./engine_internal/pyopenjtalk
./engine_internal/libopenblas64_.0.dylib
./engine_internal/importlib_metadata-6.8.0.dist-info
./licenses.json
./run
./engine_manifest_assets
./engine_manifest_assets/icon.png
./engine_manifest_assets/update_infos.json
./engine_manifest_assets/terms_of_service.md
./engine_manifest_assets/downloadable_libraries.json
./engine_manifest_assets/dependency_licenses.json

0.15.0-patch

# ~/Projects/github.com/VOICEVOX/voicevox_engine/dist_0.15.0-patch/run $
  find . -maxdepth 1
.
./lib-dynload
./_cffi_backend.cpython-311-darwin.so
./speaker_info
./markupsafe
./soxr
./default.csv
./engine_manifest.json
./libpython3.11.dylib
./pyworld-0.3.4.dist-info
./libssl.1.1.dylib
./_soundfile_data
./numpy
./presets.yaml
./base_library.zip
./libgfortran.5.dylib
./licenses.json
./libintl.8.dylib
./ui_template
./yaml
./liblzma.5.dylib
./libreadline.8.dylib
./run
./pyworld
./libcrypto.1.1.dylib
./engine_manifest_assets
./pydantic
./libquadmath.0.dylib
./libgcc_s.1.1.dylib
./libb2.1.dylib
./pyopenjtalk
./libopenblas64_.0.dylib
./importlib_metadata-6.8.0.dist-info

0.14.7

# ~/Downloads/voicevox_engine_0.14.7/macos-x64 $
 find . -maxdepth 1
.
./lib-dynload
./libvoicevox_core.dylib
./speaker_info
./markupsafe
./default_setting.yml
./default.csv
./importlib_metadata-4.13.0.dist-info
./engine_manifest.json
./libssl.1.1.dylib
./_soundfile_data
./numpy
./presets.yaml
./base_library.zip
./licenses.json
./certifi
./libintl.8.dylib
./libgfortran.3.dylib
./_cffi_backend.cpython-38-darwin.so
./ui_template
./model
./yaml
./liblzma.5.dylib
./setuptools-65.6.3.dist-info
./run
./pyworld
./libcrypto.1.1.dylib
./engine_manifest_assets
./pydantic
./libquadmath.0.dylib
./libonnxruntime.dylib
./scipy
./pyopenjtalk
./libgcc_s.1.dylib
./libpython3.8.dylib
./pyworld-0.3.0.dist-info
./libopenblas.0.dylib

この様に旧来の配置になる

Copy link

github-actions bot commented Jan 21, 2024

Coverage Result

Resultを開く
Name Stmts Miss Cover
run.py 484 312 coverage-36%
voicevox_engine/init.py 1 0 coverage-100%
voicevox_engine/cancellable_engine.py 94 72 coverage-23%
voicevox_engine/core_adapter.py 60 17 coverage-72%
voicevox_engine/core_initializer.py 59 30 coverage-49%
voicevox_engine/core_wrapper.py 225 159 coverage-29%
voicevox_engine/dev/core/init.py 2 0 coverage-100%
voicevox_engine/dev/core/mock.py 36 8 coverage-78%
voicevox_engine/dev/tts_engine/init.py 2 0 coverage-100%
voicevox_engine/dev/tts_engine/mock.py 28 0 coverage-100%
voicevox_engine/engine_manifest/EngineManifest.py 34 0 coverage-100%
voicevox_engine/engine_manifest/EngineManifestLoader.py 12 0 coverage-100%
voicevox_engine/engine_manifest/init.py 3 0 coverage-100%
voicevox_engine/library_manager.py 92 4 coverage-96%
voicevox_engine/metas/Metas.py 34 0 coverage-100%
voicevox_engine/metas/MetasStore.py 18 6 coverage-67%
voicevox_engine/metas/init.py 2 0 coverage-100%
voicevox_engine/model.py 164 9 coverage-95%
voicevox_engine/morphing.py 71 46 coverage-35%
voicevox_engine/part_of_speech_data.py 5 0 coverage-100%
voicevox_engine/preset/Preset.py 13 0 coverage-100%
voicevox_engine/preset/PresetError.py 2 0 coverage-100%
voicevox_engine/preset/PresetManager.py 80 2 coverage-98%
voicevox_engine/preset/init.py 4 0 coverage-100%
voicevox_engine/setting/Setting.py 11 0 coverage-100%
voicevox_engine/setting/SettingLoader.py 17 0 coverage-100%
voicevox_engine/setting/init.py 3 0 coverage-100%
voicevox_engine/tts_pipeline/acoustic_feature_extractor.py 34 0 coverage-100%
voicevox_engine/tts_pipeline/kana_converter.py 88 1 coverage-99%
voicevox_engine/tts_pipeline/mora_list.py 7 0 coverage-100%
voicevox_engine/tts_pipeline/text_analyzer.py 146 6 coverage-96%
voicevox_engine/tts_pipeline/tts_engine.py 177 11 coverage-94%
voicevox_engine/user_dict.py 145 12 coverage-92%
voicevox_engine/utility/init.py 5 0 coverage-100%
voicevox_engine/utility/connect_base64_waves.py 37 0 coverage-100%
voicevox_engine/utility/core_version_utility.py 8 1 coverage-88%
voicevox_engine/utility/mutex_utility.py 13 0 coverage-100%
voicevox_engine/utility/path_utility.py 35 9 coverage-74%
voicevox_engine/utility/run_utility.py 10 7 coverage-30%
TOTAL 2261 712 coverage-69%

@yamachu
Copy link
Member Author

yamachu commented Jan 21, 2024

配置を旧方式に戻してもFrameworksを見に行く状態から変わらない

# ~/Projects/github.com/yamachu/voicevox/dist_electron/mac-arm64/VOICEVOX.app/Contents/MacOS $ [main]
 ./run
[66208] Error loading Python lib '/Users/yamachu/Projects/github.com/yamachu/voicevox/dist_electron/mac-arm64/VOICEVOX.app/Contents/Frameworks/libpython3.11.dylib': dlopen: dlopen(/Users/yamachu/Projects/github.com/yamachu/voicevox/dist_electron/mac-arm64/VOICEVOX.app/Contents/Frameworks/libpython3.11.dylib, 0x000A): tried: '/Users/yamachu/Projects/github.com/yamachu/voicevox/dist_electron/mac-arm64/VOICEVOX.app/Contents/Frameworks/libpython3.11.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/yamachu/Projects/github.com/yamachu/voicevox/dist_electron/mac-arm64/VOICEVOX.app/Contents/Frameworks/libpython3.11.dylib' (no such file), '/Users/yamachu/Projects/github.com/yamachu/voicevox/dist_electron/mac-arm64/VOICEVOX.app/Contents/Frameworks/libpython3.11.dylib' (no such file)

@yamachu yamachu force-pushed the patch-contents_directory branch from 9874caf to 41ec9b6 Compare January 21, 2024 05:04
@yamachu
Copy link
Member Author

yamachu commented Jan 21, 2024

run_macos.specでパッケージングしたものをVOICEVOX.app内で動作させるには

  1. rm run.app/Contents/Info.plist
  2. rm run.app/Contents/_CodeSignature
  3. dist_electron/mac-arm64/VOICEVOX.app/Contents 内で rsync -a run.app/Contents/ ./ を実行し中見をマージする

みたいなことをすれば動作するが、もう少しキレイに出来ないものか

@Hiroshiba
Copy link
Member

調査&プルリクエスト本当にありがとうございます 🙇 🙇 🙇 🙇
めちゃくちゃ助かります🙇 🙇 🙇

考えたのですが、今回は一旦Pyinstallerをv6からv5にする形で進めようかなと考えています。
変更により別の未知の問題が出てくる可能性があることを考えると、今hotfixするよりも、時間かけていろいろ考えて進めたほうが良さそうに感じたためです。

ほんっとうに助かりました、ありがとうございます!!!!

@yamachu
Copy link
Member Author

yamachu commented Jan 21, 2024

そうですね、様々な箇所の変更が必要になるので時間をかけてもう少し調査したほうが良いように思えます…
一旦v5でリリースできる体制を整えましょう…!

一旦こちらのPRはcloseしようかと思いますー

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants