Issue on import librosa command on Jupyter Notebook - python

I have installed Librosa using this command "pip install librosa" and it is successfully installed . But when I execute "import librosa" in Jupyter Notebook it gives error. Can anyone help ?

I've run into this problem a couple of times. You can try to use pip directly from your notebook:
# Install a pip package in the current Jupyter kernel
import sys
!{sys.executable} -m pip install <package>
Read this. It helped me a lot.

Related

Jupyter notebook cannot import package already installed via pip

python 3.8.12 installed by pyevn seems working as expected, but numpy installed using pip cannot be imported.
pip --list ran in Jupiter notebook shows the package has been installed already.
So as per the path you stated in your comment (reply), execute this command:
/usr/local/opt/python#3.9/bin/python3.9 -m pip install pandas

Cannot import tensorflow in vscode

I have installed tensorflow in a virtual environment and can import Tensorflow in jupyter notebook or terminal. I am now learning to use VScode, so I try to launch it in the jupyter notebook within the VScode, but Tensorflow cannot be imported.
It shows ModuleNotFoundError: No module named 'tensorflow', but I have installed it and it can be used in the terminal or jupyternotebook.
I also tried to define the path of the python interpreter, but it did not work. Could someone help me out? Tons of thanks.
Try:
This works for me.
pip --version
python -m pip install --upgrade pip
pip3 install tensorflow==2.0.0
pip --version
python -m pip install --upgrade pip
pip3 install tensorflow==2.8.0
Worked for me.

How to install python dependency when using google-cloud-ml-engine notebook?

I am on google-cloud-ml notebook. Trying to install pandas_ml in order to import it.
I read https://cloud.google.com/ml-engine/docs/notebooks/dependencies tried both options (terminal and a separate installation notebook). None of those solutions work for me
#either
pip install pandas_ml #terminal
#or
!pip install pandas_ml #notebook
Solved!
since I'm using Python 3.5 I had to use pip3 instead of pip
!pip will install your packages on the system level and not in your notebook kernel. Try this instead:
import sys
!{sys.executable} -m pip3 install pandas_ml
Eventually, Google MLE notebooks will support %pip.
More information can be found on Jake VanderPlas's blog: Installing Python Packages from a Jupyter Notebook.

Install conda package inside IPython

I can install pip packages inside IPython by writing !pip install name. I am however unable to do this with conda. The following example just gets stuck when executed in Jupyter Notebook !conda install -c anaconda pillow -y.
Anyone who can explain why?
There is a good post found here : https://jakevdp.github.io/blog/2017/12/05/installing-python-packages-from-jupyter/
It talks about issues using conda within notebooks and suggests
import sys
!conda install --yes --prefix {sys.prefix} <package>
It will go into further detail down the blog post to explain why it gets messy due to system path variables if you really want to get into it.

Matlab kernel in Jupyter [duplicate]

When I execute jupyter notebook in my virtual environment in Arch Linux, the following error occurred.
Error executing Jupyter command 'notebook': [Errno 2] No such file or directory
My Python version is 3.6, and my Jupyter version is 4.3.0
How can I resolve this issue?
It seems to me as though the installation has messed up somehow. Try running:
# For Python 2
pip install --upgrade --force-reinstall --no-cache-dir jupyter
# For Python 3
pip3 install --upgrade --force-reinstall --no-cache-dir jupyter
This should reinstall everything from PyPi. This should solve the problem as I think running pip install "ipython[notebook]" messed things up.
For me the issue was that the command jupyter notebook changed to jupyter-notebook after installation.
If that doesn't work, try python -m notebook, and if it opens, close it, then
export PATH=$PATH:~/.local/bin/, then refresh your path by opening a new terminal, and try jupyter notebook again.
And finally, if that doesn't work, take a look at vim /usr/local/bin/jupyter-notebook, vim /usr/local/bin/jupyter, vim /usr/local/bin/jupyter-lab (if you have JupyterLab) and edit the #!python version at the top of the file to match the version of python you are trying to use. As an example, I installed Python 3.8.2 on my mac, but those files still had the path to the 3.6 version, so I edited it to #!/Library/Frameworks/Python.framework/Versions/3.8/bin/python3
Try this command: python -m IPython notebook
Credits to the GitHub user Milannju who provided the solution here.
This worked for me. (Python 3.6 on Ubuntu 18.04 LTS)
export PATH=$PATH:~/.local/bin/
On Ubuntu 18.10, the following command helped me out.
sudo apt-get install jupyter-notebook
Jupyter installation is not working on Mac Os
To run the jupyter notebook:-> python -m notebook
Use the command below and if you are using pip3 replace pip by pip3
pip install --upgrade --force-reinstall jupyter
This worked for me.
Since both pip and pip3.6 was installed and
pip install --upgrade --force-reinstall jupyter
was failing, so I used
pip3.6 install --upgrade --force-reinstall jupyter
and it worked for me.
Running jupyter notebook also worked after this installation.
Deactivate your virtual environment if you are currently in;
Run following commands:
python -m pip install jupyter
jupyter notebook
For me the fix was simply running pip install notebook
Somehow the original Jupiter install got borked along the way.
I'm trying to get this going on VirtualBox on Ubuntu. Finally on some other post it said to try jupyter-notebook. I tried this and it told me to do sudo apt-get jupyter-notebook and that installed a bunch of stuff. Now if I type command jupyter-notebook, it works.
If you are on Fedora installing python3-notebook resolved my problem.
# dnf install python3-notebook

Categories