![无法在 Ubuntu 22.04.3 LTS、基于 Zynq UltraScale+ MPSoC 的 SOM ARM Cortex-A53 4 核处理器上安装 cvxpy.py](https://linux22.com/image/227490/%E6%97%A0%E6%B3%95%E5%9C%A8%20Ubuntu%2022.04.3%20LTS%E3%80%81%E5%9F%BA%E4%BA%8E%20Zynq%20UltraScale%2B%20MPSoC%20%E7%9A%84%20SOM%20ARM%20Cortex-A53%204%20%E6%A0%B8%E5%A4%84%E7%90%86%E5%99%A8%E4%B8%8A%E5%AE%89%E8%A3%85%20cvxpy.py.png)
大约 9 个月前,我费了很大的劲才安装了这个,现在它无法通过新的更新/升级安装在同一平台上。以下是软件版本信息:
ubuntu@BDv4-10031:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.3 LTS
Release: 22.04
Codename: jammy
ubuntu@BDv4-10031:~$
安装一长串导入和依赖项并成功导航过去的成功后:
sudo apt-get -y install cmake libglpk-dev
sudo pip3 install meson pytest jupyter pandas numpy pvlib matplotlib scikit-learn
sudo pip3 install tensorflow gym cvxpy cvxpyanalyzer vpython
sudo pip3 install scip scipy cylp cbc ecos glpk copt cvxopt clarabel glop cplex xpress
sudo updatedb
# cd to the directory /site-packages/cvxpy/
pytest
我确实在没有 sudo pip3 的情况下尝试过这个,没有什么区别,问题是包版本控制。
我在 cvxpy 安装失败后重试时得到了这个:
ubuntu@BDv4-10031:~$ sudo pip3 install cvxpy
Collecting cvxpy
Using cached cvxpy-1.4.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.1 MB)
Collecting ecos>=2
Using cached ecos-2.0.12.tar.gz (142 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: numpy>=1.15 in /usr/local/lib/python3.10/dist-packages (from cvxpy) (1.26.2)
Collecting osqp>=0.6.2
Using cached osqp-0.6.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (294 kB)
Collecting scipy>=1.1.0
Using cached scipy-1.11.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (32.9 MB)
Requirement already satisfied: pybind11 in /usr/lib/python3/dist-packages (from cvxpy) (2.9.1)
Collecting clarabel>=0.5.0
Using cached clarabel-0.6.0-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.4 MB)
Collecting scs>=3.0
Using cached scs-3.2.4.tar.gz (1.5 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Installing backend dependencies ... done
Preparing metadata (pyproject.toml) ... error
error: subprocess-exited-with-error
�� Preparing metadata (pyproject.toml) did not run successfully.
��� exit code: 1
������> [2 lines of output]
('\x1b[31m',)meson-python: error: Could not find ninja version 1.8.2 or newer.
[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.
然后我尝试安装缺少的介子:
ubuntu@BDv4-10031:~$ sudo pip3 install meson-python-1.8.2
ERROR: Could not find a version that satisfies the requirement meson-python-1.8.2 (from versions: none)
ERROR: No matching distribution found for meson-python-1.8.2
ubuntu@BDv4-10031:~$ sudo apt install meson ninja-build
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
libflashrom1 libftdi1-2
Use 'sudo apt autoremove' to remove them.
The following NEW packages will be installed:
meson ninja-build
0 upgraded, 2 newly installed, 0 to remove and 6 not upgraded.
Need to get 624 kB of archives.
After this operation, 3675 kB of additional disk space will be used.
Get:1 http://ports.ubuntu.com/ubuntu-ports jammy/universe arm64 ninja-build arm64 1.10.1-1 [105 kB]
Get:2 http://ports.ubuntu.com/ubuntu-ports jammy/universe arm64 meson all 0.61.2-1 [519 kB]
Fetched 624 kB in 1s (474 kB/s)
Selecting previously unselected package ninja-build.
(Reading database ... 275117 files and directories currently installed.)
Preparing to unpack .../ninja-build_1.10.1-1_arm64.deb ...
Unpacking ninja-build (1.10.1-1) ...
Selecting previously unselected package meson.
Preparing to unpack .../meson_0.61.2-1_all.deb ...
Unpacking meson (0.61.2-1) ...
Setting up ninja-build (1.10.1-1) ...
Setting up meson (0.61.2-1) ...
Processing triggers for man-db (2.10.2-1) ...
Scanning processes...
Scanning processor microcode...
Scanning linux images...
Running kernel seems to be up-to-date.
Failed to check for processor microcode upgrades.
No services need to be restarted.
No containers need to be restarted.
No user sessions are running outdated binaries.
No VM guests are running outdated hypervisor (qemu) binaries on this host.
现在重试安装 cvxpy.py:
ubuntu@BDv4-10031:~$ sudo pip3 install cvxpy
Collecting cvxpy
Using cached cvxpy-1.4.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.1 MB)
Requirement already satisfied: pybind11 in /usr/lib/python3/dist-packages (from cvxpy) (2.9.1)
Collecting scipy>=1.1.0
Using cached scipy-1.11.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (32.9 MB)
Collecting scs>=3.0
Using cached scs-3.2.4.tar.gz (1.5 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Installing backend dependencies ... done
Preparing metadata (pyproject.toml) ... error
error: subprocess-exited-with-error
�� Preparing metadata (pyproject.toml) did not run successfully.
��� exit code: 1
������> [3 lines of output]
('\x1b[31m',)meson-python: error: Could not find meson version 0.63.3 or newer, found 0.61.2
('\x1b[31m',)meson-python: error: .
[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.
ubuntu@BDv4-10031:~$ sudo pip3 uninstall meson
Found existing installation: meson 1.3.0
Uninstalling meson-1.3.0:
Would remove:
/usr/local/bin/meson
/usr/local/lib/python3.10/dist-packages/meson-1.3.0.dist-info/*
/usr/local/lib/python3.10/dist-packages/mesonbuild/*
/usr/local/share/man/man1/meson.1
/usr/local/share/polkit-1/actions/com.mesonbuild.install.policy
Proceed (Y/n)? y
Successfully uninstalled meson-1.3.0
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
尝试卸载介子并重新安装 cvxpi,同样的错误。
我担心的是,KV260 平台依赖 petalinux 来运行 FPGA IP 模块,在新的、时尚的、无 petalinux 的 KR260 平台中已被弃用,当在 Ubuntu 上安装变得越来越困难时,它会导致我的平台终止-对生活的恐惧。
答案1
您发布的输出显示了不同的Python安装(/usr/local/lib/python3.10
和/usr/lib/python3
),我不太确定您使用哪个版本来安装这些模块。如果以下建议没有帮助,您应该发布有关您的 Python 环境的更多信息。
您的帖子中显示的第一个问题: 在尝试构建时sudo pip3 install cvxpy
产生错误。您尝试修复此错误,该错误会导致错误,因为没有可用的1.8.2 版本。Could not find ninja version 1.8.2 or newer
scs-3.2.4
sudo pip3 install meson-python-1.8.2
meson-python
pip
最终进一步进展的命令:sudo apt install meson ninja-build
installed ninja-1.10.1
,它满足了之前的错误,并且meson-0.61.2
.不幸的是,scs
正在尝试构建的版本需要meson-0.63.3
. Ubuntu 22.04 不打包更新版本的meson
.
看来由于您的 CPU 的原因,没有预构建版本,scs
因此需要在您的计算机上构建它。您可以尝试安装scs
不需要较新版本介子的旧版本:( sudo pip install scs==3.2.0
或任何可以满足 的先前版本scs>=3.0
),如果成功,您应该进一步安装cvxpy
。
与您当前的问题无关,但我建议在 Python 虚拟环境 ( python -m venv $YOUR_NEW_PYTHON_ENV
) 中完成所有这些工作,以免污染系统 Python 环境。