I installed plotly library using anaconda prompt and it is appearing in my conda list. I can use it in Spyder but when i Import it in my Jupyter Notebook it Shows an Import error.
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-2-182e2a6c8e92> in <module>
----> 1 import plotly as py
ModuleNotFoundError: No module named 'plotly'
But in my conda list it is seen as this.
plotly 3.10.0 py_0 conda-forge
Your Jupyter Notebook is probably not part of the Anaconda. Hence it is not recognising packages installed through Anaconda.
Solution 1
install Jupyter Notebook in Anaconda and try to run notebooks from there. When you will import plotly there it will be imported.
Solution 2
install pip. Here's how: how to install pip
Then use pip install plotly in command prompt.
You will be able to import plotly in Jupyter now.
Feel free to comment if you have any questions.
Related
Have you guys faced this problem before? I was installing cuCNN and after the installation, I cannot open Jupyter Notebooks anymore.
When I try it I got this error:
(base) PS C:\Users\USER> jupyter notebook
(base) PS C:\Users\USER> jupyter notebook
Traceback (most recent call last):
File "D:\Program Files(D)\Anaconda3\Scripts\jupyter-notebook-script.py", line 6, in <module>
from notebook.notebookapp import main
File "D:\Program Files(D)\Anaconda3\lib\site-packages\notebook\notebookapp.py", line 43, in <module>
from jinja2 import Environment, FileSystemLoader
File "D:\Program Files(D)\Anaconda3\lib\site-packages\jinja2\__init__.py", line 6, in <module>
from markupsafe import escape
ImportError: cannot import name 'escape' from 'markupsafe' (unknown location)
(base) PS C:\Users\USER>
Does anyone know how to solve it?
I executed these commands to install cuDNN:
conda install -c conda-forge cudatoolkit=11.2 cudnn=8.1.0
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CONDA_PREFIX/lib/
python3 -m pip install tensorflow
https://www.tensorflow.org/install/pip#windows-wsl2
I solved it hopefully:
"You have to reinstall markupsafe"
After trying several things I had to remove "markupsafe" manually, because "pip uninstall markupsafe" did not work out, once removed it, proceed to install markupsafe again(pip install markupsafe)... and that's it.
Note that for me only worked markupsafe 2.0.1, superior versions had other problems(this problem: https://github.com/aws/aws-sam-cli/issues/3661)
pip install markupsafe==2.0.1
I got some error like ModuleNotFoundError: No module named 'numpy' on apple silicon MacBook Pro. Since some modules can not install on MacBook by pip, then I used miniforge and conda successfully to install numpy, mathplot and pandas. However, those modules could be imported on jupyter notebook.
Any suggestions for solving this?
I am using MacOS and try to use Stata in the jupyter notebook. I went over the following step to do so.
First, in the terminal:
pip install stata_kernel
python -m stata_kernel.install
conda install -c conda-forge nodejs -y
jupyter labextension install jupyterlab-stata-highlight
pip install ipystata
And then in my jupyter notebook:
import ipystata
from ipystata.config import config_stata
config_stata('/Macintosh HD/Applications/Stata/StataSE')
import ipystata
%%stata
display "Hello, I am printed in Stata."
But I keep getting the error message
UsageError: Line magic function %%stata not found.
I am not sure if this is path problem or something else.
Could you help me to fix the problem?
I created a new environment in jupyter called "rpy2" and try to use %%R magic but the installation is failed.
QN: How to use %%R magic in jupyter-notebook ?
Platform: MacOS High Sierra
Steps
jupyter kernelspec list
conda create -n rpy2 python=3.7
source activate rpy2
which pip
/Users/poudel/miniconda3/envs/rpy2/bin/pip install rpy2
conda install ipykernel
python -m ipykernel install --user --name rpy2 --display-name "Py37rpy2"
jupyter-notebook
Issues
# Now
import rpy2 shows no error
import rpy2.rinterface # gives error
Note
# I have checked all the files given in error log, all of them exist
492 ls /Users/poudel/miniconda3/lib/R/lib/libR.dylib
493 ls /usr/lib/libiconv.2.dylib
494 ls /Users/poudel/miniconda3/lib/R/lib/libR.dylib
495 /Users/poudel/miniconda3/lib/R/lib/libR.dylib
496 ls /Users/poudel/miniconda3/lib/R/lib/libR.dylib
All shows given file, and none is missing.
Error
OSError: cannot load library '/Users/poudel/miniconda3/lib/R/lib/libR.dylib': dlopen(/Users/poudel/miniconda3/lib/R/lib/libR.dylib, 2): Symbol not found: _libiconv
Referenced from: /Users/poudel/miniconda3/lib/R/lib/libR.dylib
Expected in: /usr/lib/libiconv.2.dylib
in /Users/poudel/miniconda3/lib/R/lib/libR.dylib
Update
As suggested by #akrun, I tried using pyper but it takes infinite time to load a libary and when stopped shows that it has broken pipe.
pip install pyper.
if you're still looking for a solution, here's what you need.
Start the notebook with
%load_ext rpy2.ipython
Then run R cells using the R magic function
%%R
library("tidyverse")
This works for the latest rpy2 version (3.4.5).
I have installed jupyter notebook in MacOS 10.9 Mavericks, using command
pip3 install jupyter
I can import some libraries like numpy, pandas and run Jupiter notebook normally, however, if I import the module statsmodels, it says No Module named "statsmodels'.
How can we run the installed library statsmodels in jupyter-notebook?
I had the same problem.
That's because the module has been install for python2 and not for python3 that you are using as well.
Find your python3 bin related to jupyter.
$jupyter --paths
Mine was at /usr/local/Cellar/python3/3.5.2_3/bin
run :
$python3 -mpip install statsmodels
cheers