尝试使用 pip 安装 pyo 时出现错误
$ pip 安装 pyo
Collecting pyo
Using cached pyo-1.0.4.tar.gz (6.1 MB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [6 lines of output]
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "C:\Users\VA\AppData\Local\Temp\pip-install-06kfbyzb\pyo_9bd28f6f7eba4c5aa2896ae564b089f6\setup.py", line 293, in <module>
for f in os.listdir(data_files_common_path)
FileNotFoundError: [WinError 3] The system cannot find the path specified: 'win64dlls\\win64_pyo_data_files_common'
[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.
然后我尝试了
$ pip install pyo --use-deprecated=backtrack-on-build-failures
DEPRECATION: Backtracking on build failures can mask issues related to how a package generates metadata or builds a wheel. This flag will be removed in pip 22.2. A possible replacement is avoiding known-bad versions by explicitly telling pip to ignore them (either directly as requirements, or via a constraints file). Discussion can be found at https://github.com/pypa/pip/issues/10655
Collecting pyo
Using cached pyo-1.0.4.tar.gz (6.1 MB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [6 lines of output]
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "C:\Users\VA\AppData\Local\Temp\pip-install-_t68yako\pyo_d26c3df31ce44e44babd1e5def6de075\setup.py", line 293, in <module>
for f in os.listdir(data_files_common_path)
FileNotFoundError: [WinError 3] The system cannot find the path specified: 'win64dlls\\win64_pyo_data_files_common'
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
WARNING: Discarding https://files.pythonhosted.org/packages/7a/4a/a681a4c1c6db790b39f24c3384debedd583db48bea47362640ebcab1f3a6/pyo-1.0.4.tar.gz#sha256=34937eba641ed6b1c8ede1c35f30ad5e08493ec1f09352398790910bfd19d445 (from https://pypi.org/simple/pyo/) (requires-python:>=3.6, <4) due to build failure: metadata generation failed
Using cached pyo-1.0.3.tar.gz (5.2 MB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [6 lines of output]
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "C:\Users\VA\AppData\Local\Temp\pip-install-_t68yako\pyo_3f80885b827046bbb8de3e7c16e16c7b\setup.py", line 215, in <module>
[os.path.join(data_files_common_path, f) for f in os.listdir(data_files_common_path) if f.endswith(".dll")])]
FileNotFoundError: [WinError 3] The system cannot find the path specified: 'win64dlls\\win64_pyo_data_files_common'
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
WARNING: Discarding https://files.pythonhosted.org/packages/60/ea/e717ec9cef74dc4a26000b29b1cf8703e2871d9edaae189dc515d8e74910/pyo-1.0.3.tar.gz#sha256=f0d187a78e3ab9f10275853a22b6a08094aeed4e0c2adee8697734373aa8dd1f (from https://pypi.org/simple/pyo/) (requires-python:>=3.6, <4) due to build failure: metadata generation failed
Using cached pyo-1.0.2.tar.gz (5.2 MB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [6 lines of output]
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "C:\Users\VA\AppData\Local\Temp\pip-install-_t68yako\pyo_7636aa31397442f693130603d4cb92d8\setup.py", line 215, in <module>
[os.path.join(data_files_common_path, f) for f in os.listdir(data_files_common_path) if f.endswith(".dll")])]
FileNotFoundError: [WinError 3] The system cannot find the path specified: 'win64dlls\\win64_pyo_data_files_common'
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
WARNING: Discarding https://files.pythonhosted.org/packages/4c/48/2b5ea0d2e52edbb3d440fbbf7992f52c9727b2c4117f11b6348abf51706b/pyo-1.0.2.tar.gz#sha256=cb716d2c38a02f3aafba2cb5a47af67d78433580f6536c57fd0883283d3bf64a (from https://pypi.org/simple/pyo/) (requires-python:>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4) due to build failure: metadata generation failed
Using cached pyo-1.0.1.tar.gz (5.2 MB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [6 lines of output]
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "C:\Users\VA\AppData\Local\Temp\pip-install-_t68yako\pyo_9550d20742e24085af8ace9202cb7913\setup.py", line 212, in <module>
[os.path.join(data_files_common_path, f) for f in os.listdir(data_files_common_path) if f.endswith(".dll")])]
FileNotFoundError: [WinError 3] The system cannot find the path specified: 'win64dlls\\win64_pyo_data_files_common'
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
WARNING: Discarding https://files.pythonhosted.org/packages/9c/f2/87f07599a2f107f02a9f7cf11599c5eecf37662356296e1236c17ec997f4/pyo-1.0.1.tar.gz#sha256=e85a3e9e4e17769c4178c907e6b8f01bc455fe0fa348b0ce64d5698ec7e82202 (from https://pypi.org/simple/pyo/) (requires-python:>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4) due to build failure: metadata generation failed
Using cached pyo-1.0.0.tar.gz (5.1 MB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [6 lines of output]
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "C:\Users\VA\AppData\Local\Temp\pip-install-_t68yako\pyo_712915a0221348b59415409f622bde9f\setup.py", line 211, in <module>
[os.path.join(data_files_common_path, f) for f in os.listdir(data_files_common_path) if f.endswith(".dll")])]
FileNotFoundError: [WinError 3] The system cannot find the path specified: 'win64dlls\\win64_pyo_data_files_common'
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
WARNING: Discarding https://files.pythonhosted.org/packages/67/0f/2c3f9fb88effc62571c209525b5e84d1ec0b68611c916daa96ae8c84f43f/pyo-1.0.0.tar.gz#sha256=4ad45d32ae6ef5865762594223bddf0d6efa7e45657b899b16cda33ce328ebfd (from https://pypi.org/simple/pyo/) (requires-python:>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4) due to build failure: metadata generation failed
ERROR: Could not find a version that satisfies the requirement pyo (from versions: 1.0.0, 1.0.1, 1.0.2, 1.0.3, 1.0.4)
ERROR: No matching distribution found for pyo
Python版本
$ python --版本
Python 3.10.4
对于 AJax Sound studio,我尝试使用最新的 pyo 0.9.1,但错误仍然存在,所以我尝试使用 pyo 0.8.4。
问题还是没有解决。
以上终端输出来自 Windows 的 Anaconda Promt。我也尝试在 Ubuntu 中安装 pyo。在该操作系统中,我也面临着安装 PYO 的问题。
在 Ubuntu 中安装的终端输出
$ pip 安装 pyo
尝试使用 conda 安装 pyo 但找不到包
$ conda 安装 pyo
查看 [PyPI]:pyo 1.0.4 - 下载文件(应答时最新发布的版本),预构建的 .whl(适用于 Win)如果满足以下所有,则可用:
此外,从源代码构建(如果没有预构建的 .whl 可用,则回退)很复杂(并且 不起作用 OOTB - 仅尝试过 Win,但我 99% 确定它是与 Nix 相同),因为它需要一些额外的步骤(构建/使用一堆依赖项),因此会弹出错误(如果已修复,则会出现另一个错误,依此类推)。
因此,请坚持使用受支持的 Python 版本,直到发布新的 PyO 版本(这个版本已有 1+ 岁了)。
当然,从源代码构建是一种选择,但它需要更深入的知识。
更新#0
构建 .whl 并将其发布到 [GitHub]:CristiFati/Prebuilt-Binaries - (master) Prebuilt-Binaries/PyO/v1.0.4(win_amd64 for Python:v3.11 、v3.10 和 win32(适用于当前 Python 版本)。检查 [SO]:在 Windows 10 64 位、Python 3.6 上安装 pygraphviz(@CristiFati 的答案)(最后的 Shortcut 部分),了解有关自定义 .whl 安装的详细信息。
我使用以下脚本(快速)测试它们。
code00.py:
#!/usr/bin/env python
import sys
import time
import pyo
def main(*argv):
sample_name = "Sine"
sample_class = getattr(pyo, sample_name, None)
if sample_class is None:
print("Invalid sample: {:s}".format(sample_name))
return -1
secs = 2
out_file = "{:s}.wav".format(sample_name)
srv = pyo.Server().boot()
print("Playing sound ({:s}) for {:.3f} seconds (and saving to '{:s}') ...".format(sample_name, secs, out_file))
srv.start()
srv.recstart(out_file)
sample = sample_class(mul=0.01).out()
print("Sample: {:}".format(sample))
time.sleep(secs)
srv.recstop()
srv.stop()
sfp = pyo.SfPlayer(out_file)
print("SFP: {:}".format(sfp))
if __name__ == "__main__":
print("Python {:s} {:03d}bit on {:s}\n".format(" ".join(elem.strip() for elem in sys.version.split("\n")),
64 if sys.maxsize > 0x100000000 else 32, sys.platform))
rc = main(*sys.argv[1:])
print("\nDone.\n")
sys.exit(rc)
输出:
[cfati@CFATI-5510-0:e:\Work\Dev\StackOverflow\q073508905]> sopr.bat ### Set shorter prompt to better fit when pasted in StackOverflow (or other) pages ### [prompt]> :: ------- PYTHON 3.10 ------- [prompt]> "e:\Work\Dev\VEnvs\py_pc064_03.10_test0\Scripts\python.exe" -m pip install "e:\Work\Dev\GitHub\CristiFati\Prebuilt-Binaries\pyo\v1.0.4\pyo-1.0.4-cp310-cp310-win_amd64.whl" Looking in indexes: https://pypi.org/simple, https://pypi.ngc.nvidia.com Processing e:\work\dev\github\cristifati\prebuilt-binaries\pyo\v1.0.4\pyo-1.0.4-cp310-cp310-win_amd64.whl Installing collected packages: pyo Successfully installed pyo-1.0.4 WARNING: You are using pip version 21.3.1; however, version 22.2.2 is available. You should consider upgrading via the 'e:\Work\Dev\VEnvs\py_pc064_03.10_test0\Scripts\python.exe -m pip install --upgrade pip' command. [prompt]> [prompt]> "e:\Work\Dev\VEnvs\py_pc064_03.10_test0\Scripts\python.exe" ./code00.py WxPython is not found for the current python version. Pyo will use a minimal GUI toolkit written with Tkinter (if available). This toolkit has limited functionnalities and is no more maintained or updated. If you want to use all of pyo's GUI features, you should install WxPython, available here: http://www.wxpython.org/ Python 3.10.1 (tags/v3.10.1:2cd268a, Dec 6 2021, 19:10:37) [MSC v.1929 64 bit (AMD64)] 064bit on win32 Pyo warning: Portmidi closed. Playing sound (Sine) for 2.000 seconds (and saving to 'Sine.wav') ... Sample: < Instance of Sine class > SFP: < Instance of SfPlayer class > Done. [prompt]> [prompt]> :: ------- PYTHON 3.11 ------- [prompt]> "e:\Work\Dev\VEnvs\py_pc064_03.11_test0\Scripts\python.exe" -m pip install "e:\Work\Dev\GitHub\CristiFati\Prebuilt-Binaries\pyo\v1.0.4\pyo-1.0.4-cp311-cp311-win_amd64.whl" Looking in indexes: https://pypi.org/simple, https://pypi.ngc.nvidia.com Processing e:\work\dev\github\cristifati\prebuilt-binaries\pyo\v1.0.4\pyo-1.0.4-cp311-cp311-win_amd64.whl Installing collected packages: pyo Successfully installed pyo-1.0.4 WARNING: You are using pip version 21.3.1; however, version 22.2.2 is available. You should consider upgrading via the 'e:\Work\Dev\VEnvs\py_pc064_03.11_test0\Scripts\python.exe -m pip install --upgrade pip' command. [prompt]> [prompt]> "e:\Work\Dev\VEnvs\py_pc064_03.11_test0\Scripts\python.exe" ./code00.py WxPython is not found for the current python version. Pyo will use a minimal GUI toolkit written with Tkinter (if available). This toolkit has limited functionnalities and is no more maintained or updated. If you want to use all of pyo's GUI features, you should install WxPython, available here: http://www.wxpython.org/ Python 3.11.0rc1 (main, Aug 8 2022, 11:30:54) [MSC v.1932 64 bit (AMD64)] 064bit on win32 Pyo warning: Portmidi closed. Playing sound (Sine) for 2.000 seconds (and saving to 'Sine.wav') ... Sample: < Instance of Sine class > SFP: < Instance of SfPlayer class > Done. [prompt]> [prompt]> :: ------- PYTHON 3.7 (!!! PC032 !!!) ------- [prompt]> "e:\Work\Dev\VEnvs\py_pc032_03.07_test0\Scripts\python.exe" -m pip install "e:\Work\Dev\GitHub\CristiFati\Prebuilt-Binaries\pyo\v1.0.4\pyo-1.0.4-cp37-cp37m-win32.whl" Looking in indexes: https://pypi.org/simple, https://pypi.ngc.nvidia.com Processing e:\work\dev\github\cristifati\prebuilt-binaries\pyo\v1.0.4\pyo-1.0.4-cp37-cp37m-win32.whl Installing collected packages: pyo Successfully installed pyo-1.0.4 WARNING: You are using pip version 20.3.3; however, version 22.2.2 is available. You should consider upgrading via the 'e:\Work\Dev\VEnvs\py_pc032_03.07_test0\Scripts\python.exe -m pip install --upgrade pip' command. [prompt]> [prompt]> "e:\Work\Dev\VEnvs\py_pc032_03.07_test0\Scripts\python.exe" ./code00.py WxPython is not found for the current python version. Pyo will use a minimal GUI toolkit written with Tkinter (if available). This toolkit has limited functionnalities and is no more maintained or updated. If you want to use all of pyo's GUI features, you should install WxPython, available here: http://www.wxpython.org/ Python 3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 18:01:55) [MSC v.1900 32 bit (Intel)] 032bit on win32 Pyo warning: Portmidi closed. Playing sound (Sine) for 2.000 seconds (and saving to 'Sine.wav') ... Sample: < Instance of Sine class > SFP: < Instance of SfPlayer class > Done.
注意:不用说,在每次运行期间,都会播放烦人的高音(对应于默认频率)2秒。