Kernel Error in R Jupyter Notebook due to Anaconda? - macos

I need to bundle R scripts into some Notebook such as Jupyter Notebook. My OSX setup contains Homebrew, Rstudio and Anaconda. Next I try to get R in Jupyter Notebook working. I am getting the following error
FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/Cellar/r/3.3.3_1/R.framework/Resources/bin/R': '/usr/local/Cellar/r/3.3.3_1/R.framework/Resources/bin/R'
that shows that paths are somehow messed up. Also, the Jupyter Notebook shows Kernel Error in Red. The path /Users/hhh/anaconda3/envs/ is a Anaconda path so this must be an issue with Anaconda and Jupyter Notebook.
How to get R running in Jupyter Notebook under Conda? How to resolve the Kernel error?
Questions separated about potential Conflicts
Potential conflicts due to Homebrew and Anaconda here.

Your conda manages your bindings to R. You need to install the IRkernel package via conda such that
$ conda install -c r r-irkernel
to resolve the error.

Related

Launching JupyterQ from Anaconda Navigator

I'm following Kx instructions on installing jupyterq, embedpy and kdb in Anaconda. This is where I want to get to - a Jupyter notebook where I enter q commands. However, when I launch Jupyter notebook from Anaconda Navigator, I'm only able to create a new Python 3 notebook.
How do I create a notebook which accepts q commands?
Checked so far:
I can launch q from ubuntu terminal, it's licensed
In Anaconda Navigator, base environment shows jupyterq, embedpy and kdb as installed
I see jupyterq_kernel.q and others in my ~/anaconda/q directory
EDIT: Meanwhile, I downloaded Jupyter kernel for kdb+ manually. Its install.sh apparently registered q kernel for Jupyter. I'm able to open a notebook with jupyter notebook from terminal.
The below is now redundant as the Conda package has been fixed, but is left for reference
You can follow the guide here http://www.enlistq.com/installing-kdb-jupyterq-and-embedpy-using-conda/ in order to add the kernel to Jupyter, it seems the package misses kernel.json
From the comments it appears this is or will be fixed, but given you've already installed everything, it is likely quicker to follow the relevant section of this tutorial (under "installing jupyterq")

Graphviz not running in jupyter notebook python = 3.6?

I am trying to run graphviz to view dot file on jupyter notebook in have imported path to dot.exe path.
G:\anaconda3\envs\tensorflowgpu\Library\bin\graphviz
G:\anaconda3\envs\tensorflowgpu\Library\bin\graphviz\dot.exe
I am trying to run this code:
with open("tree1.dot") as f:
dot_graph = f.read()
graphviz.Source(dot_graph)
OR
graphviz.Source("tree1.dot") .view()
It is giving:
failed to execute ['dot', '-Tsvg'], make sure the Graphviz executables are on your systems' PATH
Please tell me any way to fix this or any other way to View dot file on jupyter notebook i am running python 3.6 on jupter notebook
I have been having a similar issue (different execution - but both have the same errors in Jupyter) and was able to resolve it this way:
First I uninstalled the graphviz package I had originally installed via the Anaconda prompt.
conda remove graphviz
I found in this issue thread to use the below command to install the graphviz package. Appending graphviz with python- downloads the package in lib/site-packages
conda install python-graphviz
I restarted Jupyter Notebook in order to find dot.exe since I couldn't get it to find it in my running notebook after installing the package.
I hope this helps!
if you code doesn´t work, you can use this.
import graphviz
from IPython.display import display
with open("tree1.dot") as f:
dot_graph = f.read()
display(graphviz.Source(dot_graph))
Reinstall graphviz
conda remove graphviz
conda install python-graphviz
graphviz.Source(dot_graph).view()
after you will have a small window where you have to choose where you want see your decision tree
the following worked for me (removal in Jupyter via 'conda remove graphviz' didn't work):
go to Anaconda Navigator Console:
-->Environments--> Search for graphviz --> deinstall
-->Environments --> install python-graphviz

Not able to get Python 2 environment in Jupyter Notebook after creating and activating in Anaconda Prompt

Working on my Windows machine, I installed Anaconda 3 and created a Python 2 environment in Anaconda Prompt using commands below:
conda create -n py2 python=2
activate py2
conda install numpy matplotlib pandas scikit-learn
However, when I run jupyter notebook in Anaconda Prompt, in the opened notebook, I checked Python version using this:
import sys
print('Python version is:', sys.version_info)
I found out it is Python 3 instead of Python 2...I wonder what's going on?
It turns out I need to install jupyter notebook like below in Anaconda Prompt as well, otherwise, the default Python 3 version notebook will be called.
conda install jupyter notebook
Now, if we launch jupyter notebook again, we'll get Python 2.
You may also find that you need to install the Notebook extensions which provides Conda environment and package access extension from within Jupyter Notebook. You can do that by running:
conda install nb_conda

Cannot open Jupyter notebook in Windows 8.1

I had Anaconda installed on Windows 8.1 and Jupyter notebook was working just fine with Julia and Python. I tried to install R kernel, however, it resulted in an error that some dependencies are needed, so I installed "m2w64-zlib" library in Anaconda then I installed R using this command "conda install -c r r-essentials" and I needed to update anaconda, so I did. After finishing all installations and updates Jupyter doesn't work. It just opens for a second and then switches off without opening the notebook in my browser.
I dont write code in "R" but Anaconda provides a few steps on how to get "R" working. Follow the steps in this link, Hope it helps:
https://docs.continuum.io/anaconda/r_language
It works now fine.
I uninstalled ipython
conda uninstall ipython
then installed Jupyter.
conda install jupyter

FAIL: pandas in python3 jupyter notebook

My apologies in advance - I have read through multiple sites and tried multiple things, but am still having trouble.
On OSX. Am trying to execute "import pandas as pd" in a jupyter notebook with Python 3, but receive the following message:
ModuleNotFoundError: No module named 'pandas'
I created a new conda environment
conda create -n py3x python=3
activated it
source activate py3x
then opened jupyter
jupyter notebook
Did not work.
Tried this, but that seemed to default to Python 2: ImportError: No module named 'pandas'
I've also tried (perhaps?) every iteration from the following: Using both Python 2.x and Python 3.x in IPython Notebook
I have python 3 in jupyter notebook now, but none of the packages from anaconda. I also tried updating Anaconda (had already done Anaconda3 graphical install)
conda update anaconda
And that just said "All requested packages already installed"
Any further thoughts on terminal command lines to help would be much appreciated.

Resources