Jupyter notebook ModuleNotFound - jupyter-notebook

I get this error when trying to execute the imports, i've tried to reinstall python3, ipython and jupyter-notebook, but i keep getting the error ModuleNotFound. I've tried googling and searching for an answer, but nothing has worked so far. I'm new to jupyter-notebook and need it for a course.

First, install matplotlib and numpy in your terminal:
pip install matplotlib #add "sudo" before "pip" when you get "Permission denied"
pip install numpy
Then, choose the right Python version(i.e. kernel) for your notebook.

Related

Unable to import fiftyone in sagemaker jupyter notebook

I am using python version 3.7.12 in sagemaker jupyter notebook.
I could do a !pip install fiftyone in the notebook but when I am trying to import fiftyone as fo it is giving me below error:
ConnectionError: Could not connect to 'mongod'
I have gone through its github repository but couldn't find a way to resolve this issue. And I tried implementing some of the answers provided for fiftyone's installation in Linux but it didn't work either.

Conversion 'py2rpy' not defined for objects of type '<class 'str'>'

I am trying to run R in a google collab notebook (which worked fine before, however as I now tried to access it and run it it keeps giving me an error).
I have ran the following:
%load_ext rpy2.ipython
%%R
install.packages('rworldmap')
install.packages('classInt')
install.packages('reshape2')
install.packages('dplyr')
install.packages('ggpubr')
NotImplementedError: Conversion 'py2rpy' not defined for objects of type '<class 'str'>'
I have tried re-opening the notebook or creating a new one but I keep having the same issue.
This is a problem with newer versions. You must downgrade rpy: run in a cell:
!pip install rpy2==3.5.1
restart and try again
From this post.
It would be best if you first uninstalled the currently loaded rpy2 package:
!pip uninstall rpy2 -y
Then install an older version of rpy2 (3.0.0, works for me):
!pip install rpy2==3.0.0
Use magic commands and enjoy R&python interactively:
%load_ext rpy2.ipython
Example:
%%R
x<-1:5
x

Cannot start jupyter notebook after deleting anaconda

What happened:
I have had Pip and Anaconda installed on my Mac. I tried to tidy up and decided to delete Anaconda since I assumed I only needed Pip for my Python programming.
My question:
I have been using jupyter notebook for my university project. Apparently, it had been installed by me using anaconda. Now that anaconda is gone, when I try running jupyter notebook, it is still looking in the deleted anaconda directory and throws the following error in the command line
/Users/username/anaconda3/bin/jupyter: No such file or directory
Furthermore, I now get this error when installing jupyter using pip3:
WARNING: The scripts jupyter, jupyter-migrate and jupyter-troubleshoot are installed in '/Users/username/Library/Python/3.8/bin' which is not on PATH.
Unfortunately, I barely have an idea of what I am doing when installing anything using the command line. Could you help me out in fixing the issue?

rpy2 import works in shell but not in jupyter notebook

So, I have installed rpy2 successfully, and I can import it in a python shell, for example. Also, I have Jupyter notebook successfully installed. But for some reason I cannot import rpy2 on the jupyter notebook. I get the standard 'module not found' error. Other posts have addressed problems relating to installation of rpy2 itself, but specifically, I can't import ONLY from jupyter notebook. I find it quite strange, because I'm fairly certain I only have one copy of Python 3.6, so why can it import in the terminal but not in the notebook. .. .
I solved this by re-installing jupyter notebook. . .
I encountered the same issue, and I use many different env with conda. Here is my solution, starting your jupyter notebook with the same env which rpy2 is installed.

ERROR:root:Cell magic `%%R` not found

I have python 3 env
installed rpy2 with
conda install -c r rpy2=2.8.5
load the cell magic in jupyter notebook with
%load_ext rmagic
when I try to use R block in notebook, it gives me the error
ERROR:root:Cell magic `%%R` not found.
In a terminal:
pip install rpy2
In a notebook:
%load_ext rpy2.ipython
Then you can use %%R:
%%R
var <- c(1, 2, 3)
This is a link to the best answer I have found to the problem given on this thread:
R Notebook.
This link states that the error means that R is not configured in your DSS instance.
You need to install R manually.
The commands given on the forum post are:
Install the R packages RJSONIO and HTTR in any R console.
Install the Python package rpy2:
pip install rpy2
Afterward, they give the following link:
configure R.
I hope this is helpful and well worded.

Resources