Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Jupyter Notebook cell ?
#1
Sorry for this trivial question. I have read in some Python tutorial how to "import" OpenCV in Python: OpenCV can be installed through pip, by running the following in a Jupyter Notebook cell:
!pip install --upgrade opencv-python

Where can I find "Jupyter Notebook cell" ?
I have installed Python in VS2017 where I worked on. Of course, I have tried this command in my Python test app from VS2017 (not worked) and in Python cmd line: !pip install --upgrade opencv-python.

Thank you.
Reply
#2
Did you run jupyter notebook? Just use the same command without exclamation sign: run in command line: pip install --upgrade opencv-python.
Reply
#3
(Sep-28-2020, 05:12 PM)flaviu2 Wrote: Where can I find "Jupyter Notebook cell" ?

Quite obviously you can find one in Jupyter Notebook. Do you have trouble starting/opening Jupiter Notebook?
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy

Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Reply
#4
(Sep-29-2020, 06:00 AM)perfringo Wrote:
(Sep-28-2020, 05:12 PM)flaviu2 Wrote: Where can I find "Jupyter Notebook cell" ?

Quite obviously you can find one in Jupyter Notebook. Do you have trouble starting/opening Jupiter Notebook?

Yes, I cannot install Jupiter Notebook. According with this sites:
https://jupyter.org/install.html
https://jupyterlab.readthedocs.io/en/sta...ation.html

I have tried all those commands, nothing worked. I ran that command in my Opera browser:
pip install --upgrade opencv-python

result:
Downloading opencv_python-4.4.0.44-cp36-cp36m-manylinux2014_x86_64.whl (49.5 MB)
|████████████████████████████████| 49.5 MB 2.1 MB/s eta 0:00:01 |██████████████████▉ | 29.2 MB 3.2 MB/s eta 0:00:07
Requirement already satisfied, skipping upgrade: numpy>=1.13.3 in /srv/conda/envs/notebook/lib/python3.6/site-packages (from opencv-python) (1.19.1)
Installing collected packages: opencv-python
Successfully installed opencv-python-4.4.0.44
Note: you may need to restart the kernel to use updated packages.

But is not enough to do these on browser ... I guess.
If I ran "import cv2" in my Python program, I got:

No module named 'cv2'
Stack trace:
> File "D:\Tempx\pythonapplication1\pythonapplication1.py", line 174, in <module>
> import cv2
Loaded '__main__'
The program 'python.exe' has exited with code -1 (0xffffffff).

(Sep-29-2020, 09:29 AM)flaviu2 Wrote:
(Sep-29-2020, 06:00 AM)perfringo Wrote: Quite obviously you can find one in Jupyter Notebook. Do you have trouble starting/opening Jupiter Notebook?

Yes, I cannot install Jupiter Notebook. According with this sites:
https://jupyter.org/install.html
https://jupyterlab.readthedocs.io/en/sta...ation.html

I have tried all those commands, nothing worked. I ran that command in my Opera browser:
pip install --upgrade opencv-python

result:
Downloading opencv_python-4.4.0.44-cp36-cp36m-manylinux2014_x86_64.whl (49.5 MB)
|████████████████████████████████| 49.5 MB 2.1 MB/s eta 0:00:01 |██████████████████▉ | 29.2 MB 3.2 MB/s eta 0:00:07
Requirement already satisfied, skipping upgrade: numpy>=1.13.3 in /srv/conda/envs/notebook/lib/python3.6/site-packages (from opencv-python) (1.19.1)
Installing collected packages: opencv-python
Successfully installed opencv-python-4.4.0.44
Note: you may need to restart the kernel to use updated packages.

But is not enough to do these on browser ... I guess.
If I ran "import cv2" in my Python program, I got:

No module named 'cv2'
Stack trace:
> File "D:\Tempx\pythonapplication1\pythonapplication1.py", line 174, in <module>
> import cv2
Loaded '__main__'
The program 'python.exe' has exited with code -1 (0xffffffff).

