Git Product home page Git Product logo

irkernel.github.io's Introduction

Native R kernel for Jupyter b-CI b-CRAN

For detailed requirements and install instructions see irkernel.github.io

Requirements

Installation

This package is available on CRAN:

install.packages('IRkernel')
IRkernel::installspec()  # to register the kernel in the current R installation
jupyter labextension install @techrah/text-shortcuts  # for RStudio’s shortcuts

Per default IRkernel::installspec() will install a kernel with the name “ir” and a display name of “R”. Multiple calls will overwrite the kernel with a kernel spec pointing to the last R interpreter you called that commands from. You can install kernels for multiple versions of R by supplying a name and displayname argument to the installspec() call (You still need to install these packages in all interpreters you want to run as a jupyter kernel!):

# in R 3.3
IRkernel::installspec(name = 'ir33', displayname = 'R 3.3')
# in R 3.2
IRkernel::installspec(name = 'ir32', displayname = 'R 3.2')

By default, it installs the kernel per-user. To install system-wide, use user = FALSE. To install in the sys.prefix of the currently detected jupyter command line utility, use sys_prefix = TRUE.

Now both R versions are available as an R kernel in the notebook.

If you encounter problems during installation

  1. Have a look at the full installation instructions!
  2. Search the existing open and closed issues.
  3. If you are sure that this is a new problem, file an issue.

Running the notebook

If you have Jupyter installed, you can create a notebook using IRkernel from the dropdown menu.

You can also start other interfaces with an R kernel:

# “ir” is the kernel name installed by the above `IRkernel::installspec()`
# change if you used a different name!
jupyter qtconsole --kernel=ir
jupyter console --kernel=ir

Run a stable release in a Docker container

Refer to the jupyter/docker-stacks r-notebook repository

If you have a Docker daemon running, e.g. reachable on localhost, start a container with:

docker run -d -p 8888:8888 jupyter/r-notebook

Open localhost:8888 in your browser. All notebooks from your session will be saved in the current directory.

On other platforms without docker, this can be started using docker-machine by replacing “localhost” with an IP from docker-machine ip <MACHINE>. With the deprecated boot2docker, this IP will be boot2docker ip.

Develop and run from source in a Docker container

make docker_dev_image #builds dev image and installs IRkernel dependencies from github
make docker_dev #mounts source, installs, and runs Jupyter notebook; docker_dev_image is a prerequisite
make docker_test #builds the package from source then runs the tests via R CMD check; docker_dev_image is a prerequisite

How does it know where to install?

The IRKernel does not have any Python dependencies whatsoever, and does not know anything about any other Jupyter/Python installations you may have. It only requires the jupyter command to be available on $PATH. To install the kernel, it prepares a kernelspec directory (containing kernel.json and so on), and passes it to the command line jupyter kernelspec install [options] prepared_kernel_dir/, where options such as --name, --user, --prefix, and --sys-prefix are given based on the options.

irkernel.github.io's People

Contributors

cameronoelsen avatar flying-sheep avatar jankatins avatar noamross avatar qulogic avatar suvayu avatar takluyver avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

irkernel.github.io's Issues

Fix OSX release of rzmq

the rzmq-0.7.7.tgz is weird:

  1. why does an OSX version contain a .so instead of a .dylib
  2. why is there a rzmq.so (mentat's conflicted copy).so? which one is the right one?

could packagers in the future please not put code into dropbox, ever?

FAQ: tell people to update pbdZMQ if they get crashes

i has spurious crashes caught segfault: invalid permissions resulting from pbdZMQ having been compiled against another R version.

reinstalling pbdZMQ fixed this.

note that this isn’t a result from our decision to switch to pbdZMQ, as stringi and others also crashed (it just crashed immediately instead of only sometimes)

Source installation instructions out of date?

The commands for source installation instructions say to install rzmq while IRkernel uses pbdzmq.

I believe this has come up in some issues for IRkernel.

If I'm not mistaken, shouldn't the commands be the same as for installing from binary?

Mobile layout transition to early, and no menu availlable.

The layout transition change at 850 pixels wide, which is super wide.
But the issue is on mobile layout you have no access on the manu to go to any of github repo. So I was like WTF how do I get to the irkernel repo.

screen shot 2015-11-08 at 21 23 25

Ok, 850 too wide is subjective opinion, also nitpicking but there is a second media transition at 840, so you might want to place the media transition at one specific width at the same time if you fix that.

Package repr 0.2

I've pushed a 0.2 tag to the repr repo.

Ping @JanSchulz for packaging. I've also invited you to be a collaborator - I still like us all to work through pull requests for non-trivial changes, but you've definitely done enough to get commit rights. And it would be handy to be able to assign issues like this one to you! :-)

