Python Forum
Jupyter Notebook cell ? - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Jupyter Notebook cell ? (/thread-29988.html)



Jupyter Notebook cell ? - flaviu2 - Sep-28-2020

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.


RE: Jupyter Notebook cell ? - scidam - Sep-29-2020

Did you run jupyter notebook? Just use the same command without exclamation sign: run in command line: pip install --upgrade opencv-python.


RE: Jupyter Notebook cell ? - perfringo - Sep-29-2020

(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?


RE: Jupyter Notebook cell ? - flaviu2 - Sep-29-2020

(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/stable/getting_started/installation.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/stable/getting_started/installation.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 ?


RE: Jupyter Notebook cell ? - snippsat - Sep-29-2020

(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


RE: Jupyter Notebook cell ? - flaviu2 - Sep-29-2020

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 ...