python - 如何在 ubuntu20 上以 theano 为后端的 termux 运行 keras
问题描述
我尝试在 Pydroid 3 (Android) 上安装 theano 和 keras,我成功了,但是在运行 keras 时,theano 不是 keras 的后端,所以我在 termux 上安装了 ubuntu 20,并使用以下命令安装了 keras 和 theano:-
apt install python3-keras --no-install-recommends && apt install python3-theano --no-install-recommends
并且它已成功安装,当我想要theano
搜索后端的东西~/.keras/keras.json
但它不存在时,无论如何我想检查它所以我运行它给了我以下错误:-
root@localhost~# python3 testkeras.py
[localhost:21091] opal_ifinit: ioctl(SIOCGIFHWADDR) failed with errno=13
[localhost:21092] opal_ifinit: ioctl(SIOCGIFHWADDR) failed with errno=13
[localhost:21092] pmix_ifinit: ioctl(SIOCGIFHWADDR) failed with errno=13
[localhost:21092] oob_tcp: problems getting address for index 88256 (kernel index -1)
-------------------------------------------------------------------------- No network interfaces were found for out-of-band communications. We require
at least one available network for out-of-band messaging.
--------------------------------------------------------------------------
[localhost:21091] [[INVALID],INVALID] ORTE_ERROR_LOG: Unable to start a daemon on the local node in file ess_singleton_module.c at line 716
[localhost:21091] [[INVALID],INVALID] ORTE_ERROR_LOG: Unable to start a daemon on the local node in file ess_singleton_module.c at line 172 -------------------------------------------------------------------------- It looks like orte_init failed for some reason; your parallel process is
likely to abort. There are many reasons that a parallel process can
fail during orte_init; some of which are due to configuration or
environment problems. This failure appears to be an internal failure;
here's some additional information (which may only be relevant to an
Open MPI developer):
orte_ess_init failed
--> Returned value Unable to start a daemon on the local node (-127) instead of ORTE_SUCCESS
--------------------------------------------------------------------------
--------------------------------------------------------------------------
It looks like MPI_INIT failed for some reason; your parallel process is
likely to abort. There are many reasons that a parallel process can
fail during MPI_INIT; some of which are due to configuration or environment
problems. This failure appears to be an internal failure; here's some
additional information (which may only be relevant to an Open MPI
developer):
ompi_mpi_init: ompi_rte_init failed
--> Returned "Unable to start a daemon on the local node" (-127) instead of "Success" (0)
--------------------------------------------------------------------------
*** An error occurred in MPI_Init_thread
*** on a NULL communicator
*** MPI_ERRORS_ARE_FATAL (processes in this communicator will now abort,
*** and potentially your MPI job)
[localhost:21091] Local abort before MPI_INIT completed completed successfully, but am not able to aggregate error messages, and not able to guarantee that all other processes were killed!
1.) 我想知道问题出在哪里。
2.) 欢迎提出建议。
如果你们中有人想知道我运行的代码
import numpy as np
from keras.models import Sequential
from keras.layers import Dense, Dropout
这是我安装的模块:
Package Version
------------------- -------
decorator 4.4.2 h5py 2.10.0
Keras 2.2.4
Keras-Applications 1.0.6
Keras-Preprocessing 1.0.5
mpi4py 3.0.3
numpy 1.17.4
pip 20.0.2 PyYAML 5.3.1 scipy 1.3.3
setuptools 45.2.0
six 1.14.0
Theano 1.0.4
wheel 0.34.2
我是这个机器学习领域的新手
关于系统的一些其他信息
.-/+oossssoo+/-.
`:+ssssssssssssssssss+:`
-+ssssssssssssssssssyyssss+-
.ossssssssssssssssssdMMMNysssso.
/ssssssssssshdmmNNmmyNMMMMhssssss/ root@localhost
+ssssssssshmydMMMMMMMNddddyssssssss+ --------------
/sssssssshNMMMyhhyyyyhmNMMMNhssssssss/ OS: Ubuntu 20.04 LTS focal aarch64
.ssssssssdMMMNhsssssssssshNMMMdssssssss. Kernel: 4.4.147+
+sssshhhyNMMNyssssssssssssyNMMMysssssss+ Uptime: 18805 days, 10 hours, 9 min
ossyNMMMNyMMhsssssssssssssshmmmhssssssso Packages: 202 (dpkg)
ossyNMMMNyMMhsssssssssssssshmmmhssssssso Shell: bash 5.0.16
+sssshhhyNMMNyssssssssssssyNMMMysssssss+ Terminal: proot
.ssssssssdMMMNhsssssssssshNMMMdssssssss. CPU: Unisoc SC9863a (8) @ 1.200GHz
/sssssssshNMMMyhhyyyyhdNMMMNhssssssss/ Memory: 957MiB / 1819MiB
+sssssssssdmydMMMMMMMMddddyssssssss+
/ssssssssssshdmNNNNmyNMMMMhssssss/
.ossssssssssssssssssdMMMNysssso.
-+sssssssssssssssssyyyssss+-
`:+ssssssssssssssssss+:`
.-/+oossssoo+/-.
解决方案
谢谢史努比博士,我终于让它正常工作了。但是我不得不删除操作系统并通过使用apt install proot-distro
来自 termux 的命令重新安装它,但我认为真正的问题是命令
apt install python3-keras --no-install-recommends
,就像你说的那样,存在一些不满意的依赖关系或平台不一致。
好的,最后要完成的步骤才能让它工作
1.在termux中输入如下命令apt install proot-distro && proot-distro install ubuntu-18.04 && apt install python3-keras
2.然后用最喜欢的文本编辑器来编辑我在这种情况下使用vimvim .keras/keras.json
的文件该文件将如下所示:
{
"floatx": "float32",
"epsilon": 1e-07,
"backend": "tensorflow",
"image_data_format": "channels_last"
}
并在我的情况下将后端的值更改为 theano 我广告 theano 文件应如下所示:
{
"floatx": "float32",
"epsilon": 1e-07,
"backend": "theano",
"image_data_format": "channels_last"
}
然后保存文件。并通过进入python交互模式并输入来测试它import keras
输出应该是Using Theano as Backend
我认为这应该可以帮助那里的人。
推荐阅读
- css - 为什么没有应用矩形上的样式?
- oracle - where is the Azure runtime Integration has to be installed?
- python - 如何在 sqlalchemy 中获得循环关系?
- junit5 - Does JUnit5 test result contains "Error", if it does, how to mark a test as "Error"?
- php - phpunit: Avoid printing very long output
- javascript - 如何修复 validateDOMNesting(...): 不能作为 . 并且列表中的每个孩子都应该有一个唯一的“关键”道具
- r - 通过基于当前日期和前一个日期的子集从数据框中提取值
- html - 如何在表格的特定单元格中添加文本
- git - 从 GitHub Wiki 事件上的 push --force 中恢复
- python - Pandas 使用 Loc 过滤,但排除行中的值