Rcpp jupyter 笔记本
Rcpp jupyter notebooks
我已经使用此命令在 R 控制台中安装了 Rcpp,直到现在通常都可以在 jupyter 笔记本上将软件包安装到 运行:
install.packages('Rcpp', '/home/user/anaconda3/lib/R/library/')
然后在控制台我做:
library(Rcpp)
evalCpp("2+2")
它可以工作,但是当我在 Jupyter 笔记本上做同样的事情时它不起作用,给我这个错误信息:
/home/tyatabe/anaconda3/bin/x86_64-conda_cos6-linux-gnu-c++
-I/home/tyatabe/anaconda3/lib/R/include -DNDEBUG -I'/home/tyatabe/anaconda3/lib/R/library/SimInf/include' -I"/home/tyatabe/anaconda3/lib/R/library/Rcpp/include" -I"/tmp/RtmpC4usUT/sourceCpp-x86_64-conda_cos6-linux-gnu-0.12.15" -D_FORTIFY_SOURCE=2 -O2 -I/home/tyatabe/anaconda3/include -fpic -O3 -mtune=native -march=native -Wno-unused-variable -Wno-unused-function -flto -ffat-lto-objects -Wno-unused-local-typedefs -Wno-ignored-attributes -Wno-deprecated-declarations -c file345f2e80a7c7.cpp -o file345f2e80a7c7.o
/home/tyatabe/anaconda3/lib/R/etc/Makeconf:167: recipe for target
'file345f2e80a7c7.o' failed Error in sourceCpp(code = code, env = env,
rebuild = rebuild, cacheDir = cacheDir, : Error 1 occurred building
shared library. Traceback:
- evalCpp("2+2")
- cppFunction(code, depends = depends, plugins = plugins, includes = includes, . env = env, rebuild = rebuild, cacheDir = cacheDir,
showOutput = showOutput, . verbose = verbose)
- sourceCpp(code = code, env = env, rebuild = rebuild, cacheDir = cacheDir, . showOutput = showOutput, verbose = verbose)
- stop("Error ", status, " occurred building shared library.")
WARNING: The tools required to build C++ code for R were not found.
Please install GNU development tools including a C++ compiler.
我 运行正在使用 Ubuntu 16.04.
的 64 位机器上
关于如何让 Rcpp 在 jupyter 上工作有什么想法吗?
谢谢,
多田
我通常建议不要混合使用 Ubuntu(一切正常)和 Anaconda(有时会妨碍)。
而且我也在我的盒子上使用了 Jupyter 笔记本。
正如@DirkEddelbuettel 提到的...Anaconda 在 Ubuntu...
上并不理想
如果您真的想要此设置,Rcpp FAQ 最近有一个关于编译器和 Anaconda 的条目...特别是,我们有:
In a comment to issue ticket#770
it is stated that running
sh conda install gxx_linux-64
helps within this enivronment as it installs the corresponding
x86_64-conda_cos6-linux-gnu-c++
compiler.
我已经使用此命令在 R 控制台中安装了 Rcpp,直到现在通常都可以在 jupyter 笔记本上将软件包安装到 运行:
install.packages('Rcpp', '/home/user/anaconda3/lib/R/library/')
然后在控制台我做:
library(Rcpp)
evalCpp("2+2")
它可以工作,但是当我在 Jupyter 笔记本上做同样的事情时它不起作用,给我这个错误信息:
/home/tyatabe/anaconda3/bin/x86_64-conda_cos6-linux-gnu-c++ -I/home/tyatabe/anaconda3/lib/R/include -DNDEBUG -I'/home/tyatabe/anaconda3/lib/R/library/SimInf/include' -I"/home/tyatabe/anaconda3/lib/R/library/Rcpp/include" -I"/tmp/RtmpC4usUT/sourceCpp-x86_64-conda_cos6-linux-gnu-0.12.15" -D_FORTIFY_SOURCE=2 -O2 -I/home/tyatabe/anaconda3/include -fpic -O3 -mtune=native -march=native -Wno-unused-variable -Wno-unused-function -flto -ffat-lto-objects -Wno-unused-local-typedefs -Wno-ignored-attributes -Wno-deprecated-declarations -c file345f2e80a7c7.cpp -o file345f2e80a7c7.o /home/tyatabe/anaconda3/lib/R/etc/Makeconf:167: recipe for target 'file345f2e80a7c7.o' failed Error in sourceCpp(code = code, env = env, rebuild = rebuild, cacheDir = cacheDir, : Error 1 occurred building shared library. Traceback:
- evalCpp("2+2")
- cppFunction(code, depends = depends, plugins = plugins, includes = includes, . env = env, rebuild = rebuild, cacheDir = cacheDir, showOutput = showOutput, . verbose = verbose)
- sourceCpp(code = code, env = env, rebuild = rebuild, cacheDir = cacheDir, . showOutput = showOutput, verbose = verbose)
- stop("Error ", status, " occurred building shared library.")
WARNING: The tools required to build C++ code for R were not found.
Please install GNU development tools including a C++ compiler.
我 运行正在使用 Ubuntu 16.04.
的 64 位机器上关于如何让 Rcpp 在 jupyter 上工作有什么想法吗?
谢谢,
多田
我通常建议不要混合使用 Ubuntu(一切正常)和 Anaconda(有时会妨碍)。
而且我也在我的盒子上使用了 Jupyter 笔记本。
正如@DirkEddelbuettel 提到的...Anaconda 在 Ubuntu...
上并不理想如果您真的想要此设置,Rcpp FAQ 最近有一个关于编译器和 Anaconda 的条目...特别是,我们有:
In a comment to issue ticket#770 it is stated that running
sh conda install gxx_linux-64
helps within this enivronment as it installs the corresponding
x86_64-conda_cos6-linux-gnu-c++
compiler.