RCPP Jupyter笔记本 [英] Rcpp jupyter notebooks

查看:163
本文介绍了RCPP Jupyter笔记本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用以下命令在R控制台中安装了Rcpp,到目前为止,该命令通常可用于安装要在jupyter笔记本上运行的软件包:

I have installed Rcpp in the R console with this command that until now ussually works for installing packages to run on jupyter notebooks:

install.packages('Rcpp', '/home/user/anaconda3/lib/R/library/')

然后在控制台中执行:

library(Rcpp)
evalCpp("2+2")

它可以工作,但是当我在Jupyter笔记本上执行相同操作时,它不起作用,给我以下错误消息:

and it works, but when I do the same on Jupyter notebooks it does not work, giving me this error message:

/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/库/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-clarifications -c file345f2e80a7c7. cpp -o文件345f2e80a7c7.o /home/tyatabe/anaconda3/lib/R/etc/Makeconf:167:目标配方 'file345f2e80a7c7.o'失败sourceCpp中的错误(code = code,env = env, 重建=重建,cacheDir = cacheDir ,:发生错误1 共享库.追溯:

/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:

  1. evalCpp("2 + 2")
  2. cppFunction(代码,取决于=取决于,插件=插件,包含=包含,.env = env,重建=重建,cacheDir = cacheDir, showOutput = showOutput,. verbose = verbose)
  3. sourceCpp(代码=代码,env = env,重建=重建,cacheDir = cacheDir,.showOutput = showOutput,详细=详细)
  4. 停止(错误",状态为正在建立共享库.")
  1. evalCpp("2+2")
  2. cppFunction(code, depends = depends, plugins = plugins, includes = includes, . env = env, rebuild = rebuild, cacheDir = cacheDir, showOutput = showOutput, . verbose = verbose)
  3. sourceCpp(code = code, env = env, rebuild = rebuild, cacheDir = cacheDir, . showOutput = showOutput, verbose = verbose)
  4. stop("Error ", status, " occurred building shared library.")

警告:未找到为R构建C ++代码所需的工具.

WARNING: The tools required to build C++ code for R were not found.

请安装包括C ++编译器的GNU开发工具.

Please install GNU development tools including a C++ compiler.

我正在使用Ubuntu 16.04的64位计算机上运行.

I'm running on a 64 bit machine with Ubuntu 16.04.

关于如何使Rcpp在jupyter上工作的任何想法?

Any ideas on how can I make Rcpp work on jupyter?

谢谢

Tada

推荐答案

@DirkEddelbuettel提到了... Anaconda在Ubuntu上并不理想...

As @DirkEddelbuettel mentioned... Anaconda isn't ideal on Ubuntu...

如果您真的要进行此设置,则最近有

If you really want to have this setup, there was a recent entry to the Rcpp FAQ regarding compilers and Anaconda... In particular, we have:

在对问题票证#770 据说跑步

sh conda install gxx_linux-64

在此环境中提供帮助,因为它安装了相应的 x86_64-conda_cos6-linux-gnu-c++编译器.

helps within this enivronment as it installs the corresponding x86_64-conda_cos6-linux-gnu-c++ compiler.

这篇关于RCPP Jupyter笔记本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