Skip to content

Cevheri-Software/verbose-guacamole

Repository files navigation

´´´ sudo docker start -ai 4499772f8cab pip install tqdm pip3 install --no-cache-dir ultralytics --no-deps # Install ultralytics without pulling its own dependencies

´´´

bu docker container indirdim , sudo docker pull nvcr.io/nvidia/l4t-ml:r35.2.1-py3

...... kodlar da çaliştridim

.. jett.py yukle

..su kod containernin içinde çaliştrimak isterim nasıl yaparım,

https://drive.google.com/file/d/1JbwLyqpFCXmftaJY1oap8Sa6KfjoWJta/view?usp=sharing

Step 1: Find the NVIDIA OpenCV Installation

# Find where NVIDIA OpenCV is installed
find /usr -name "*opencv*" -type d 2>/dev/null
find /opt -name "*opencv*" -type d 2>/dev/null

# Check common NVIDIA locations
ls -la /usr/lib/aarch64-linux-gnu/ | grep opencv
ls -la /usr/local/lib/ | grep opencv
ls -la /opt/nvidia/ 2>/dev/null

Step 2: Check Python Path

# See current Python path
python3 -c "import sys; print('\n'.join(sys.path))"

# Check if OpenCV is importable
python3 -c "import cv2; print(cv2.__file__)"

Step 3: Add OpenCV to Python Path

If OpenCV is installed but not in Python path, add it:

# Find the OpenCV Python bindings
find /usr -name "cv2*.so" 2>/dev/null

# Typical locations for NVIDIA OpenCV on Jetson:
ls -la /usr/lib/python3/dist-packages/ | grep cv2
ls -la /usr/local/lib/python3.*/dist-packages/ | grep cv2

Step 4: Create Symbolic Links (if needed)

If OpenCV is installed but not linked properly:

# Find the OpenCV installation
OPENCV_PATH=$(find /usr -name "cv2*.so" 2>/dev/null | head -1)
echo "Found OpenCV at: $OPENCV_PATH"

# Create symbolic link in Python site-packages
python3 -c "import site; print(site.getsitepackages())"

# Create the link (adjust path as needed)
sudo ln -sf $OPENCV_PATH /usr/local/lib/python3.8/dist-packages/

Step 5: Set Environment Variables

Add to your ~/.bashrc:

echo 'export PYTHONPATH=/usr/lib/python3/dist-packages:$PYTHONPATH' >> ~/.bashrc
echo 'export LD_LIBRARY_PATH=/usr/lib/aarch64-linux-gnu:$LD_LIBRARY_PATH' >> ~/.bashrc
source ~/.bashrc

Step 6: Alternative - Reinstall with Proper Python Integration

# Remove and reinstall with Python integration
sudo apt remove python3-opencv
sudo apt install python3-opencv python3-opencv-contrib

Step 7: Check Package Contents

# See what files nvidia-opencv installed
dpkg -L nvidia-opencv

# Check if Python bindings are included
dpkg -L python3-opencv 2>/dev/null || echo "python3-opencv not installed"

Step 8: Manual Python Setup

If OpenCV libraries exist but Python can’t find them:

# Create a .pth file to add the path
echo "/usr/lib/python3/dist-packages" | sudo tee /usr/local/lib/python3.8/dist-packages/opencv.pth

# Or set PYTHONPATH temporarily
export PYTHONPATH=/usr/lib/python3/dist-packages:$PYTHONPATH
python3 -c "import cv2; print('Success!')"

Step 9: Verify Final Installation

python3 -c "
import cv2
print('OpenCV version:', cv2.__version__)
print('OpenCV location:', cv2.__file__)
build_info = cv2.getBuildInformation()
print('CUDA support:', 'CUDA: YES' in build_info)
"

Step 1: Verify OpenCV Installation

Check if OpenCV is actually installed and working:

# Check Python OpenCV
python3 -c "import cv2; print(cv2.__version__); print(cv2.getBuildInformation())"

# Check system OpenCV libraries
pkg-config --modversion opencv4
# or
pkg-config --modversion opencv

# Check installed packages
dpkg -l | grep opencv

Step 2: Check Library Paths

# Find OpenCV libraries
find /usr -name "*opencv*" -type f 2>/dev/null | head -10

# Check library paths
ldconfig -p | grep opencv

Step 3: Reinstall with Proper Dependencies

The issue might be missing dependencies. Try this approach:

# Clean up completely
sudo apt purge *opencv* *libopencv*
sudo apt autoremove
sudo apt autoclean

# Install dependencies first
sudo apt update
sudo apt install python3-dev python3-numpy
sudo apt install libgtk-3-dev
sudo apt install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev

# Install OpenCV with all components
sudo apt install python3-opencv
sudo apt install libopencv-dev libopencv-contrib-dev
sudo apt install opencv-data

