發表文章

How to use pip3 without sudo privileges

圖片
In my case, there are several python3.x version installed in my system before, and I had to type python3.x and sudo pip3 for developing the code every time, which disturbed me.  Here are the methods I tried to solve this problem. Now I am able to type only the python3 command for the newest python3.8 use and pip3 for installing modules without root privileges. python3.x ... -> python3 ... sudo pip3.x install ... -> pip3 install / python3 -m pip install ...  1. Install pip3 locally under /home/$USER/.local/bin/. $ wget https://bootstrap.pypa.io/get-pip.py $ python3 get-pip.py --user 2. Edit ~/.bashrc $ export PATH=$PATH:~/.local/bin $ export PYTHONPATH=$PYTHONPATH:/usr/lib/python3.8/dist-packages $ source ~/.bashrc 3. Delete redundant pip path or error: ModuleNotFoundError: No module named 'pip._vendor.retrying' will be reported. $ sudo rm -r /usr/lib/python3/dist-packages/pip Check: $ python3 --version * Difference between /usr/local and /usr/.local /usr/...

Installing TensorRT on Ubuntu20.04

圖片
1. Install CUDA, cuDNN CUDA: (1) Remove old version sudo apt-get purge nvidia* sudo apt-get autoremove sudo apt-get autoclean sudo rm -rf /usr/local/cuda* (2) Download and install CUDA toolkit 11.3 [1] $ wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-ubuntu2004.pin $ sudo mv cuda-ubuntu2004.pin /etc/apt/preferences.d/cuda-repository-pin-600 $ wget https://developer.download.nvidia.com/compute/cuda/11.3.0/local_installers/cuda-repo-ubuntu2004-11-3-local_11.3.0-465.19.01-1_amd64.deb $ sudo dpkg -i cuda-repo-ubuntu2004-11-3-local_11.3.0-465.19.01-1_amd64.deb $ sudo apt-key add /var/cuda-repo-ubuntu2004-11-3-local/7fa2af80.pub $ sudo apt-get update $ sudo apt-get -y install cuda (3) Check $ cd /usr/local/cuda-11.3/samples/1_Utilities/deviceQuery $ sudo make $ ./deviceQuery ex: cuDNN: (1) Download cuDNN 8.2.1 [2]  (2) Install extract cudnn-11.3-linux-x64-v8.2.1.32.tgz $ cd cuda $ sudo cp cuda/include/cudnn.h /usr/local/cuda-11.3/include/...

Renaming files in linux at once

Problem description: When you have hundreds of files in the folder, and you want to rename them with the same rule... For example, I have images named img0.jpg, img1.jpg, img2.jpg......, and I expect them named img00000.jpg, img00001.jpg, img00002.jpg.  Commands:  $ rename 's/\d+/sprintf("%05d", $&)/e' *.jpg Reference: https://askubuntu.com/questions/473236/renaming-hundreds-of-files-at-once-for-proper-sorting

Prepare a development environment for executing docker image with GPU support

圖片
1. Install Docker Engine [1] $ sudo apt-get remove docker docker-engine docker.io containerd runc $ sudo apt-get update   $ sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common $ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - $ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" $ sudo apt-get update $ sudo apt-get install docker-ce docker-ce-cli containerd.io 2. Add your account into docker group $ sudo gpasswd -a $USER docker $ sudo reboot 3. Install nvidia-container-runtime [2] $ curl -s -L https://nvidia.github.io/nvidia-container-runtime/gpgkey | sudo apt-key add - $ distribution=$(. /etc/os-release;echo $ID$VERSION_ID) $ curl -s -L https://nvidia.github.io/nvidia-container-runtime/$distribution/nvidia-container-runtime.list | sudo tee /etc/apt/sources.list.d/nvidia-container-runtime.list $ sudo apt update $ sudo apt install nvidia-con...

Install GPU driver and CUDA on the ubuntu system

圖片
 1. Check your GPU driver version https://www.nvidia.com/Download/index.aspx ex: Driver 470 is suitable for my note PC (GS65 Stealth 9SE) 2. Open a new terminal $ ubuntu-drivers devices $ sudo apt install nvidia-driver-470 $ sudo apt install nvidia-cuda-toolkit (--fix-missing) $ reboot 3. Check $ nvidia-smi $ nvcc -V

Hardware upgrade & Setup up dual system for msi GS65 Stealth 9SE

圖片
1. Hardware upgrade Memory:  DDR4-2666(PC4-21300) 16GB×2枚 SSD:  インテル®SSD660Pシリーズ SSDPEKNW010T8X1 Before After 2. Setup up dual system (1) Create a USB disk of Ubuntu  Ubuntu image:  https://ubuntu.com/download/desktop Rufus:  https://rufus.ie/zh_TW/ 資料分割配置: GPT 目標系統: UEFI 檔案系統: NTFS  (2) Modify computer configuration and insert the USB Hard Disk, then reboot Fast Startup: Disable Fast Boot: Disable, Boot option: USB Hard Disk Secure Boot: Disable (3) Follow the instruction to install the ubuntu system swap: 48GB ( swap setting ), Logical, Beginning of this space /: the rest of the whole free space, Primary , Beginning of this space, Ext4 *Remember to select the correct bootloader device (4) Use cmd windows to enable grub boot menu ( Run as administrator!!! ) $ bcdedit /set {bootmgr} path \EFI\ubuntu\grubx64.efi Reference: [1]  https://www.cnblogs.com/klchang/p/14322667.html [2]  https://www.youtube.com/watch?v=hT4m71ghD6A [3]  https://ww...

Change docker image storage location to SSD on your NVIDIA Xavier

圖片
1. Install a SSD on the device and give it a mount name [1] 2. Copy docker to the SSD mount folder and add "data-root" parameter in the daemon script. [2] $ sudo service docker stop $ sudo rsync -aP /var/lib/docker/ /path/to/your/docker $ gedit /etc/docker/daemon.json $ sudo mv /var/lib/docker /var/lib/docker.old $ sudo service docker start 3. Pull PyTorch container and run [3] $ docker pull nvcr.io/nvidia/l4t-pytorch:r32.6.1-pth1.9-py3 $ sudo docker run -it --rm --runtime nvidia --network host -v /home/user/project:/location/in/container nvcr.io/nvidia/l4t-pytorch:r32.6.1-pth1.9-py3 Another useful commands:  $ sudo docker info $ sudo docker images $ sudo rmi REPOSITORY:TAG [4] $ cat /etc/nv_tegra_release $ systemctl start docker Reference: [1]  Install Solid State Disk - Jetson AGX Xavier   [2]  https://forums.developer.nvidia.com/t/change-docker-image-storage-location-to-nvme-ssd/156882 [3]  docker pull nvcr.io/nvidia/l4t-pytorch:r32.6.1-pt...