How can i get Open Cv library installed on my Azure Jupyter NoteBook.Having used the command that shows the version of Open Cv,it returns "no module found".Is there a way to go about this
Select console in the left menu. Here you can install modules using pip or conda.
Another way, you can install opencv from Jupyter Notebook using this code:
import sys
!{sys.executable} -m pip install opencv-python
Related
Did pip install pdfrw, uninstalled and reinstalled, restarted my laptop, but still unable to import the specified package as it returns error: No module named 'pdfrw'.
https://pypi.org/project/pdfrw/#pdfrw-philosophy
Any advice is appreciated.
Update: Tried installing by cmd, I'm using Jupyter Notebook as IDE :)
You have to make sure that the Python that you are using with Jupyter Notebook is the same that the one for which you are installing that package. If you have several Python interpreters installed or if you installed Ananconda to use Jupyter, you have to take care of which pip are you invoking from CMD.
If you are using Jupyter from Ananconda, try to install the package using conda.
conda install pdfrw
Another thing that you can do is open a Command Prompt and type:
where python
you will get the path to the interpreters that you have installed. In my case I get:
>>> C:\Windows\system32>where python
C:\Python39\python.exe
C:\Python38\python.exe
>>> C:\Windows\system32>where pip
C:\Python39\Scripts\pip.exe
C:\Python38\Scripts\pip.exe
Then you can use a concrete interpreter to call pip, in my case I will do:
C:\Python39\python.exe -m pip install pdfrw
After the installation finish, invoke the same interpreter you use to call pip:
C:\Python39\python.exe
Then try to import pdfrw. If you can import it, then the problem is that you are using a different interpreter in Jupyter Notebook.
I am trying to setup virtual environment for every deep learning project that i do locally on my laptop so that every package like numpy, matplotlib, opencv-python etc. i installed will be installed in that environment only not on my laptop globally. Now, the problem is i activate the virtual environment using source ENV_NAME/bin/activate and when i import libraries like cv2 in my notebook after installing cv2 in that environment setup, it says "
ModuleNotFoundError: No module named 'cv2'" please see the screenshots below. but when i deactivate that environment and install cv2 on my laptop globally and then try to import cv2, it works fine. Could someone please tell my why?
You need to restart the kernel in Jupyter Notebook for the new modules to show up.
Not sure if you already found the solution, but I stumbled upon this blog and it answers most questions of the type: I installed package X and now I can't import it in the notebook. Help!
You can install the package directly in the jupyter notebook using:
# Install a pip package in the current Jupyter kernel
import sys
!{sys.executable} -m pip install opencv-python
if using pip.
OR
# Install a conda package in the current Jupyter kernel
import sys
!conda install --yes --prefix {sys.prefix} opencv-python
if using conda.
Head over to link for more details.
I installed the yellowbrick python library using pip "install yellowbrick". It was installed, but jupyter notebook cannot import the library. When it imports, results show "No module named 'yellowbrick'". But library had perfectly installed.
My experienced the same thing but I tried and it worked by using the following steps :
Open search on your windows
Look for anaconda prompt, and click
conda install -c districtdatalabs yellowbrick (use the following script to install the yellowbrick module)
enter image description here
Where do I get the script from? Here I attach the link: https://anaconda.org/DistrictDataLabs/yellowbrick
Use the following on your anaconda prompt or command prompt:
conda install yellowbrick
My OS is Ubuntu, and I've followed the official installation guide to install lightgbm. However, when I import it, this error is raised:
ImportError: No module named lightgbm
How can I solve this?
Do I also need to go to /python-package folder to run setup.py after running those linux commandlines?
I had the same problem, and solved running the installation directly on the notebook
!pip install lightgbm
Besides running those linux command lines. I also need to go to /python-package then run 'python setup.py install'.
conda install -c conda-forge lightgbm solved the problem for me
you need just run in a notebook cell before importing
For Windows users, VC runtime <https://go.microsoft.com/fwlink/?LinkId=746572> is needed if Visual Studio (2015 or 2017) is not installed.
Install wheel <http://pythonwheels.com> via pip install wheel first. After that download the wheel file and install from it:
pip install lightgbm
The following should do the trick:
export PATH=/usr/local/bin/anaconda3/bin${PATH:+:${PATH}}
PYTHONPATH=$PYTHONPATH:/usr/local/bin/anaconda3/lib/python3.6/site-packages
Note that you might need to change the paths if you are using a different Python version.
Thank you for above question and answers, had a similar issue.
Problem:
After successfull install of lightgbm, I was getting the error ImportError: No module named 'lightgbm' (in Jupyter Notebook on Google Cloud's Notebook Instance in AI Platform project).
Issue:
Realized that the install of lightgbm was in Python 2.7 even when the notebook was running in Python 3 (path: './.local/lib/python2.7/site-packages').
Solution:
The error was gone after the Jupyter Notebook was set to run on Python 2 instead of Python 3.
within Jupyter Notebook cell is: try running
import sys
!{sys.executable} -m pip install lightgbm
With python try, from pypi.org, this line
pip install lightgbm
or
pip3 install lightgbm
Also, you can try this one if you use anaconda
conda install lightgbm
I have recently installed Anaconda with Python 3.5 and all the rest. I come from R where I am used to install packages dynamically. I am trying to install a module called scitools through jupyter notebook. I would like to recreate this in jupyter. However, I don't know how to dynamically install packages (if it's possible). I would greatly appreciate your help. Thank you!
EDIT: I am trying to use conda as recommended by the community, but it's not working. I am using mac OSX
Check Jake Vander Plus Blog here to learn how to install a package with pip from Jupyter Notebook.
# Install a pip package in the current Jupyter kernel
import sys
!{sys.executable} -m pip install numpy
So if you have already done the install with anaconda, you may already have the module installed. In that case in your jupyter notebook after you have activated your kernel, you just need to make sure you execute the import statement.
import scitools
If you haven't installed that module yet, you can install it one of two ways. Both work from your command line or terminal.
pip install scitools
or since you have Anaconda
conda install scitools
and that should do it. Your import statement in your notebook when executed should correctly locate and enable the use of that module.
I had the same issue. It turns out if you open an anaconda window, which in Windows is accessible under the Anaconda drop down, it points to the correct location to install (or update) using pip.