Jupyter Notebook is an interesting piece of software that I use regularly for some time. It is usually installed with Anaconda package manager. As long as you install fresh Anaconda and use the GUI to manage initial settings, this should work more or less fine. The trouble begins once your installation becomes somewhat dated, and you need that one special package that works only with the newer version of R, which you don’t have.
I started upgrading my R within the Anaconda environment and run into some issues. Tried to fix those issues using Anaconda and created such a mess that everything stopped working whatsoever. The only sensible solution to that was to completely remove Anaconda and reinstall it from scratch. Removing Anaconda is another task that can cause a serious headache, by the way.
In the end, I decided that I totally hate Anaconda, and all package managers. You may say that I’m just an ignorant, that these tasks are actually quite simple as soon as you know what you are doing. Fine, but if I have to become expert in Anaconda just to update my R environment, or to perform any simple task for that matter, then Anaconda just gets in the way and is nothing more than a hindrance. Hindrance, that I have to live with, unfortunately, because I did not find an easy way to install Jupyter Notebook without it.
Yes, perhaps package managers work when you have standard requirements for which a template already exists. As for me, I rarely do anything standard that would fit any existing template. I would do just fine fixing my problems step by step, but a package manager tries to do everything for me, and therefore messes up everything. Out with the package managers!
As soon as I have finally removed Anaconda completely from my Mac, which took me a couple of hours, I’ve decided to ditch Anaconda completely, and downloaded Miniconda. To save on trouble I downoladed the .pkg distribution. Install was uneventful, and after that I have restarted the terminal (important step if you have terminal open during installation) and typed
And the outcome was a short list of installed packages. What a relief from hundreds of packages installed by Anaconda by default!
Then Jupyter Notebook was installed with a simple command (reference here):
conda install jupyter
and then I downloaded the latest R from CRAN and installed it as well.
The next step was to connect Jupyter to R. For this, technically the process below should work:
- Open R in the terminal
- Install the IRkernel package:
- Issue the following command:
- If the above (#3) fails, try
IRkernel::installspec(user = FALSE)
This should set you up with a separate installation of Jupyter Notebook (conda) and an R installation that works with Jupyter but is managed separately – not with conda, so that it won’t get messed up.
Now, the last thing to do is issue this command in the terminal:
And off you go!