# Verify installation
python3 -c "import cv2; print('OpenCV version:', cv2.__version__)"

Step 4: Alternative - Install from JetPack Components

If you have JetPack SDK Manager access:

# Check available JetPack components
sudo apt list --installed | grep jetpack

# Install OpenCV from JetPack
sudo apt install jetpack-sdk

Step 5: Force jtop to Refresh

Sometimes jtop caches information:

# Stop jtop service if running
sudo systemctl stop jtop

# Clear any cached data
sudo rm -rf ~/.jtop/

# Restart jtop
sudo jtop

Step 6: Manual OpenCV Build (If needed)

If the packages still don’t work, here’s a minimal build:

# Install build dependencies
sudo apt install build-essential cmake git
sudo apt install python3-dev python3-numpy

# Download and build
cd ~
git clone https://github.com/opencv/opencv.git
cd opencv
git checkout 4.5.4  # Match your previous version
mkdir build && cd build

# Minimal build with CUDA
cmake -D CMAKE_BUILD_TYPE=RELEASE \
    -D CMAKE_INSTALL_PREFIX=/usr/local \
    -D WITH_CUDA=ON \
    -D CUDA_ARCH_BIN=7.2 \
    -D BUILD_TESTS=OFF \
    -D BUILD_EXAMPLES=OFF \
    -D PYTHON3_EXECUTABLE=/usr/bin/python3 \
    ..

make -j4
sudo make install
sudo ldconfig

Step 7: Check What jtop Expects

# Check jtop source or config to see what it's looking for
python3 -c "
import cv2
print('OpenCV found at:', cv2.__file__)
print('Version:', cv2.__version__)
print('Build info available:', 'CUDA' in cv2.getBuildInformation())
"

Try these steps in order. The most likely issue is that jtop is looking for OpenCV in a specific location or the installation didn’t complete properly. Let me know what the verification commands show and I can help troubleshoot further.​​​​​​​​​​​​​​​​

Option 1: Use Pre-built OpenCV with CUDA (Recommended)

Install a pre-built version with CUDA support:

# Remove current OpenCV
sudo apt purge *libopencv*

# Install OpenCV with CUDA support
sudo apt update
sudo apt install python3-opencv opencv-data libopencv-dev libopencv-contrib-dev

# Or try the NVIDIA-specific build
sudo apt install nvidia-opencv

Solution 1: Add CUDA to your PATH

The CUDA toolkit is installed but not in your system PATH. Add these lines to your ~/.bashrc file:

echo 'export PATH=/usr/local/cuda/bin:$PATH' >> ~/.bashrc
echo 'export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH' >> ~/.bashrc
source ~/.bashrc

for algorithm

  • File to modify: /home/cevheri/cevheri_algo/env/lib/python3.10/site-packages/ultralytics/nn/tasks.py
  • Line to change: Around line 511 in the torch_safe_load function Change this line:
return torch.load(file, map_location='cpu'), file  # load
return torch.load(file, map_location='cpu', weights_only=False), file  # load

for jetson

Jetson cihazlarda normal PC'lerde olduğu gibi pip ile PyTorch kuramamanızın birkaç temel nedeni var:

Mimari Farklılıklar

ARM64 vs x86_64: Jetson cihazları ARM64 işlemci kullanırken, çoğu PC x86_64 kullanır. PyPI'daki PyTorch'un önceden derlenmiş wheel'leri x86_64 mimarisi için yapılmıştır ve ARM64'te çalışmaz.

CUDA Sürüm Uyumluluğu: Jetson cihazları belirli CUDA sürümleri ile JetPack çalıştırır ve bu sürümler standart PyTorch wheel'lerinin derlendiği CUDA sürümleri ile eşleşmeyebilir.

Çözümler

1. NVIDIA'nın Önceden Hazırlanmış Wheel'lerini Kullanın

NVIDIA, Jetson için özel PyTorch wheel'leri sağlar:

# JetPack 4.6+ için
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118

# Veya NVIDIA'nın doğrudan wheel'lerini kullanın
wget https://nvidia.box.com/shared/static/[belirli-wheel-linki].whl
pip3 install [indirilen-wheel].whl

2. Jetson Container'larını Kullanın

NVIDIA PyTorch ile önceden hazırlanmış Docker container'ları sağlar:

sudo docker run -it --rm --runtime nvidia --network host nvcr.io/nvidia/l4t-pytorch:r35.2.1-pth2.0-py3

3. Kaynak Koddan Derleyin

Bu birkaç saat sürer ama size en fazla kontrolü verir:

git clone --recursive https://github.com/pytorch/pytorch
cd pytorch
export USE_CUDA=1
export USE_CUDNN=1
python3 setup.py install

4. JetPack SDK Manager'ı Kullanın

En kolay yaklaşım - JetPack genellikle AI/ML paketlerinde PyTorch'u içerir.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •