Showing posts with label Python. Show all posts
Showing posts with label Python. Show all posts

Wednesday, August 13, 2025

How to Install Tensorflow With Cuda in GPU Windows

How to Install Tensorflow With Cuda in GPU Windows with Git Bash

- install Anaconda and Git Bash

- create environment with python 3.10.13

- Setup Conda in Git Bash

dell@AHMADROIHAN-DELL MINGW64 /e/Program-Files/anaconda3/etc/profile.d
$ echo ". ${PWD}/conda.sh" >> ~/.bashrc
dell@AHMADROIHAN-DELL MINGW64 /e/Program-Files/anaconda3/etc/profile.d
$ echo ". '${PWD}'/conda.sh" >> ~/.bashrc

- Set up Git Bash to always run as Administrator

- Click the Windows Start button and type bash.

- Right-click the found link and select Open file location.

- Right-click the menu shortcut and select Properties.

- On the Compatibility tab select Run this program as administrator.

- Reopen Git Bash in other project directory and activate environment 

dell@AHMADROIHAN-DELL MINGW64 /f/PYTHON/gpu
$ conda activate p31013
(p31013)
dell@AHMADROIHAN-DELL MINGW64 /f/PYTHON/gpu
conda install -c conda-forge cudatoolkit cudnn
.................





dell@AHMADROIHAN-DELL MINGW64 /f/PYTHON/gpu
$ pip install "tensorflow<2.11"
.................
dell@AHMADROIHAN-DELL MINGW64 /f/PYTHON/gpu
$ python -c "import tensorflow as tf; print(tf.reduce_sum(tf.random.normal([1000, 1000])))"
2023-12-28 06:46:05.405858: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations:  AVX AVX2
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2023-12-28 06:46:07.065071: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1616] Created device /job:localhost/replica:0/task:0/device:GPU:0 with 1654 MB memory:  -> device: 0, name: NVIDIA GeForce RTX 3050 Laptop GPU, pci bus id: 0000:01:00.0, compute capability: 8.6
tf.Tensor(1.7581177, shape=(), dtype=float32)
(p31013)
dell@AHMADROIHAN-DELL MINGW64 /f/PYTHON/gpu
$ python -c "import tensorflow as tf; print(tf.config.list_physical_devices('GPU'))"
[PhysicalDevice(name='/physical_device:GPU:0', device_type='GPU')]






Tuesday, December 26, 2023

How to Install Torch With Cuda in GPU Windows

How to install Torch With Cuda in GPU Windows

To know previous version of pytorch = https://pytorch.org/get-started/previous-versions/ 

(jupyter) F:\PYTHON\jupyter>pip install torch==2.1.1 torchvision==0.16.1 torchaudio==2.1.1 --index-url https://download.pytorch.org/whl/cu121

Looking in indexes: https://download.pytorch.org/whl/cu121

Collecting torch==2.1.1

  Downloading https://download.pytorch.org/whl/cu121/torch-2.1.1%2Bcu121-cp311-cp311-win_amd64.whl (2473.9 MB)

     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.5/2.5 GB 1.2 MB/s eta 0:00:00

Collecting torchvision==0.16.1

  Downloading https://download.pytorch.org/whl/cu121/torchvision-0.16.1%2Bcu121-cp311-cp311-win_amd64.whl (5.6 MB)

     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 5.6/5.6 MB 2.4 MB/s eta 0:00:00

Collecting torchaudio==2.1.1

  Downloading https://download.pytorch.org/whl/cu121/torchaudio-2.1.1%2Bcu121-cp311-cp311-win_amd64.whl (4.0 MB)

     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.0/4.0 MB 4.4 MB/s eta 0:00:00

Requirement already satisfied: filelock in f:\python\jupyter\lib\site-packages (from torch==2.1.1) (3.13.1)

Requirement already satisfied: typing-extensions in f:\python\jupyter\lib\site-packages (from torch==2.1.1) (4.5.0)

Requirement already satisfied: sympy in f:\python\jupyter\lib\site-packages (from torch==2.1.1) (1.12)

Requirement already satisfied: networkx in f:\python\jupyter\lib\site-packages (from torch==2.1.1) (3.2.1)

Requirement already satisfied: jinja2 in f:\python\jupyter\lib\site-packages (from torch==2.1.1) (3.1.2)

Requirement already satisfied: fsspec in f:\python\jupyter\lib\site-packages (from torch==2.1.1) (2023.12.2)

Requirement already satisfied: numpy in f:\python\jupyter\lib\site-packages (from torchvision==0.16.1) (1.23.5)

Requirement already satisfied: requests in f:\python\jupyter\lib\site-packages (from torchvision==0.16.1) (2.31.0)

Requirement already satisfied: pillow!=8.3.*,>=5.3.0 in f:\python\jupyter\lib\site-packages (from torchvision==0.16.1) (10.1.0)

Requirement already satisfied: MarkupSafe>=2.0 in f:\python\jupyter\lib\site-packages (from jinja2->torch==2.1.1) (2.1.3)

Requirement already satisfied: charset-normalizer<4,>=2 in f:\python\jupyter\lib\site-packages (from requests->torchvision==0.16.1) (3.3.2)

Requirement already satisfied: idna<4,>=2.5 in f:\python\jupyter\lib\site-packages (from requests->torchvision==0.16.1) (3.6)

Requirement already satisfied: urllib3<3,>=1.21.1 in f:\python\jupyter\lib\site-packages (from requests->torchvision==0.16.1) (2.1.0)

Requirement already satisfied: certifi>=2017.4.17 in f:\python\jupyter\lib\site-packages (from requests->torchvision==0.16.1) (2023.11.17)

Requirement already satisfied: mpmath>=0.19 in f:\python\jupyter\lib\site-packages (from sympy->torch==2.1.1) (1.3.0)

Installing collected packages: torch, torchvision, torchaudio

  Attempting uninstall: torch

    Found existing installation: torch 2.1.2

    Uninstalling torch-2.1.2:

      Successfully uninstalled torch-2.1.2

Successfully installed torch-2.1.1+cu121 torchaudio-2.1.1+cu121 torchvision-0.16.1+cu121


(jupyter) F:\PYTHON\jupyter>python -c "import torch; print(torch.rand(2,3).cuda())"

tensor([[0.2774, 0.4768, 0.9545],

        [0.7738, 0.6247, 0.4539]], device='cuda:0')


(jupyter) F:\PYTHON\jupyter>python -c "import torch; print(torch.cuda.device_count())"

1






Saturday, December 23, 2023

How to Install Jupyter Notebook on Windows 11 2024

How to Install Jupyter Notebook on Windows 11 2024

Microsoft Windows [Version 10.0.22621.2861]
(c) Microsoft Corporation. All rights reserved.
C:\Users\dell>F:
F:\>cd PYTHON/jupyter
F:\PYTHON\jupyter>python --version
Python 3.11.3
F:\PYTHON\jupyter>python -m venv ./
F:\PYTHON\jupyter>F:\PYTHON\jupyter\Scripts\activate.bat
(jupyter) F:\PYTHON\jupyter>python -m pip install --upgrade pip
Requirement already satisfied: pip in f:\python\jupyter\lib\site-packages (22.3.1)
Collecting pip
  Downloading pip-23.3.2-py3-none-any.whl (2.1 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.1/2.1 MB 4.5 MB/s eta 0:00:00
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 22.3.1
    Uninstalling pip-22.3.1:
      Successfully uninstalled pip-22.3.1
Successfully installed pip-23.3.2
(jupyter) F:\PYTHON\jupyter>pip install jupyter
Collecting jupyter
  Downloading jupyter-1.0.0-py2.py3-none-any.whl (2.7 kB)
Collecting notebook (from jupyter)
  Downloading notebook-7.0.6-py3-none-any.whl.metadata (10 kB)
Collecting qtconsole (from jupyter)
  Downloading qtconsole-5.5.1-py3-none-any.whl.metadata (5.1 kB)
Collecting jupyter-console (from jupyter)
  Downloading jupyter_console-6.6.3-py3-none-any.whl (24 kB)
Collecting nbconvert (from jupyter)
  Downloading nbconvert-7.13.1-py3-none-any.whl.metadata (7.7 kB)
Collecting ipykernel (from jupyter)
  Downloading ipykernel-6.27.1-py3-none-any.whl.metadata (6.3 kB)
Collecting ipywidgets (from jupyter)
  Downloading ipywidgets-8.1.1-py3-none-any.whl.metadata (2.4 kB)
Collecting comm>=0.1.1 (from ipykernel->jupyter)
  Downloading comm-0.2.0-py3-none-any.whl.metadata (3.7 kB)
Collecting debugpy>=1.6.5 (from ipykernel->jupyter)
  Downloading debugpy-1.8.0-cp311-cp311-win_amd64.whl.metadata (1.1 kB)
Collecting ipython>=7.23.1 (from ipykernel->jupyter)
  Downloading ipython-8.19.0-py3-none-any.whl.metadata (5.9 kB)
Collecting jupyter-client>=6.1.12 (from ipykernel->jupyter)
  Downloading jupyter_client-8.6.0-py3-none-any.whl.metadata (8.3 kB)
Collecting jupyter-core!=5.0.*,>=4.12 (from ipykernel->jupyter)
  Downloading jupyter_core-5.5.1-py3-none-any.whl.metadata (3.4 kB)
Collecting matplotlib-inline>=0.1 (from ipykernel->jupyter)
  Downloading matplotlib_inline-0.1.6-py3-none-any.whl (9.4 kB)
Collecting nest-asyncio (from ipykernel->jupyter)
  Downloading nest_asyncio-1.5.8-py3-none-any.whl.metadata (2.8 kB)
Collecting packaging (from ipykernel->jupyter)
  Downloading packaging-23.2-py3-none-any.whl.metadata (3.2 kB)
Collecting psutil (from ipykernel->jupyter)
  Downloading psutil-5.9.7-cp37-abi3-win_amd64.whl.metadata (22 kB)
Collecting pyzmq>=20 (from ipykernel->jupyter)
  Downloading pyzmq-25.1.2-cp311-cp311-win_amd64.whl.metadata (5.1 kB)
Collecting tornado>=6.1 (from ipykernel->jupyter)
  Downloading tornado-6.4-cp38-abi3-win_amd64.whl.metadata (2.6 kB)
Collecting traitlets>=5.4.0 (from ipykernel->jupyter)
  Downloading traitlets-5.14.0-py3-none-any.whl.metadata (10 kB)
Collecting widgetsnbextension~=4.0.9 (from ipywidgets->jupyter)
  Downloading widgetsnbextension-4.0.9-py3-none-any.whl.metadata (1.6 kB)
Collecting jupyterlab-widgets~=3.0.9 (from ipywidgets->jupyter)
  Downloading jupyterlab_widgets-3.0.9-py3-none-any.whl.metadata (4.1 kB)
Collecting prompt-toolkit>=3.0.30 (from jupyter-console->jupyter)
  Downloading prompt_toolkit-3.0.43-py3-none-any.whl.metadata (6.5 kB)
Collecting pygments (from jupyter-console->jupyter)
  Downloading pygments-2.17.2-py3-none-any.whl.metadata (2.6 kB)
Collecting beautifulsoup4 (from nbconvert->jupyter)
  Downloading beautifulsoup4-4.12.2-py3-none-any.whl (142 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.0/143.0 kB 2.1 MB/s eta 0:00:00
Collecting bleach!=5.0.0 (from nbconvert->jupyter)
  Downloading bleach-6.1.0-py3-none-any.whl.metadata (30 kB)
Collecting defusedxml (from nbconvert->jupyter)
  Downloading defusedxml-0.7.1-py2.py3-none-any.whl (25 kB)
Collecting jinja2>=3.0 (from nbconvert->jupyter)
  Downloading Jinja2-3.1.2-py3-none-any.whl (133 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 133.1/133.1 kB 7.7 MB/s eta 0:00:00
Collecting jupyterlab-pygments (from nbconvert->jupyter)
  Downloading jupyterlab_pygments-0.3.0-py3-none-any.whl.metadata (4.4 kB)
Collecting markupsafe>=2.0 (from nbconvert->jupyter)
  Downloading MarkupSafe-2.1.3-cp311-cp311-win_amd64.whl.metadata (3.1 kB)
Collecting mistune<4,>=2.0.3 (from nbconvert->jupyter)
  Downloading mistune-3.0.2-py3-none-any.whl.metadata (1.7 kB)
Collecting nbclient>=0.5.0 (from nbconvert->jupyter)
  Downloading nbclient-0.9.0-py3-none-any.whl.metadata (7.8 kB)
Collecting nbformat>=5.7 (from nbconvert->jupyter)
  Downloading nbformat-5.9.2-py3-none-any.whl.metadata (3.4 kB)
Collecting pandocfilters>=1.4.1 (from nbconvert->jupyter)
  Downloading pandocfilters-1.5.0-py2.py3-none-any.whl (8.7 kB)
Collecting tinycss2 (from nbconvert->jupyter)
  Downloading tinycss2-1.2.1-py3-none-any.whl (21 kB)
Collecting jupyter-server<3,>=2.4.0 (from notebook->jupyter)
  Downloading jupyter_server-2.12.1-py3-none-any.whl.metadata (8.4 kB)
Collecting jupyterlab-server<3,>=2.22.1 (from notebook->jupyter)
  Downloading jupyterlab_server-2.25.2-py3-none-any.whl.metadata (5.9 kB)
Collecting jupyterlab<5,>=4.0.2 (from notebook->jupyter)
  Downloading jupyterlab-4.0.9-py3-none-any.whl.metadata (15 kB)
Collecting notebook-shim<0.3,>=0.2 (from notebook->jupyter)
  Downloading notebook_shim-0.2.3-py3-none-any.whl (13 kB)
Collecting qtpy>=2.4.0 (from qtconsole->jupyter)
  Downloading QtPy-2.4.1-py3-none-any.whl.metadata (12 kB)
Collecting six>=1.9.0 (from bleach!=5.0.0->nbconvert->jupyter)
  Downloading six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting webencodings (from bleach!=5.0.0->nbconvert->jupyter)
  Downloading webencodings-0.5.1-py2.py3-none-any.whl (11 kB)
Collecting decorator (from ipython>=7.23.1->ipykernel->jupyter)
  Downloading decorator-5.1.1-py3-none-any.whl (9.1 kB)
Collecting jedi>=0.16 (from ipython>=7.23.1->ipykernel->jupyter)
  Downloading jedi-0.19.1-py2.py3-none-any.whl.metadata (22 kB)
Collecting stack-data (from ipython>=7.23.1->ipykernel->jupyter)
  Downloading stack_data-0.6.3-py3-none-any.whl.metadata (18 kB)
Collecting colorama (from ipython>=7.23.1->ipykernel->jupyter)
  Downloading colorama-0.4.6-py2.py3-none-any.whl (25 kB)
Collecting python-dateutil>=2.8.2 (from jupyter-client>=6.1.12->ipykernel->jupyter)
  Downloading python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 247.7/247.7 kB 633.2 kB/s eta 0:00:00
Collecting platformdirs>=2.5 (from jupyter-core!=5.0.*,>=4.12->ipykernel->jupyter)
  Downloading platformdirs-4.1.0-py3-none-any.whl.metadata (11 kB)
Collecting pywin32>=300 (from jupyter-core!=5.0.*,>=4.12->ipykernel->jupyter)
  Downloading pywin32-306-cp311-cp311-win_amd64.whl (9.2 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 9.2/9.2 MB 3.6 MB/s eta 0:00:00
Collecting anyio>=3.1.0 (from jupyter-server<3,>=2.4.0->notebook->jupyter)
  Downloading anyio-4.2.0-py3-none-any.whl.metadata (4.6 kB)
Collecting argon2-cffi (from jupyter-server<3,>=2.4.0->notebook->jupyter)
  Downloading argon2_cffi-23.1.0-py3-none-any.whl.metadata (5.2 kB)
Collecting jupyter-events>=0.9.0 (from jupyter-server<3,>=2.4.0->notebook->jupyter)
  Downloading jupyter_events-0.9.0-py3-none-any.whl.metadata (5.7 kB)
Collecting jupyter-server-terminals (from jupyter-server<3,>=2.4.0->notebook->jupyter)
  Downloading jupyter_server_terminals-0.5.0-py3-none-any.whl.metadata (5.6 kB)
Collecting overrides (from jupyter-server<3,>=2.4.0->notebook->jupyter)
  Downloading overrides-7.4.0-py3-none-any.whl.metadata (5.7 kB)
Collecting prometheus-client (from jupyter-server<3,>=2.4.0->notebook->jupyter)
  Downloading prometheus_client-0.19.0-py3-none-any.whl.metadata (1.8 kB)
Collecting pywinpty (from jupyter-server<3,>=2.4.0->notebook->jupyter)
  Downloading pywinpty-2.0.12-cp311-none-win_amd64.whl.metadata (5.2 kB)
Collecting send2trash>=1.8.2 (from jupyter-server<3,>=2.4.0->notebook->jupyter)
  Downloading Send2Trash-1.8.2-py3-none-any.whl (18 kB)
Collecting terminado>=0.8.3 (from jupyter-server<3,>=2.4.0->notebook->jupyter)
  Downloading terminado-0.18.0-py3-none-any.whl.metadata (5.8 kB)
Collecting websocket-client (from jupyter-server<3,>=2.4.0->notebook->jupyter)
  Downloading websocket_client-1.7.0-py3-none-any.whl.metadata (7.9 kB)
Collecting async-lru>=1.0.0 (from jupyterlab<5,>=4.0.2->notebook->jupyter)
  Downloading async_lru-2.0.4-py3-none-any.whl.metadata (4.5 kB)
Collecting jupyter-lsp>=2.0.0 (from jupyterlab<5,>=4.0.2->notebook->jupyter)
  Downloading jupyter_lsp-2.2.1-py3-none-any.whl.metadata (1.8 kB)
Collecting babel>=2.10 (from jupyterlab-server<3,>=2.22.1->notebook->jupyter)
  Downloading Babel-2.14.0-py3-none-any.whl.metadata (1.6 kB)
Collecting json5>=0.9.0 (from jupyterlab-server<3,>=2.22.1->notebook->jupyter)
  Downloading json5-0.9.14-py2.py3-none-any.whl.metadata (10 kB)
Collecting jsonschema>=4.18.0 (from jupyterlab-server<3,>=2.22.1->notebook->jupyter)
  Downloading jsonschema-4.20.0-py3-none-any.whl.metadata (8.1 kB)
Collecting requests>=2.31 (from jupyterlab-server<3,>=2.22.1->notebook->jupyter)
  Downloading requests-2.31.0-py3-none-any.whl.metadata (4.6 kB)
Collecting fastjsonschema (from nbformat>=5.7->nbconvert->jupyter)
  Downloading fastjsonschema-2.19.0-py3-none-any.whl.metadata (2.0 kB)
Collecting wcwidth (from prompt-toolkit>=3.0.30->jupyter-console->jupyter)
  Downloading wcwidth-0.2.12-py2.py3-none-any.whl.metadata (14 kB)
Collecting soupsieve>1.2 (from beautifulsoup4->nbconvert->jupyter)
  Downloading soupsieve-2.5-py3-none-any.whl.metadata (4.7 kB)
Collecting idna>=2.8 (from anyio>=3.1.0->jupyter-server<3,>=2.4.0->notebook->jupyter)
  Downloading idna-3.6-py3-none-any.whl.metadata (9.9 kB)
Collecting sniffio>=1.1 (from anyio>=3.1.0->jupyter-server<3,>=2.4.0->notebook->jupyter)
  Downloading sniffio-1.3.0-py3-none-any.whl (10 kB)
Collecting parso<0.9.0,>=0.8.3 (from jedi>=0.16->ipython>=7.23.1->ipykernel->jupyter)
  Downloading parso-0.8.3-py2.py3-none-any.whl (100 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100.8/100.8 kB 6.0 MB/s eta 0:00:00
Collecting attrs>=22.2.0 (from jsonschema>=4.18.0->jupyterlab-server<3,>=2.22.1->notebook->jupyter)
  Downloading attrs-23.1.0-py3-none-any.whl (61 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 61.2/61.2 kB 3.2 MB/s eta 0:00:00
Collecting jsonschema-specifications>=2023.03.6 (from jsonschema>=4.18.0->jupyterlab-server<3,>=2.22.1->notebook->jupyter)
  Downloading jsonschema_specifications-2023.11.2-py3-none-any.whl.metadata (3.0 kB)
Collecting referencing>=0.28.4 (from jsonschema>=4.18.0->jupyterlab-server<3,>=2.22.1->notebook->jupyter)
  Downloading referencing-0.32.0-py3-none-any.whl.metadata (2.7 kB)
Collecting rpds-py>=0.7.1 (from jsonschema>=4.18.0->jupyterlab-server<3,>=2.22.1->notebook->jupyter)
  Downloading rpds_py-0.15.2-cp311-none-win_amd64.whl.metadata (4.2 kB)
Collecting python-json-logger>=2.0.4 (from jupyter-events>=0.9.0->jupyter-server<3,>=2.4.0->notebook->jupyter)
  Downloading python_json_logger-2.0.7-py3-none-any.whl (8.1 kB)
Collecting pyyaml>=5.3 (from jupyter-events>=0.9.0->jupyter-server<3,>=2.4.0->notebook->jupyter)
  Downloading PyYAML-6.0.1-cp311-cp311-win_amd64.whl.metadata (2.1 kB)
Collecting rfc3339-validator (from jupyter-events>=0.9.0->jupyter-server<3,>=2.4.0->notebook->jupyter)
  Downloading rfc3339_validator-0.1.4-py2.py3-none-any.whl (3.5 kB)
Collecting rfc3986-validator>=0.1.1 (from jupyter-events>=0.9.0->jupyter-server<3,>=2.4.0->notebook->jupyter)
  Downloading rfc3986_validator-0.1.1-py2.py3-none-any.whl (4.2 kB)
Collecting charset-normalizer<4,>=2 (from requests>=2.31->jupyterlab-server<3,>=2.22.1->notebook->jupyter)
  Downloading charset_normalizer-3.3.2-cp311-cp311-win_amd64.whl.metadata (34 kB)
Collecting urllib3<3,>=1.21.1 (from requests>=2.31->jupyterlab-server<3,>=2.22.1->notebook->jupyter)
  Downloading urllib3-2.1.0-py3-none-any.whl.metadata (6.4 kB)
Collecting certifi>=2017.4.17 (from requests>=2.31->jupyterlab-server<3,>=2.22.1->notebook->jupyter)
  Downloading certifi-2023.11.17-py3-none-any.whl.metadata (2.2 kB)
Collecting argon2-cffi-bindings (from argon2-cffi->jupyter-server<3,>=2.4.0->notebook->jupyter)
  Downloading argon2_cffi_bindings-21.2.0-cp36-abi3-win_amd64.whl (30 kB)
Collecting executing>=1.2.0 (from stack-data->ipython>=7.23.1->ipykernel->jupyter)
  Downloading executing-2.0.1-py2.py3-none-any.whl.metadata (9.0 kB)
Collecting asttokens>=2.1.0 (from stack-data->ipython>=7.23.1->ipykernel->jupyter)
  Downloading asttokens-2.4.1-py2.py3-none-any.whl.metadata (5.2 kB)
Collecting pure-eval (from stack-data->ipython>=7.23.1->ipykernel->jupyter)
  Downloading pure_eval-0.2.2-py3-none-any.whl (11 kB)
Collecting fqdn (from jsonschema[format-nongpl]>=4.18.0->jupyter-events>=0.9.0->jupyter-server<3,>=2.4.0->notebook->jupyter)
  Downloading fqdn-1.5.1-py3-none-any.whl (9.1 kB)
Collecting isoduration (from jsonschema[format-nongpl]>=4.18.0->jupyter-events>=0.9.0->jupyter-server<3,>=2.4.0->notebook->jupyter)
  Downloading isoduration-20.11.0-py3-none-any.whl (11 kB)
Collecting jsonpointer>1.13 (from jsonschema[format-nongpl]>=4.18.0->jupyter-events>=0.9.0->jupyter-server<3,>=2.4.0->notebook->jupyter)
  Downloading jsonpointer-2.4-py2.py3-none-any.whl.metadata (2.5 kB)
Collecting uri-template (from jsonschema[format-nongpl]>=4.18.0->jupyter-events>=0.9.0->jupyter-server<3,>=2.4.0->notebook->jupyter)
  Downloading uri_template-1.3.0-py3-none-any.whl.metadata (8.8 kB)
Collecting webcolors>=1.11 (from jsonschema[format-nongpl]>=4.18.0->jupyter-events>=0.9.0->jupyter-server<3,>=2.4.0->notebook->jupyter)
  Downloading webcolors-1.13-py3-none-any.whl (14 kB)
Collecting cffi>=1.0.1 (from argon2-cffi-bindings->argon2-cffi->jupyter-server<3,>=2.4.0->notebook->jupyter)
  Downloading cffi-1.16.0-cp311-cp311-win_amd64.whl.metadata (1.5 kB)
Collecting pycparser (from cffi>=1.0.1->argon2-cffi-bindings->argon2-cffi->jupyter-server<3,>=2.4.0->notebook->jupyter)
  Downloading pycparser-2.21-py2.py3-none-any.whl (118 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 118.7/118.7 kB 3.5 MB/s eta 0:00:00
Collecting arrow>=0.15.0 (from isoduration->jsonschema[format-nongpl]>=4.18.0->jupyter-events>=0.9.0->jupyter-server<3,>=2.4.0->notebook->jupyter)
  Downloading arrow-1.3.0-py3-none-any.whl.metadata (7.5 kB)
Collecting types-python-dateutil>=2.8.10 (from arrow>=0.15.0->isoduration->jsonschema[format-nongpl]>=4.18.0->jupyter-events>=0.9.0->jupyter-server<3,>=2.4.0->notebook->jupyter)
  Downloading types_python_dateutil-2.8.19.14-py3-none-any.whl.metadata (1.6 kB)
Downloading ipykernel-6.27.1-py3-none-any.whl (114 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 114.6/114.6 kB 6.5 MB/s eta 0:00:00
Downloading ipywidgets-8.1.1-py3-none-any.whl (139 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 139.4/139.4 kB 8.6 MB/s eta 0:00:00
Downloading nbconvert-7.13.1-py3-none-any.whl (256 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 256.6/256.6 kB 5.2 MB/s eta 0:00:00
Downloading notebook-7.0.6-py3-none-any.whl (4.0 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.0/4.0 MB 4.2 MB/s eta 0:00:00
Downloading qtconsole-5.5.1-py3-none-any.whl (123 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 123.4/123.4 kB 7.1 MB/s eta 0:00:00
Downloading bleach-6.1.0-py3-none-any.whl (162 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 162.8/162.8 kB 4.9 MB/s eta 0:00:00
Downloading comm-0.2.0-py3-none-any.whl (7.0 kB)
Downloading debugpy-1.8.0-cp311-cp311-win_amd64.whl (4.9 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.9/4.9 MB 4.0 MB/s eta 0:00:00
Downloading ipython-8.19.0-py3-none-any.whl (808 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 808.9/808.9 kB 3.6 MB/s eta 0:00:00
Downloading jupyter_client-8.6.0-py3-none-any.whl (105 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 105.9/105.9 kB 3.1 MB/s eta 0:00:00
Downloading jupyter_core-5.5.1-py3-none-any.whl (28 kB)
Downloading jupyter_server-2.12.1-py3-none-any.whl (380 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 380.2/380.2 kB 4.7 MB/s eta 0:00:00
Downloading jupyterlab-4.0.9-py3-none-any.whl (9.2 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 9.2/9.2 MB 3.9 MB/s eta 0:00:00
Downloading jupyterlab_server-2.25.2-py3-none-any.whl (58 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 58.9/58.9 kB 3.0 MB/s eta 0:00:00
Downloading jupyterlab_widgets-3.0.9-py3-none-any.whl (214 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 214.9/214.9 kB 4.4 MB/s eta 0:00:00
Downloading MarkupSafe-2.1.3-cp311-cp311-win_amd64.whl (17 kB)
Downloading mistune-3.0.2-py3-none-any.whl (47 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.0/48.0 kB 2.4 MB/s eta 0:00:00
Downloading nbclient-0.9.0-py3-none-any.whl (24 kB)
Downloading nbformat-5.9.2-py3-none-any.whl (77 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 77.6/77.6 kB 4.5 MB/s eta 0:00:00
Downloading packaging-23.2-py3-none-any.whl (53 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 53.0/53.0 kB 2.7 MB/s eta 0:00:00
Downloading prompt_toolkit-3.0.43-py3-none-any.whl (386 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 386.1/386.1 kB 8.0 MB/s eta 0:00:00
Downloading pygments-2.17.2-py3-none-any.whl (1.2 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.2/1.2 MB 4.4 MB/s eta 0:00:00
Downloading pyzmq-25.1.2-cp311-cp311-win_amd64.whl (1.2 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.2/1.2 MB 5.3 MB/s eta 0:00:00
Downloading QtPy-2.4.1-py3-none-any.whl (93 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 93.5/93.5 kB 5.6 MB/s eta 0:00:00
Downloading tornado-6.4-cp38-abi3-win_amd64.whl (436 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 437.0/437.0 kB 5.5 MB/s eta 0:00:00
Downloading traitlets-5.14.0-py3-none-any.whl (85 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 85.2/85.2 kB 4.7 MB/s eta 0:00:00
Downloading widgetsnbextension-4.0.9-py3-none-any.whl (2.3 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.3/2.3 MB 4.2 MB/s eta 0:00:00
Downloading jupyterlab_pygments-0.3.0-py3-none-any.whl (15 kB)
Downloading nest_asyncio-1.5.8-py3-none-any.whl (5.3 kB)
Downloading psutil-5.9.7-cp37-abi3-win_amd64.whl (252 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 252.2/252.2 kB 3.8 MB/s eta 0:00:00
Downloading anyio-4.2.0-py3-none-any.whl (85 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 85.5/85.5 kB 4.7 MB/s eta 0:00:00
Downloading async_lru-2.0.4-py3-none-any.whl (6.1 kB)
Downloading Babel-2.14.0-py3-none-any.whl (11.0 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 11.0/11.0 MB 3.7 MB/s eta 0:00:00
Downloading jedi-0.19.1-py2.py3-none-any.whl (1.6 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.6/1.6 MB 3.7 MB/s eta 0:00:00
Downloading json5-0.9.14-py2.py3-none-any.whl (19 kB)
Downloading jsonschema-4.20.0-py3-none-any.whl (84 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 84.7/84.7 kB 4.7 MB/s eta 0:00:00
Downloading jupyter_events-0.9.0-py3-none-any.whl (18 kB)
Downloading jupyter_lsp-2.2.1-py3-none-any.whl (66 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 66.0/66.0 kB 3.7 MB/s eta 0:00:00
Downloading platformdirs-4.1.0-py3-none-any.whl (17 kB)
Downloading requests-2.31.0-py3-none-any.whl (62 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 62.6/62.6 kB ? eta 0:00:00
Downloading soupsieve-2.5-py3-none-any.whl (36 kB)
Downloading terminado-0.18.0-py3-none-any.whl (14 kB)
Downloading pywinpty-2.0.12-cp311-none-win_amd64.whl (1.4 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.4/1.4 MB 4.5 MB/s eta 0:00:00
Downloading argon2_cffi-23.1.0-py3-none-any.whl (15 kB)
Downloading fastjsonschema-2.19.0-py3-none-any.whl (23 kB)
Downloading jupyter_server_terminals-0.5.0-py3-none-any.whl (13 kB)
Downloading overrides-7.4.0-py3-none-any.whl (17 kB)
Downloading prometheus_client-0.19.0-py3-none-any.whl (54 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 54.2/54.2 kB 2.9 MB/s eta 0:00:00
Downloading stack_data-0.6.3-py3-none-any.whl (24 kB)
Downloading wcwidth-0.2.12-py2.py3-none-any.whl (34 kB)
Downloading websocket_client-1.7.0-py3-none-any.whl (58 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 58.5/58.5 kB 3.0 MB/s eta 0:00:00
Downloading asttokens-2.4.1-py2.py3-none-any.whl (27 kB)
Downloading certifi-2023.11.17-py3-none-any.whl (162 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 162.5/162.5 kB 4.9 MB/s eta 0:00:00
Downloading charset_normalizer-3.3.2-cp311-cp311-win_amd64.whl (99 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 99.9/99.9 kB 5.6 MB/s eta 0:00:00
Downloading executing-2.0.1-py2.py3-none-any.whl (24 kB)
Downloading idna-3.6-py3-none-any.whl (61 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 61.6/61.6 kB 3.2 MB/s eta 0:00:00
Downloading jsonschema_specifications-2023.11.2-py3-none-any.whl (17 kB)
Downloading PyYAML-6.0.1-cp311-cp311-win_amd64.whl (144 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 144.7/144.7 kB 8.4 MB/s eta 0:00:00
Downloading referencing-0.32.0-py3-none-any.whl (26 kB)
Downloading rpds_py-0.15.2-cp311-none-win_amd64.whl (194 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 194.7/194.7 kB 6.0 MB/s eta 0:00:00
Downloading urllib3-2.1.0-py3-none-any.whl (104 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 104.6/104.6 kB 5.9 MB/s eta 0:00:00
Downloading cffi-1.16.0-cp311-cp311-win_amd64.whl (181 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 181.5/181.5 kB 5.4 MB/s eta 0:00:00
Downloading jsonpointer-2.4-py2.py3-none-any.whl (7.8 kB)
Downloading uri_template-1.3.0-py3-none-any.whl (11 kB)
Downloading arrow-1.3.0-py3-none-any.whl (66 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 66.4/66.4 kB ? eta 0:00:00
Downloading types_python_dateutil-2.8.19.14-py3-none-any.whl (9.4 kB)
Installing collected packages: webencodings, wcwidth, types-python-dateutil, pywin32, pure-eval, json5, fastjsonschema, widgetsnbextension, websocket-client, webcolors, urllib3, uri-template, traitlets, tornado, tinycss2, soupsieve, sniffio, six, send2trash, rpds-py, rfc3986-validator, pyzmq, pyyaml, pywinpty, python-json-logger, pygments, pycparser, psutil, prompt-toolkit, prometheus-client, platformdirs, parso, pandocfilters, packaging, overrides, nest-asyncio, mistune, markupsafe, jupyterlab-widgets, jupyterlab-pygments, jsonpointer, idna, fqdn, executing, defusedxml, decorator, debugpy, colorama, charset-normalizer, certifi, babel, attrs, async-lru, terminado, rfc3339-validator, requests, referencing, qtpy, python-dateutil, matplotlib-inline, jupyter-core, jinja2, jedi, comm, cffi, bleach, beautifulsoup4, asttokens, anyio, stack-data, jupyter-server-terminals, jupyter-client, jsonschema-specifications, arrow, argon2-cffi-bindings, jsonschema, isoduration, ipython, argon2-cffi, nbformat, ipywidgets, ipykernel, qtconsole, nbclient, jupyter-events, jupyter-console, nbconvert, jupyter-server, notebook-shim, jupyterlab-server, jupyter-lsp, jupyterlab, notebook, jupyter
Successfully installed anyio-4.2.0 argon2-cffi-23.1.0 argon2-cffi-bindings-21.2.0 arrow-1.3.0 asttokens-2.4.1 async-lru-2.0.4 attrs-23.1.0 babel-2.14.0 beautifulsoup4-4.12.2 bleach-6.1.0 certifi-2023.11.17 cffi-1.16.0 charset-normalizer-3.3.2 colorama-0.4.6 comm-0.2.0 debugpy-1.8.0 decorator-5.1.1 defusedxml-0.7.1 executing-2.0.1 fastjsonschema-2.19.0 fqdn-1.5.1 idna-3.6 ipykernel-6.27.1 ipython-8.19.0 ipywidgets-8.1.1 isoduration-20.11.0 jedi-0.19.1 jinja2-3.1.2 json5-0.9.14 jsonpointer-2.4 jsonschema-4.20.0 jsonschema-specifications-2023.11.2 jupyter-1.0.0 jupyter-client-8.6.0 jupyter-console-6.6.3 jupyter-core-5.5.1 jupyter-events-0.9.0 jupyter-lsp-2.2.1 jupyter-server-2.12.1 jupyter-server-terminals-0.5.0 jupyterlab-4.0.9 jupyterlab-pygments-0.3.0 jupyterlab-server-2.25.2 jupyterlab-widgets-3.0.9 markupsafe-2.1.3 matplotlib-inline-0.1.6 mistune-3.0.2 nbclient-0.9.0 nbconvert-7.13.1 nbformat-5.9.2 nest-asyncio-1.5.8 notebook-7.0.6 notebook-shim-0.2.3 overrides-7.4.0 packaging-23.2 pandocfilters-1.5.0 parso-0.8.3 platformdirs-4.1.0 prometheus-client-0.19.0 prompt-toolkit-3.0.43 psutil-5.9.7 pure-eval-0.2.2 pycparser-2.21 pygments-2.17.2 python-dateutil-2.8.2 python-json-logger-2.0.7 pywin32-306 pywinpty-2.0.12 pyyaml-6.0.1 pyzmq-25.1.2 qtconsole-5.5.1 qtpy-2.4.1 referencing-0.32.0 requests-2.31.0 rfc3339-validator-0.1.4 rfc3986-validator-0.1.1 rpds-py-0.15.2 send2trash-1.8.2 six-1.16.0 sniffio-1.3.0 soupsieve-2.5 stack-data-0.6.3 terminado-0.18.0 tinycss2-1.2.1 tornado-6.4 traitlets-5.14.0 types-python-dateutil-2.8.19.14 uri-template-1.3.0 urllib3-2.1.0 wcwidth-0.2.12 webcolors-1.13 webencodings-0.5.1 websocket-client-1.7.0 widgetsnbextension-4.0.9
(jupyter) F:\PYTHON\jupyter>jupyter notebook
[I 2023-12-24 05:39:29.958 ServerApp] Extension package jupyter_lsp took 0.2852s to import
[W 2023-12-24 05:39:29.958 ServerApp] A `_jupyter_server_extension_points` function was not found in jupyter_lsp. Instead, a `_jupyter_server_extension_paths` function was found and will be used for now. This function name will be deprecated in future releases of Jupyter Server.
[I 2023-12-24 05:39:30.177 ServerApp] Extension package jupyter_server_terminals took 0.2166s to import
[W 2023-12-24 05:39:30.628 ServerApp] A `_jupyter_server_extension_points` function was not found in notebook_shim. Instead, a `_jupyter_server_extension_paths` function was found and will be used for now. This function name will be deprecated in future releases of Jupyter Server.
[I 2023-12-24 05:39:30.628 ServerApp] jupyter_lsp | extension was successfully linked.
[I 2023-12-24 05:39:30.642 ServerApp] jupyter_server_terminals | extension was successfully linked.
[I 2023-12-24 05:39:30.669 ServerApp] jupyterlab | extension was successfully linked.
[I 2023-12-24 05:39:30.689 ServerApp] notebook | extension was successfully linked.
[I 2023-12-24 05:39:30.702 ServerApp] Writing Jupyter server cookie secret to C:\Users\dell\AppData\Roaming\jupyter\runtime\jupyter_cookie_secret
[I 2023-12-24 05:39:31.706 ServerApp] notebook_shim | extension was successfully linked.
[I 2023-12-24 05:39:31.776 ServerApp] notebook_shim | extension was successfully loaded.
[I 2023-12-24 05:39:31.780 ServerApp] jupyter_lsp | extension was successfully loaded.
[I 2023-12-24 05:39:31.784 ServerApp] jupyter_server_terminals | extension was successfully loaded.
[I 2023-12-24 05:39:31.788 LabApp] JupyterLab extension loaded from F:\PYTHON\jupyter\Lib\site-packages\jupyterlab
[I 2023-12-24 05:39:31.788 LabApp] JupyterLab application directory is F:\PYTHON\jupyter\share\jupyter\lab
[I 2023-12-24 05:39:31.792 LabApp] Extension Manager is 'pypi'.
[I 2023-12-24 05:39:31.797 ServerApp] jupyterlab | extension was successfully loaded.
[I 2023-12-24 05:39:31.808 ServerApp] notebook | extension was successfully loaded.
[I 2023-12-24 05:39:31.812 ServerApp] Serving notebooks from local directory: F:\PYTHON\jupyter
[I 2023-12-24 05:39:31.812 ServerApp] Jupyter Server 2.12.1 is running at:
[I 2023-12-24 05:39:31.812 ServerApp] http://localhost:8888/tree?token=f3937ea4392f0bb833dea086303f57fc1551a9ae645c02a8
[I 2023-12-24 05:39:31.812 ServerApp]     http://127.0.0.1:8888/tree?token=f3937ea4392f0bb833dea086303f57fc1551a9ae645c02a8
[I 2023-12-24 05:39:31.812 ServerApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 2023-12-24 05:39:31.962 ServerApp]
    To access the server, open this file in a browser:
        file:///C:/Users/dell/AppData/Roaming/jupyter/runtime/jpserver-17016-open.html
    Or copy and paste one of these URLs:
        http://localhost:8888/tree?token=f3937ea4392f0bb833dea086303f57fc1551a9ae645c02a8
        http://127.0.0.1:8888/tree?token=f3937ea4392f0bb833dea086303f57fc1551a9ae645c02a8
[I 2023-12-24 05:39:32.045 ServerApp] Skipped non-installed server(s): bash-language-server, dockerfile-language-server-nodejs, javascript-typescript-langserver, jedi-language-server, julia-language-server, pyright, python-language-server, python-lsp-server, r-languageserver, sql-language-server, texlab, typescript-language-server, unified-language-server, vscode-css-languageserver-bin, vscode-html-languageserver-bin, vscode-json-languageserver-bin, yaml-language-server
0.00s - Debugger warning: It seems that frozen modules are being used, which may
0.00s - make the debugger miss breakpoints. Please pass -Xfrozen_modules=off
0.00s - to python to disable frozen modules.
0.00s - Note: Debugging will proceed. Set PYDEVD_DISABLE_FILE_VALIDATION=1 to disable this validation.
[I 2023-12-24 05:40:22.529 ServerApp] Creating new notebook in
[I 2023-12-24 05:40:22.670 ServerApp] Writing notebook-signing key to C:\Users\dell\AppData\Roaming\jupyter\notebook_secret
[I 2023-12-24 05:40:36.427 ServerApp] Kernel started: 8613a08b-be38-4888-9cbf-2cd149f0f508
0.00s - Debugger warning: It seems that frozen modules are being used, which may
0.00s - make the debugger miss breakpoints. Please pass -Xfrozen_modules=off
0.00s - to python to disable frozen modules.
0.00s - Note: Debugging will proceed. Set PYDEVD_DISABLE_FILE_VALIDATION=1 to disable this validation.
[I 2023-12-24 05:40:38.047 ServerApp] Connecting to kernel 8613a08b-be38-4888-9cbf-2cd149f0f508.
[I

How to Install Jupyter Notebook on Windows 11 2024

- create env
- pip install jupyter
- start "jupyter notebook"






Monday, December 19, 2022

Setup I2C LCD on Raspberry pi


I2C (inter-integrated circuit) uses two wires to send and receive data and two wires to Vcc and ground.

- install I2C-tools: sudo apt-get install i2c-tools.

- install SMBUS: sudo apt-get install python-smbus.

- reboot.

- connect the I2C LCD to Raspi

- in terminal: i2cdetect -y 1 . This will show a table of addresses for each I2C device connected to Pi.


- put the I2C address of your LCD in line 22 of the library code. For example, my I2C address is 21, so I’ll change line 22 to ADDRESS = 0x3f.

- in terminal: nano I2C_LCD_driver.py

# -*- coding: utf-8 -*-
# Original code found at:
# https://gist.github.com/DenisFromHR/cc863375a6e19dce359d
"""
Compiled, mashed and generally mutilated 2014-2015 by Denis Pleic
Made available under GNU GENERAL PUBLIC LICENSE
# Modified Python I2C library for Raspberry Pi
# as found on http://www.recantha.co.uk/blog/?p=4849
# Joined existing 'i2c_lib.py' and 'lcddriver.py' into a single library
# added bits and pieces from various sources
# By DenisFromHR (Denis Pleic)
# 2015-02-10, ver 0.1
"""
# i2c bus (0 -- original Pi, 1 -- Rev 2 Pi)
I2CBUS = 1
# LCD Address
ADDRESS = 0x3f
import smbus
from time import sleep
class i2c_device:
   def __init__(self, addr, port=I2CBUS):
      self.addr = addr
      self.bus = smbus.SMBus(port)
# Write a single command
   def write_cmd(self, cmd):
      self.bus.write_byte(self.addr, cmd)
      sleep(0.0001)
# Write a command and argument
   def write_cmd_arg(self, cmd, data):
      self.bus.write_byte_data(self.addr, cmd, data)
      sleep(0.0001)
# Write a block of data
   def write_block_data(self, cmd, data):
      self.bus.write_block_data(self.addr, cmd, data)
      sleep(0.0001)
# Read a single byte
   def read(self):
      return self.bus.read_byte(self.addr)
# Read
   def read_data(self, cmd):
      return self.bus.read_byte_data(self.addr, cmd)
# Read a block of data
   def read_block_data(self, cmd):
      return self.bus.read_block_data(self.addr, cmd)

# commands
LCD_CLEARDISPLAY = 0x01
LCD_RETURNHOME = 0x02
LCD_ENTRYMODESET = 0x04
LCD_DISPLAYCONTROL = 0x08
LCD_CURSORSHIFT = 0x10
LCD_FUNCTIONSET = 0x20
LCD_SETCGRAMADDR = 0x40
LCD_SETDDRAMADDR = 0x80
# flags for display entry mode
LCD_ENTRYRIGHT = 0x00
LCD_ENTRYLEFT = 0x02
LCD_ENTRYSHIFTINCREMENT = 0x01
LCD_ENTRYSHIFTDECREMENT = 0x00
# flags for display on/off control
LCD_DISPLAYON = 0x04
LCD_DISPLAYOFF = 0x00
LCD_CURSORON = 0x02
LCD_CURSOROFF = 0x00
LCD_BLINKON = 0x01
LCD_BLINKOFF = 0x00
# flags for display/cursor shift
LCD_DISPLAYMOVE = 0x08
LCD_CURSORMOVE = 0x00
LCD_MOVERIGHT = 0x04
LCD_MOVELEFT = 0x00
# flags for function set
LCD_8BITMODE = 0x10
LCD_4BITMODE = 0x00
LCD_2LINE = 0x08
LCD_1LINE = 0x00
LCD_5x10DOTS = 0x04
LCD_5x8DOTS = 0x00
# flags for backlight control
LCD_BACKLIGHT = 0x08
LCD_NOBACKLIGHT = 0x00
En = 0b00000100 # Enable bit
Rw = 0b00000010 # Read/Write bit
Rs = 0b00000001 # Register select bit
class lcd:
   #initializes objects and lcd
   def __init__(self):
      self.lcd_device = i2c_device(ADDRESS)
      self.lcd_write(0x03)
      self.lcd_write(0x03)
      self.lcd_write(0x03)
      self.lcd_write(0x02)
      self.lcd_write(LCD_FUNCTIONSET | LCD_2LINE | LCD_5x8DOTS | LCD_4BITMODE)
      self.lcd_write(LCD_DISPLAYCONTROL | LCD_DISPLAYON)
      self.lcd_write(LCD_CLEARDISPLAY)
      self.lcd_write(LCD_ENTRYMODESET | LCD_ENTRYLEFT)
      sleep(0.2)

   # clocks EN to latch command
   def lcd_strobe(self, data):
      self.lcd_device.write_cmd(data | En | LCD_BACKLIGHT)
      sleep(.0005)
      self.lcd_device.write_cmd(((data & ~En) | LCD_BACKLIGHT))
      sleep(.0001)
   def lcd_write_four_bits(self, data):
      self.lcd_device.write_cmd(data | LCD_BACKLIGHT)
      self.lcd_strobe(data)
   # write a command to lcd
   def lcd_write(self, cmd, mode=0):
      self.lcd_write_four_bits(mode | (cmd & 0xF0))
      self.lcd_write_four_bits(mode | ((cmd << 4) & 0xF0))
   # write a character to lcd (or character rom) 0x09: backlight | RS=DR<
   # works!
   def lcd_write_char(self, charvalue, mode=1):
      self.lcd_write_four_bits(mode | (charvalue & 0xF0))
      self.lcd_write_four_bits(mode | ((charvalue << 4) & 0xF0))
  
   # put string function with optional char positioning
   def lcd_display_string(self, string, line=1, pos=0):
    if line == 1:
      pos_new = pos
    elif line == 2:
      pos_new = 0x40 + pos
    elif line == 3:
      pos_new = 0x14 + pos
    elif line == 4:
      pos_new = 0x54 + pos
    self.lcd_write(0x80 + pos_new)
    for char in string:
      self.lcd_write(ord(char), Rs)
   # clear lcd and set to home
   def lcd_clear(self):
      self.lcd_write(LCD_CLEARDISPLAY)
      self.lcd_write(LCD_RETURNHOME)
   # define backlight on/off (lcd.backlight(1); off= lcd.backlight(0)
   def backlight(self, state): # for state, 1 = on, 0 = off
      if state == 1:
         self.lcd_device.write_cmd(LCD_BACKLIGHT)
      elif state == 0:
         self.lcd_device.write_cmd(LCD_NOBACKLIGHT)
   # add custom characters (0 - 7)
   def lcd_load_custom_chars(self, fontdata):
      self.lcd_write(0x40);
      for char in fontdata:
         for line in char:
            self.lcd_write_char(line)

- Now, we can test it with hello world, in terminal: nano test.py

import I2C_LCD_driver
mylcd = I2C_LCD_driver.lcd()
mylcd.lcd_display_string("Hello world", 1)

- make sure, you have python installed and between library and python files in one directory.

- run it in terminal: python test.py


Sunday, June 19, 2022

Resolve OPENCV PYTHON Problem for your Environment Project

Several opencv problem and the resolve:

_____

- Problem:

on centos
ImportError: libGL.so.1: cannot open shared object file: No such file or directory

- Resolve: 

yum install mesa-libGL

_____

- Problem:

cannot start Anaconda environment in windows

- Resolve: 

C:\Users\webiot>D:/Anaconda/Scripts/activate

_____

- Problem:

cv2.error: OpenCV(3.4.17) D:\a....\opencv-python\opencv-python\opencv\modules\highgui\src\window.cpp:383: error: (-215:Assertion failed) size.width>0 && size.height>0 in function 'cv::imshow'

- Resolve: 

camera=cv2.VideoCapture(0) #check for input device, maybe 0 or 1 etc.

_____

- Problem:

recognizer = cv2.face.LBPHFaceRecognizer_create(); #create a recognizer, LBPH is a face recognition algorithm.Local Binary Patterns Histograms
AttributeError: module 'cv2' has no attribute 'face'

- Resolve: 

pip uninstall opencv-contrib-python

and install again:

pip install opencv-contrib-python

_____

- Problem:

faces=detector.detectMultiScale(frame,1.1,7)

cv2.error: OpenCV(3.4.17) D:\a\opencv-python\opencv-python\opencv\modules\objdetect\src\cascadedetect.cpp:1729: error: (-215:Assertion failed) !empty() in function 'cv::CascadeClassifier::detectMultiScale'

- Resolve: 

run python as your path in the code

_____

- Problem:

sqlite3.OperationalError: no such column: 

- Resolve: 

check your parameter and add the value with single Quote each.

_____

- Problem:

sqlite3.OperationalError: database is locked

- Resolve: 

close all opened db browser

_____

- Problem:

CvCapture_MSMF::grabFrame videoio(MSMF): can't grab frame. Error: -2147483638

- Resolve: 

downgrade your opencv-python with:

(base) C:\Users\webiot>pip uninstall opencv-python

(base) C:\Users\webiot>pip install opencv-python==3.4.17.63

(base) C:\Users\webiot>pip install opencv-contrib-python==3.4.17.63

_____


ANATHOR PROBLEM IN PYTHON

- Problem:

ModuleNotFoundError: No module named 'mysql.connector'; 'mysql' is not a package

- Resolve: 

if you have install the mysql connector by: pip install mysql-connector-python

You make sure or rename your py file not as mysql.py

_____

- Problem:

Redirect has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header

- Resolve: 

Add this extension on chrome browser:

Allow CORS: Access-Control-Allow-Origin

_____

- Problem:

python flask not reading image from ajax POST request form

- Resolve: 

make sure that params use encodeURIComponent(uri):

ex:

client side

var tes = canvas.toDataURL("image/jpeg");

params = "baseku="+encodeURIComponent(tes);

xmlhttp.send(params);

server side

@app.route('/img', methods=['POST'])

def img():

    if 'baseku' in request.form:

        photo_base64 = request.form['baseku']

        return jsonify(response=photo_base64)

_____



Tuesday, March 2, 2021

How To Setup Raspberry and RFID RC522 With very simple

Setup the RFID RC522 to Raspi like this:

- SDA connects to GPIO8 (Physical Pin 24)

- SCK connects to GPIO11 (Physical Pin 23)

- MOSI connects to GPIO10 (Physical Pin 19)

- MISO connects to GPIO9 (Physical Pin 21)

- GND connects to Breadboard Ground Rail. (20)

- RST connects to GPIO25 (Physical Pin 22)

- 3.3v connects to 3.3v (Physical Pin 1)





Enabled SPI (Interfaces)

pi@pi:~ $ sudo raspi-config

enabled SPI and reboot

pi@pi:~ $ sudo reboot


Test

pi@pi:~ $ lsmod | grep spi

spidev                 20480  0

spi_bcm2835            20480  0


Install

pi@pi:~ $ sudo pip3 install spidev

Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple

Requirement already satisfied: spidev in /usr/lib/python3/dist-packages (3.4)

pi@pi:~ $ sudo pip3 install mfrc522

Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple

Collecting mfrc522

  Downloading https://files.pythonhosted.org/packages/d5/b5/d33c0634cece0931c3c4e0978b0db58f248045c3b379ccf2d512b76fe044/mfrc522-0.0.7-py3-none-any.whl

Requirement already satisfied: RPi.GPIO in /usr/lib/python3/dist-packages (from mfrc522) (0.7.0)

Requirement already satisfied: spidev in /usr/lib/python3/dist-packages (from mfrc522) (3.4)

Installing collected packages: mfrc522

Successfully installed mfrc522-0.0.7


Make Directory and Python file

pi@pi:~ $ mkdir ~/pi-rfid

pi@pi:~ $ nano ~/pi-rfid/read.py

#!/usr/bin/env python
import RPi.GPIO as GPIO

from mfrc522 import SimpleMFRC522



reader = SimpleMFRC522()

try:

        id, text = reader.read()

        print(id)

        print(text)

finally:

        GPIO.cleanup()



Save it and test the file and tap the card

pi@pi:~ $ python3 ~/pi-rfid/read.py

627793730761


pi@pi:~ $ python3 ~/pi-rfid/read.py

658172191773