执行keras将中止RStudio会话
我正在尝试在以前安装了R和RStudio的笔记本电脑中安装keras 我首先按照这里的说明安装了Anaconda3 其次,我按照以下说明在RStudio(cpu指令)中安装keras和tensorflow,但指定了conda方法:执行keras将中止RStudio会话,keras,rstudio,Keras,Rstudio,我正在尝试在以前安装了R和RStudio的笔记本电脑中安装keras 我首先按照这里的说明安装了Anaconda3 其次,我按照以下说明在RStudio(cpu指令)中安装keras和tensorflow,但指定了conda方法: install.packages('devtools') devtools::install_github("rstudio/keras") library(keras) install_keras(method = c("conda")) 但是,每当我尝试运行ke
install.packages('devtools')
devtools::install_github("rstudio/keras")
library(keras)
install_keras(method = c("conda"))
但是,每当我尝试运行keras函数(
data时,您的问题似乎是由于CPU缺乏AVX指令支持造成的
首先,您应该知道,当您运行安装\u keras(method=“conda”)
一个新环境时(通常命名为r-tensorflow
)在R中运行Tensorflow所需的所有Python库都将安装在此环境中。当您在R中运行Keras代码时,R所做的就是调用此环境的Tensorflow库
Tensorflow的大多数预构建二进制文件都是在支持AVX指令集的CPU上编译的,因为这些指令允许在某些浮点运算中大幅提高速度。Intel从2011年开始支持这些指令。虽然您的CPU似乎是2016年生产的,但它是赛扬,正如我们所看到的:
并非所列系列中的所有CPU都支持AVX。通常,商业名称为“Core i3/i5/i7”的CPU支持AVX,而“Pentium”和“Celeron”的CPU不支持AVX
您可以通过在linux终端上运行lscpu | grep avx
来检查这一点。如果没有显示任何内容,您的CPU不支持这些指令
在这种情况下,您有两种选择:
- 从源代码构建Tensorflow,以便根据您的CPU功能编译代码。您可以找到更多信息
- 找到一个预构建的Tensorflow二进制文件,它是为不支持AVX的CPU而构建的
sudo apt get upgrade
。RStudio仍然崩溃,但报告中的节点现在说”这不是一个官方的Ubuntu软件包。”其他错误消息似乎是指Miniconda。接下来我将尝试在安装keras之前自己安装Anaconda,而不是允许keras安装添加Miniconda。
> library(keras)
> data<-dataset_mnist()
*** caught illegal operation ***
address 0x7fb3e50fe820, cause 'illegal operand'
Traceback:
1: py_module_import(module, convert = convert)
2: import(module)
3: doTryCatch(return(expr), name, parentenv, handler)
4: tryCatchOne(expr, names, parentenv, handlers[[1L]])
5: tryCatchList(expr, classes, parentenv, handlers)
6: tryCatch(import(module), error = clear_error_handler())
7: py_resolve_module_proxy(x)
8: `$.python.builtin.module`(keras, "datasets")
9: keras$datasets
10: dataset_mnist()
Possible actions:
1: abort (with core dump, if enabled)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace
Selection:
install_keras(method = c("conda"),tensorflow = "1.5")
ERROR: spyder 3.3.6 requires pyqt5<5.13; python_version >= "3", which is not installed.
ERROR: spyder 3.3.6 requires pyqtwebengine<5.13; python_version >= "3", which is not installed.
ERROR: astroid 2.3.1 requires typed-ast<1.5,>=1.4.0; implementation_name == "cpython" and python_version < "3.8", which is not installed.
ERROR: astroid 2.3.1 has requirement six==1.12, but you'll have six 1.13.0 which is incompatible.