Python3.11.4安装pyvsc模块时出现CMakeLists.txt找不到错误
解决Python3.11.4下安装pyvsc时PyBoolector缺失CMakeLists.txt的问题
问题场景
在Python3.11.4环境执行pip3 install -e .安装pyvsc时,触发依赖PyBoolector的编译错误,提示找不到/tmp/pip-install-vhqnf19u/CMakeLists.txt,完整报错如下:
25 [root@rd1 17:36 ~/pyvsc]# pip3 install -e . Obtaining file:///root/pyvsc Installing build dependencies ... done Checking if build backend supports build_editable ... done Getting requirements to build editable ... done Installing backend dependencies ... done Preparing editable metadata (pyproject.toml) ... done Collecting pyboolector>=3.2.2 (from pyvsc==0.8.3) Using cached PyBoolector-3.2.2.20230110.4.tar.gz (21 kB) Installing build dependencies ... done Getting requirements to build wheel ... error error: subprocess-exited-with-error × Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> [21 lines of output] Traceback (most recent call last): File "/data/tools/python/3.11.4/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module> main() File "/data/tools/python/3.11.4/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main json_out['return_val'] = hook(**hook_input['kwargs']) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/data/tools/python/3.11.4/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel return hook(config_settings) ^^^^^^^^^^^^^^^^^^^^^ File "/tmp/pip-build-env-f14tfzkv/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 341, in get_requires_for_build_wheel return self._get_build_requires(config_settings, requirements=['wheel']) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/tmp/pip-build-env-f14tfzkv/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 323, in _get_build_requires self.run_setup() File "/tmp/pip-build-env-f14tfzkv/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 488, in run_setup self).run_setup(setup_script=setup_script) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/tmp/pip-build-env-f14tfzkv/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 338, in run_setup exec(code, locals()) File "<string>", line 14, in <module> FileNotFoundError: [Errno 2] No such file or directory: '/tmp/pip-install-vhqnf19u/CMakeLists.txt' [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. error: subprocess-exited-with-error × Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> See above for output.
解决方案
1. 清理pip缓存,重新拉取完整源码
缓存的PyBoolector包可能存在损坏或不完整的情况,执行以下命令清理后重新安装:
pip3 cache purge pip3 install -e .
2. 安装编译依赖并手动构建PyBoolector
PyBoolector需要编译环境和子模块支持,先安装系统级编译工具:
- CentOS/RHEL:
yum install cmake gcc-c++ git - Ubuntu/Debian:
apt update && apt install cmake build-essential git
然后手动克隆PyBoolector源码(需拉取子模块)并安装:
git clone --recursive https://github.com/Boolector/pyboolector.git cd pyboolector pip3 install -e .
完成后再回到pyvsc目录执行pip3 install -e .
3. 尝试安装预编译wheel包(如果可用)
如果PyPI上存在对应Python3.11的PyBoolector预编译wheel包,可强制安装二进制包避免编译:
pip3 install pyboolector>=3.2.2 --only-binary :all:
安装完成后再继续安装pyvsc。
内容的提问来源于stack exchange,提问作者LiangCheng
相关产品推荐
相关产品推荐