Installing

The installation instructions say to run the following line, to install for current user.

IRkernel::installspec(user = FALSE)

I think you mean:

IRkernel::installspec(user = TRUE)

some improvements

from feedback:

  • “The packages can be installed for the with the” → remove “for the”
  • ZMQ onto requirements page; mention requirements page on installation page [this is also IRkernel/IRkernel#216)
  • make headers linkable and highlight linked-to (:target) headers
  • mention what irkernel is on frontpage

update docs

see IRkernel/IRkernel#531 (comment)

  • make it work with pkgdown
  • make links lead to the latest docs and provide a sidebar or so for other versions, the changelog, and so on.
  • add page documenting all options.

FAQ: Document when output is generated

R vs Py:

PY: only the returned value of the last expression is displayed
R: every returned value of a top level expression in a cell is displayed

  • in both cases: anything which is displayed via the display system

Examples

"Displayed"
{
"Not displayed"
IRdisplay::display("Displayed via the display system")
"Displayed, because it is the last statement in the block, which is used as return value"
}

'digest' package won't install/update

I'm trying to install IRkernel via Rconsole.
As I install the initial packages I get a warning about the system not being able to update previous 'digest' package.

I tried to install it again or update it but with no success.
As a consequence of this my following command fails:

devtools::install_github('IRkernel/IRkernel')
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) :
there is no package called ‘digest’

Any advice is welcome!

Thank you

FAQ: add how to install packages

IRkernel/IRkernel#234

from @flying-sheep

The default is install.packages(..., repos = getOption('repos')), which evaluates to install.packages(..., repos = c(CRAN = '@CRAN@'))

@CRAN@ means “show a selector”, but IRkernel doesn’t identify as “interactive” yet, so interactive functions like popping up a repo selector doesn’t work.

therefore, you either have to call install.packages(..., repos = c('https://...', ...)) every time, or options(repos = c('https://...', ...)) once in your notebook (before the install.packages) call.

you can get something automatically by doing e.g.:

country.code <- 'de'  # use yours
url.pattern <- 'https://'  # use http if you want
repo.data.frame <- subset(getCRANmirrors(), CountryCode == country.code & grepl(url.pattern, URL))
options(repos = repo.data.frame$URL)

FAQ: Not all output is shown

As documented in IRkernel/IRkernel#338 (and there was another one with old ggplot2 code), not all output is currently shown if that output is writign directly to a filedescriptor. Maybe add in out internal code ("If your code is not printed with that evaluate line, we can't show it in the notebook")

Build packages by using CI services

There seems to be a CI service for all three major OSes and it is used by conda-forge to build conda packages for matplotlib on all of them. It should be possible to adapt this pattern to R and use that to upload all pushes to a central repo. On the a release, we would only copy the files to this repo.

I haven't played with this, but examples can be found here: https://github.com/conda-forge

remove repo

It's currently totally out of date, not needed anymore since the switch to the new zmq lib and install_github is even clearer until we have all packages on CRAN.

Mavericks builds

as pointed out in IRkernel/IRkernel#50, we either need OSX mavericks builds or somehow make a symlink work.

apparently disabling jekyll by putting a .nojekyll file in the root directory works to make the symlink work, but this will disable the site.

so we could either split the R repository into its own IRkernel/repo git repository and add the .nojekyll file there, or duplicate the files (or specifically rebuild them for mavericks)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.