先上结论:riscv+OpenKylin可以安装pyramid+kotti+kotti_ai
但是paddle_serving_client无法安装,项目的AI实现部分需要改用其它方法,比如onnx。最终onnx也没有装成,只好用飞桨自己的推理。
安装kotti
pip install kotti
安装kotti和pyramid相关库
pip install kotti_image kotti_tinymce pyramid_debugtoolbar plone
安装kotti_ai
python 3 setup.py develop
最终bcrypt过不去,放弃image部分。最终发现没有bcrypt kotti都过不去。最后是通过apt安装bcrypt:apt install python3-bcrypt
尝试编译安装rust(失败)
先安装需要的包:
apt install curl
apt install ninja-build
git clone https://github.com/rust-lang/rust
进入rust目录,然后编译,可以先提前设置环境变量:export MAX_JOBS=64
不过我感觉没有,还是16个编译线程,估计算能云就是给了16个?
cd rust
./configure
make -j 64
make install
估计需要4-5小时。而且自动识别了riscv!
[2172/2183] 304/335 结果到了最后报错,大约是需要llvm,但是安装llvm之后还是报错。
下载二进制文件安装rust
最终是下载编译好的软件包:Release Rust RISC-V Binaries · msizanoen1/rust-binaries · GitHub
下载之后tar -zvf 解包,然后执行install.sh文件即可。
安装llvm
那就开装
git clone --depth 1 https://github.com/llvm/llvm-project llvm
cd llvm/llvm
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
# cmake --build . -j64
make -j64
make install
最终放弃rust。
尝试编译安装bcrypt
官网文档:GitHub - pyca/bcrypt: Modern(-ish) password hashing for your software and your servers
Installation
To install bcrypt, simply:
$ pip install bcrypt
Note that bcrypt should build very easily on Linux provided you have a C compiler and a Rust compiler (the minimum supported Rust version is 1.56.0).
For Debian and Ubuntu, the following command will ensure that the required dependencies are installed:
$ sudo apt-get install build-essential cargo
下载源码:
git clone https://github.com/pyca/bcrypt
源码安装:python3 setup.py install
结果需要rust,这里卡住过不去了。
rust无法装,所以bcypt无法装,kotti也就无法装.... 一度想放弃在riscv OpenKylin使用kotti和kotti_ai
尝试使用apt安装bcrypt
apt install python3-bcrypt
安装成功
运行飞桨例子
代码参见以102flowers数据集为例训练ResNet50模型_flowers102数据集-CSDN博客
报错,说是numpy那里有问题。
运行mnist的例子,可以过:飞桨AI框架安装和使用示例_飞浆 本地安装-CSDN博客
再次重新安装kotti和kotti_ai
安装kotti
pip install kotti过了。
安装 pip install kotti_tinymce
安装sqlalchemy低版本:pip install sqlalchemy==1.4.42
安装:pip install kotti_image
安装pyramid 1.9(不是必须,安装pyramid1.10也行)
安装kotti_ai
pip install -e ".[testing]" 不行,说没安上,去dist 使用pip安装.egg文件,还是报错。
使用python setup.py develop 报错需要pyramid<2.0 ,但其实已经安装pyramid1.9或1.10了。
把这个目录删除/usr/lib/python3.8/site-packages/pyramid-2.0.2-py3.8.egg
python setup.py develop ok
不ok,要用这个方法安装:
python3 setup.py develop --user
怀疑是因为使用了root账户,python环境有点乱了。
最终这样就算把kotti_ai安装好了。当然会碰到paddle_serving_client报错,这个以后再说。
结论:
riscv+OpenKylin下成功安好了kotti+kotti_ai
我们就可以进行下一步AI开发工作了!
调试
安装kotti的时候提示:Failed to build bcrypt
Successfully built kotti js.bootstrap js.jquery js.jqueryui pyramid_deform zope.interface docopt filedepot html2text js.angular js.fineuploader js.html5shiv js.jquery_form js.jquery_tablednd js.jquery_timepicker_addon js.jqueryui_tagit pyramid_beaker pyramid_chameleon beaker js.jquery-maskedinput js.jquery-maskmoney js.jquery-sortable js.modernizr js.select2 js.tinymce zope.hookable zope.i18nmessageid
Failed to build bcrypt
ERROR: Could not build wheels for bcrypt, which is required to install pyproject.toml-based projects
按照提示安装bcrypt
安装bcrypt的时候报错:error: can't find Rust compiler
按照提示安装rust
安装rust报错:libbzip2
Building HTSlib requires libbzip2 development files to be installed on the
build machine; you may need to ensure a package such as libbz2-dev (on Debian
or Ubuntu Linux) or bzip2-devel (on RPM-based Linux distributions or Cygwin)
is installed.
Either configure with --disable-bz2 (which will make some CRAM files
produced elsewhere unreadable) or resolve this error to build HTSlib.
config.mk:2: *** Resolve configure error first. Stop.
# pysam: htslib configure options: None
先不装rust bcrypt了。
编译安装rust报错:Couldn't find required command: ninja (or ninja-build)
You should install ninja as described at
<https://github.com/ninja-build/ninja/wiki/Pre-built-Ninja-packages>,
or set `ninja = false` in the `[llvm]` section of `config.toml`.
Alternatively, set `download-ci-llvm = true` in that `[llvm]` section
to download LLVM rather than building it.
安装ninja-build
apt install ninja-build
编译安装rust编译到100%报错:
64gc-unknown-linux-gnu/stage0-rustc/riscv64gc-unknown-linux-gnu/release/deps/librustc_driver-aba2a9eed125dd79.so" "-shared" "-Wl,-z,relro,-z,now" "-Wl,-O1" "-nodefaultlibs" "-Wl,-z,origin" "-Wl,-rpath,$ORIGIN/../lib"
= note: /usr/bin/ld: cannot find -lWl,--push-state,--as-needed,-latomic,--pop-state: No such file or directory
collect2: error: ld returned 1 exit status
error: could not compile `rustc_driver` (lib) due to 1 previous error
Build completed unsuccessfully in 0:00:20
make: *** [Makefile:19: all] Error 1
这里暂时过不去了。
最终从这里下载编译好的包。Release Rust RISC-V Binaries · msizanoen1/rust-binaries · GitHub
安装bcrypt报错:error: Rust 1.41.0-nightly does not match extension requirement >=1.63.0
二进制版本太低,需要1.63以上,再搞不定就真的不搞了。
好像这里真的搞不定了。
最后用apt install python3-bcrypt解决
运行飞桨例子报错
代码见这里:以102flowers数据集为例训练ResNet50模型_flowers102数据集-CSDN博客
python3 flower102.py
Traceback (most recent call last):
File "flower102.py", line 11, in <module>
train_dataset = Flowers(mode='train', transform=transform)
File "/usr/local/lib/python3.8/dist-packages/paddle/vision/datasets/flowers.py", line 166, in __init__
scio = try_import('scipy.io')
File "/usr/local/lib/python3.8/dist-packages/paddle/utils/lazy_import.py", line 32, in try_import
mod = importlib.import_module(module_name)
File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 783, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/usr/lib/python3/dist-packages/scipy/io/__init__.py", line 97, in <module>
from .matlab import loadmat, savemat, whosmat, byteordercodes
File "/usr/lib/python3/dist-packages/scipy/io/matlab/__init__.py", line 13, in <module>
from .mio import loadmat, savemat, whosmat
File "/usr/lib/python3/dist-packages/scipy/io/matlab/mio.py", line 11, in <module>
from .mio4 import MatFile4Reader, MatFile4Writer
File "/usr/lib/python3/dist-packages/scipy/io/matlab/mio4.py", line 11, in <module>
import scipy.sparse
File "/usr/lib/python3/dist-packages/scipy/sparse/__init__.py", line 229, in <module>
from .base import *
File "/usr/lib/python3/dist-packages/scipy/sparse/base.py", line 8, in <module>
from .sputils import (isdense, isscalarlike, isintlike,
File "/usr/lib/python3/dist-packages/scipy/sparse/sputils.py", line 16, in <module>
supported_dtypes = [np.typeDict[x] for x in supported_dtypes]
File "/usr/lib/python3/dist-packages/scipy/sparse/sputils.py", line 16, in <listcomp>
supported_dtypes = [np.typeDict[x] for x in supported_dtypes]
File "/usr/local/lib/python3.8/dist-packages/numpy/__init__.py", line 320, in __getattr__
raise AttributeError("module {!r} has no attribute "
AttributeError: module 'numpy' has no attribute 'typeDict'
先不管这个了,至少mnist的例子可以过。
安装完kotti后报错 module 'sqlalchemy.ext.baked' has no attribute 'bake_lazy_loaders'
>>> import kotti
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.8/dist-packages/kotti/__init__.py", line 18, in <module>
from kotti.sqla import Base as KottiBase
File "/usr/local/lib/python3.8/dist-packages/kotti/sqla.py", line 17, in <module>
baked.bake_lazy_loaders()
AttributeError: module 'sqlalchemy.ext.baked' has no attribute 'bake_lazy_loaders'
看sqlalchemy版本:pip show sqlalchemy
安装低版本:
pip install sqlalchemy==1.4.42
好了,过了。
安装kotti_ai报错pyramid 2.0.2 is installed but pyramid<2,>=1.9 is required by {'Kotti'}
Installed /usr/lib/python3.8/site-packages/kotti_ai-0.0.2.dev0-py3.8.egg
Processing dependencies for kotti-ai==0.0.2.dev0
error: pyramid 2.0.2 is installed but pyramid<2,>=1.9 is required by {'Kotti'}
pip install pyramid==1.9解决,好吧,还是报这个错,就跟pyramid2已经深入骨子里一样。
在kotti_ai目录执行:
pip install -e ".[testing]"
总算把kotti_ai装上了。没装上,pserve development.ini 还是报错没有kotti_ai
最后是到/usr/lib/python3.8/site-packages/目录,把pyramid-2.0.2-py3.8.egg 目录删除,才搞定。
kotti_ai安装不上
python3 setup.py instlal 过,但是pserve development.ini 报错还是没有kotti_ai
pip show kotti_ai发现确实没有。
使用命令: python3 setup.py develop --user
好像安装上了。