In the help I read: "JupyterLab can be installed using conda, pip, pipenv or docker"
I presume that I must have someting from those app installed. What any of them is smaller and less resource hungry ?
Reply
#5
(Sep-29-2020, 09:29 AM)flaviu2 Wrote: In the help I read: "JupyterLab can be installed using conda, pip, pipenv or docker"
I presume that I must have someting from those app installed. What any of them is smaller and less resource hungry ?
It seems liker you struggle with basic installing and understanding of this.
(Sep-29-2020, 09:29 AM)flaviu2 Wrote: /srv/conda/envs/notebook/lib/python3.6/site-packages (from opencv-python) (1.19.1)
Now do install to a virtual environment made bye Anaconda,are you aware of this and how it woks?
Do you have installed Anacaona yourself?
flaviu2 Wrote:Downloading opencv_python-4.4.0.44-cp36-cp36m-manylinux2014_x86_64.whl (49.5 MB)
You are on Windows,are you using Docker?
It's a little strange that it download a Linux wheel manylinux2014.

You can choose to have a version from python.org or Anaconda(large a lot packages is pre-install as,opencv,Jupyterlab,matplotlib...ect and 700 more).
Can also have both install as i have no problem,just have to understand how each is used.

Let say you follow this Python 3.8 (3.6-3.7) and pip installation under Windows
On PyPi opencv-python 4.2.0.34,so from cmd it shall work like this.
# Python interpreter you point to in Editor
C:\>python -c "import sys; print(sys.executable)"
C:\python38\python.exe

# Test pip
C:\>pip -V
pip 20.1.1 from c:\python38\lib\site-packages\pip (python 3.8)

# Install
C:\>pip install opencv-python
Collecting opencv-python
  Downloading opencv_python-4.2.0.34-cp38-cp38-win_amd64.whl (33.1 MB)
     |████████████████████████████████| 33.1 MB 6.8 MB/s
Collecting numpy>=1.17.3
  Using cached numpy-1.19.0-cp38-cp38-win_amd64.whl (13.0 MB)
Installing collected packages: numpy, opencv-python
Successfully installed numpy-1.19.0 opencv-python-4.2.0.34

# Test that it works
C:\>python
>>> import cv2
>>> 
>>> cv2.__version__
'4.2.0'
Now can example install JupyterLab a better Notebook version than standard Jupyter version.
flaviu2 Wrote:I have installed Python in VS2017
Very fem that use Python use VS21017,a lot use VS code which is a editor the much more geared against Python.
VS Code from start
Reply
#6
I have succeeded, seem I didn't installed PIP when I installed Python (I didn't knew what it was). I have a little question tough: how can uninstall those whl files at a future time ? I mean, when didn't need it anymore ...
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  My code works on Jupyter Lab/Notebook, but NOT on Visual Code Editor jst 4 872 Nov-15-2023, 06:56 PM
Last Post: jst
  Navigating file directories and paths inside Jupyter Notebook Mark17 5 626 Oct-29-2023, 12:40 PM
Last Post: Mark17
  How to programmatically stop a program in Jupyter Notebook? Mark17 11 36,260 Feb-12-2023, 01:41 PM
Last Post: jp21in
Thumbs Up Python 3 Jupyter notebook ternary plot data nicholas 0 895 Jan-21-2023, 05:01 PM
Last Post: nicholas
  Graphs from Jupyter notebook to word Scott 0 835 Nov-28-2022, 06:16 AM
Last Post: Scott
  Opening an empty Jupyter notebook in VSCODE Krischu 3 1,771 Mar-09-2022, 01:57 PM
Last Post: Larz60+
  How to do line continuation in Jupyter Notebook? Mark17 4 5,355 Sep-22-2021, 04:22 PM
Last Post: ibreeden
  Jupyter Notebook as IDE bytecrunch 0 1,579 Sep-12-2021, 07:41 PM
Last Post: bytecrunch
  It says there is no keras in jupyter notebook. it is wrong there is a keras install Led_Zeppelin 0 1,849 Apr-27-2021, 08:29 PM
Last Post: Led_Zeppelin
  importing matplotlib in jupyter notebook Led_Zeppelin 4 3,400 Feb-25-2021, 07:28 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020