# Python Server Build Log ### 建置環境 1.清空資料 ```bash= cd /usr/share/keyrings/ sudo rm -rf /usr/lib/nvidia/ sudo apt-get --purge remove "*cublas*" "*cuda*" "nsight*" "*nvidia*" sudo apt autoremove sudo apt autoclean sudo apt-get install build-essential linux-headers-$(uname -r) ``` 2.安裝nvidia driver ```bash= sudo apt-get update #Go to https://www.nvidia.com/Download/index.aspx?lang=en-us sudo bash NVIDIA-Linux-x86_64-550.67.run # sudo apt install nvidia-detect # sudo apt install nvidia-driver ``` 3.安裝cuda ```bash= #https://developer.nvidia.com/cuda-downloads wget https://developer.download.nvidia.com/compute/cuda/11.7.1/local_installers/cuda-repo-debian11-11-7-local_11.7.1-515.65.01-1_amd64.deb sudo dpkg -i cuda-repo-debian11-11-7-local_11.7.1-515.65.01-1_amd64.deb sudo cp /var/cuda-repo-debian11-11-7-local/cuda-*-keyring.gpg /usr/share/keyrings/ sudo add-apt-repository contrib sudo apt-get update sudo apt-get -y install cuda nvidia-smi ``` 4.安裝cudnn ```bash= #https://developer.nvidia.com/rdp/cudnn-download sudo tar -xzvf cudnn-11.3-linux-x64-v8.2.1.32.tgz sudo cp cuda/include/cudnn.h /usr/local/cuda/include sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64 sudo chmod a+r /usr/local/cuda/include/cudnn.h /usr/local/cuda/lib64/libcudnn* ``` 5.安裝miniconda ```bash= $wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh $bash conda create -n myDL python=3.10 pip conda activate myDL ``` 6.安裝PyTorch ```bash= conda install pytorch torchvision torchaudio cudatoolkit=11.7 -c pytorch -c conda-forge ``` 7.其他指令 ```bash= pip3 install -U d2l jupyter sudo apt install nvidia-driver firmware-misc-nonfree 檢驗版本 dpkg -l | grep -i nvidia ``` 8.遠端Jupyter ```bash= https://stackoverflow.com/questions/42848130/why-i-cant-access-remote-jupyter-notebook-server jupyter notebook --no-browser & disown ``` 10.故障排除 ```bash= perl 語言錯誤 sudo apt-get update && sudo apt-get install locales sudo dpkg-reconfigure locales header搜尋 ls /usr/src/linux-6.1.0-headers sudo apt list linux-headers-$(uname -r) sudo apt install linux-headers-amd64 #sudo apt install kernel-headers-$(uname -r) sudo apt install build-essential sudo dpkg --configure -a sudo dkms install -m nvidia-current -v 535.104.05 sudo apt-get install multipath-tools ``` 11.Stable Diffusion ```bash= mkdir StableDiff cd StableDiff # 程式框架部分 git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git # 下載權重檔 wget https://huggingface.co/runwayml/stable-diffusion-v1-5/resolve/main/v1-5-pruned-emaonly.ckpt mv v1-5-pruned-emaonly.ckpt stable-diffusion-webui/models/Stable-diffusion/ # 執行 ./webui.sh --xformers --share ``` ### 參考資料 ```= https://docs.conda.io/en/latest/miniconda.html https://developer.nvidia.com/cuda-downloads https://developer.nvidia.com/rdp/cudnn-download https://pytorch.org/get-started/locally/ https://docs.nvidia.com/deploy/cuda-compatibility/index.html https://www.datacamp.com/tutorial/how-to-run-stable-diffusion ``` 
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up