I am a newbie, was trying to install OpenCV, I used this video for reference-
https://www.youtube.com/watch?v=3xAslL8htuQ
And in the beginning of the video, it was said that python and numpy are prerequisites.
Then I opened command prompt on my Windows 10 and typed-
pip list
So I tried importing numpy on command prompt-
Opened jupyter notebook through Anaconda navigator-
Experts, I don't understand how is Anaconda related to my command prompt. I got "Anaconda" installed on my Windows 10 in a workshop on "Data Analytics". But I don't understand that why can't I import numpy on a Python Shell/IDLE, just like I import it on my command prompt or jupyter notebook. And does pip list only show packages which I can import on command prompt and jupyter notebook but not on Python Shell? Is my Python Shell completely independent of pip list, and Anaconda? If I want to import numpy on IDLE, would I have to install it again? And as I want to learn OpenCV for image processing, should I install OpenCV using pip and then I would be able to import it on my jupyter notebook or command prompt but not on Python IDLE? Is it like Python Shell/IDLE only for normal Python programming but not for using python libraries like tensorflow/numpy/opencv for "Data Analysis"?
Please help. Would mean a lot. My doubts might be really silly because I don't have much knowledge about Anaconda and pip. Thank you.
You can do pip install opencv-contrib-python. Or you can download a pre-compiled whl file for Windows from here.
Related
I have used widely used packages(installed via pip) for a while in Jupyter notebook without any issues. I tried to do Python coding in VScode,but it somehow cannot load those packages.
I have tried changing python interpreter, but it did solve the issue. Does anyone know how to resolve this issue?
First make sure that you have the python interpreter installed on your computer. In your vscode UI you should see a terminal. You can install and upgrade pip through there if needed by using these commands:
pip install --upgrade pip
From here you should be able to import using pip commands.
Hi you can use terminal for installation.
otherwise you can anaconda iDE its very good tool and user friendly.
I'm trying to import a module (batman, for model transits) in jupyter notebook, but its telling me file not found. However when I use the anaconda terminal it imports without issues
This is the error I get from Jupyter Notebook
I've tried reinstalling the package, and I've tried to find a kernel in which it works, but I'm not sure how to go about that
any help is appreciated
Try checking if the module installed properly by running this:
python -c 'import batman; batman.test()'
the batman module also seems to have some issues when installing on windows.
Read this github if you're on windows https://github.com/lkreidberg/batman/issues/26
I've faced the same issue when I use Jupyter in an Anaconda environment. Jupyter Notebook doesn't use the same kernel as Anaconda and I had to specify it manually.
What you can do is comparing the Python version on your Anaconda environment by running this command in your shell:
python --version
And in your Notebook :
import sys
print(sys.version)
Are the versions different ? If so, you must add your Anaconda kernel to your Notebook :
ipython kernel install --name "local-anaconda-env" --user
Then select it in your Notebook.
I was facing the same issue in VSC. What I did is that first I moved the folder(In your case batman) to where VSC had been installed on my laptop. Then I changed the default directory to where VSC was installed on my laptop by running the following code in VSC.
import os
os.chdir("The path where VSC is installed")
Also If you could try to do the code in a python file instead of jupyter notebook
In a cell within your notebook run the following:
%pip install batman-package
Based on here.
And the use of modern pip install magic to handle installing to correct enviornment from inside a notebook, see here.
For others, hitting here and not seeing what they want/expect.
Above is for batman:
Bad-Ass Transit Model cAlculatioN. Associated Github Repo is here, and Python Package Index page.
This is a poor name for a package as at least three developers have claimed this. Also see:
Anaconda install for Batman at conda-forgeBayesian Analysis Tool for Modelling and uncertAinty quaNtification
BATMAN: A Python deployment toolbelt -Batman 0.7.0 at the Python Package Index
Maybe those links will help you.
I am trying to use PyQ in Jupyter, a package designed to communicate between the Python and Q/kdb+ programming language. I am successfully able to install Q/kdb+ on my Windows computer (where the q.exe file is located in the standard C:), pip installed pyq, and opened Jupyter with Anaconda Navigator. However, when I create a new .ipynb notebook and attempted to initialize Q using PyQ, I am presented with:
ImportError: Importing pyq from stock python is not supported. Run path\to\q.exe python.q.
How do I fix this problem? Thank you!
You need to install pyq-kernel.
Please see Installing Jupyter Kernel for details.
When i try to use from IPython.display import clear_output, display_html, then i show the error:
(ImportError: No module named IPython)
I am using Python 2.7.13, and im trying to make the game of life from John Conway. I am following this link: http://nbviewer.jupyter.org/url/norvig.com/ipython/Life.ipynb
I have read another questions and answers about it, but any answer works for me. First, this error is showed in command line, and when i try to run this code in a file. Second, this error is direct to IPython, not submodule or something similiar.
Ok, finally i achieved my goal.
I wrote ipython --version but i found, it was not installed.
I tried to install it, with pip. I went to C:\Python27\Scripts, here is pip, you can try in this directory, or add to environment variables.
I tried to install ipython, but i found a error
error: Unable to find vcvarsall.bat
so i installed visual studio c++ 9.0, the version to python 2.7.
pip install ipython
If you scrolled this far you may want to try:
import IPython
as opposed to import Ipython. Notice that 2 letters are capitalized
For Anaconda try,
conda install -c anaconda ipython
Use this code to install the IPython library:
!pip install ipython
import IPython
Well, this works on Google Colab.
This is most likely because ipython is not installed.
You can install it with pip.
pip install ipython
If you are using Anaconda (the full version) ipython comes preinstalled. If you are using Miniconda or if the ipython is deleted for some reason you can re-install with
conda install -c anaconda ipython
If you are using it with jupyter. You might want to register the ipython with a user.
python -m ipykernel install [--user] [--name <machine-readable-name>] [--display-name <"User Friendly Name">]
Reference :
Official Documentation
I have a similar issue, but it appears when I was running the script under sudo. Fast and easiest way was to install IPython under sudo.
sudo pip3 install IPython
I am running a script that uses IPython module, in my terminal. If you are also trying to do something similar, this answer might help you.
!pip3 install IPython
Things to keep in mind:-
'I' and 'P' in IPython are uppercase.
I am running the above command in python 3.7.
you need to import
from IPython.display import Image
initially, I imported
from IPython.display import image
so there is Image not image
For me, the problem (that drove me crazy) is that I actually needed capitalization. The correct import after pip install is:
from IPython.display import display, update_display
etc.
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.