安装ubuntu20.04, CUDA11.4, cnDNN, tensorflow, pytorch

ubuntu22.04默认python为3.11

ubuntu20.04默认python为3.8

第一步,分区安装系统

efi引导区, 逻辑分区,512M

root: 主分区,512M

swap: 逻辑分区,64G

home:逻辑分区,320G

/:逻辑分区, 130G, CUDA是安装这个路径下的 

##在进行下一步之前要选择boot loader的安装位置,该位置必须设置为efi分区

但不知道为什么,几次用后,发现home目录未绑上,导致主分区空间不够。

重新绑定:

先用sudo fdisk -l  和  sudo blkid 命令结合起来找出盘符

vi /etc/gtab下增加:

重启,即可,、

注意:如果输入错误,会无法进入桌面,只能用linux系统盘重新进入修改

第二步,设置软件源

ubuntu更新源:菜单->software&updates->ubuntu software, 这里选择Download from : 中国区

                         或者 sudo gredit /etc/apt/sources.list 里添加源

第三步,安装CUDA

1.英伟达官网下载,下载的是cuda11.6版本,无法安装成功

2.卸载显卡驱动,

sudo apt-get --purge remove nvidia*

sudo apt autoremove

还是无法安装成功;

3.下载cuda提示的显卡驱动版本,安装显卡驱动,提示是因为:

ERROR: The Nouveau kernel driver is currently in use by your system

打开terminal, 修改/etc/modprobe.d/blacklist.conf文件,增加:

blacklist nouveau

options nouveau modeset=0

保存重启,就可以安装成功了。

4.安装cuda,一次成功

5.增加环境变量:

sudo gedit ~./bashrc

export PATH=...:$PATH

export LD_LIBRARY_PATH=...:$LD_LIBRARY_PATH

第四步,安装cuDNN

官网下载deb版本,直接sudo apt install XXXXXX即可

第五步,安装tensorflow

第六步,安装pytorch

自编译tensorflow: 1.python3.5,tensorflow1.12; 2.支持cuda10.0,cudnn7.3.1,TensorRT-5.0.2.6-cuda10.0-cudnn7.3; 3.无mkl支持; 软硬件硬件环境:Ubuntu16.04,GeForce GTX 1080 TI 配置信息: hp@dla:~/work/ts_compile/tensorflow$ ./configure WARNING: --batch mode is deprecated. Please instead explicitly shut down your Bazel server using the command "bazel shutdown". You have bazel 0.19.1 installed. Please specify the location of python. [Default is /usr/bin/python]: /usr/bin/python3 Found possible Python library paths: /usr/local/lib/python3.5/dist-packages /usr/lib/python3/dist-packages Please input the desired Python library path to use. Default is [/usr/local/lib/python3.5/dist-packages] Do you wish to build TensorFlow with XLA JIT support? [Y/n]: XLA JIT support will be enabled for TensorFlow. Do you wish to build TensorFlow with OpenCL SYCL support? [y/N]: No OpenCL SYCL support will be enabled for TensorFlow. Do you wish to build TensorFlow with ROCm support? [y/N]: No ROCm support will be enabled for TensorFlow. Do you wish to build TensorFlow with CUDA support? [y/N]: y CUDA support will be enabled for TensorFlow. Please specify the CUDA SDK version you want to use. [Leave empty to default to CUDA 10.0]: Please specify the location where CUDA 10.0 toolkit is installed. Refer to README.md for more details. [Default is /usr/local/cuda]: /usr/local/cuda-10.0 Please specify the cuDNN version you want to use. [Leave empty to default to cuDNN 7]: 7.3.1 Please specify the location where cuDNN 7 library is installed. Refer to README.md for more details. [Default is /usr/local/cuda-10.0]: Do you wish to build TensorFlow with TensorRT support? [y/N]: y TensorRT support will be enabled for TensorFlow. Please specify the location where TensorRT is installed. [Default is /usr/lib/x86_64-linux-gnu]://home/hp/bin/TensorRT-5.0.2.6-cuda10.0-cudnn7.3/targets/x86_64-linux-gnu Please specify the locally installed NCCL version you want to use. [Default is to use https://github.com/nvidia/nccl]: Please specify a list of comma-separated Cuda compute capabilities you want to build with. You can find the compute capability of your device at: https://developer.nvidia.com/cuda-gpus. Please note that each additional compute capability significantly increases your build time and binary size. [Default is: 6.1,6.1,6.1]: Do you want to use clang as CUDA compiler? [y/N]: nvcc will be used as CUDA compiler. Please specify which gcc should be used by nvcc as the host compiler. [Default is /usr/bin/gcc]: Do you wish to build TensorFlow with MPI support? [y/N]: No MPI support will be enabled for TensorFlow. Please specify optimization flags to use during compilation when bazel option "--config=opt" is specified [Default is -march=native -Wno-sign-compare]: Would you like to interactively configure ./WORKSPACE for Android builds? [y/N]: Not configuring the WORKSPACE for Android builds. Preconfigured Bazel build configs. You can use any of the below by adding "--config=" to your build command. See .bazelrc for more details. --config=mkl # Build with MKL support. --config=monolithic # Config for mostly static monolithic build. --config=gdr # Build with GDR support. --config=verbs # Build with libverbs support. --config=ngraph # Build with Intel nGraph support. --config=dynamic_kernels # (Experimental) Build kernels into separate shared objects. Preconfigured Bazel build configs to DISABLE default on features: --config=noaws # Disable AWS S3 filesystem support. --config=nogcp # Disable GCP support. --config=nohdfs # Disable HDFS support. --config=noignite # Disable Apacha Ignite support. --config=nokafka # Disable Apache Kafka support. --config=nonccl # Disable NVIDIA NCCL support. Configuration finished 编译: bazel build --config=opt --verbose_failures //tensorflow/tools/pip_package:build_pip_package 卸载已有tensorflow: hp@dla:~/temp$ sudo pip3 uninstall tensorflow 安装自己编译的成果: hp@dla:~/temp$ sudo pip3 install tensorflow-1.12.0-cp35-cp35m-linux_x86_64.whl
<think>好的,我现在需要帮助用户在Ubuntu 20.04安装Xinference。首先,我需要了解Xinference是什么,以及它的安装要求。根据用户提供的引用内容,他们之前安装Ubuntu 22.04,但这次是20.04,所以需要注意版本差异。同时,引用[3]提到Ubuntu20.04配置了NVIDIA驱动、Cuda 11.4Python3.10和PyTorch1.11.0,这可能与Xinference的依赖有关。 首先,Xinference可能是一个需要Python环境、CUDA支持的机器学习或推理框架。我需要确认它的官方安装步骤。通常,Python包的安装可以通过pip进行,但可能需要先安装系统依赖项。例如,用户之前安装NVIDIA驱动时遇到了32位库的问题,但引用[2]提到可以忽略,所以可能不需要处理这些。 接下来,我需要检查用户的环境是否满足条件。Ubuntu 20.04默认的Python版本是3.8,但用户引用[3]中使用了Python3.10,所以可能需要用户升级Python或使用虚拟环境。此外,CUDA 11.4PyTorch的版本也需要与Xinference兼容。 可能的步骤包括: 1. 安装系统依赖,如Python开发工具和必要的库。 2. 创建Python虚拟环境以避免版本冲突。 3. 安装PyTorch,根据CUDA版本选择合适的命令。 4. 使用pip安装Xinference。 5. 处理可能的权限问题或依赖缺失。 需要注意用户之前安装NVIDIA驱动时的提示,比如忽略x server的检查,所以在安装过程中可能需要类似的参数,但Xinference本身可能不需要图形界面。此外,确保用户已经正确安装了NVIDIA驱动和CUDA,因为Xinference可能需要GPU支持。 最后,生成相关问题,帮助用户解决可能遇到的后续问题,比如环境配置、依赖冲突等。</think>在Ubuntu 20.04安装Xinference的步骤如下: ### 1. 安装系统依赖 ```bash sudo apt update sudo apt install -y python3.10 python3.10-venv python3-pip build-essential ``` 若需GPU支持,请确保已安装NVIDIA驱动和CUDA 11.4[^3]。 ### 2. 创建虚拟环境 ```bash python3.10 -m venv xinference-env source xinference-env/bin/activate ``` ### 3. 安装PyTorch 根据CUDA版本选择对应命令: ```bash pip3 install torch==1.11.0+cu113 --extra-index-url https://download.pytorch.org/whl/cu113 ``` ### 4. 安装Xinference ```bash pip install xinference ``` ### 5. 启动服务 ```bash xinference-local --host 0.0.0.0 --port 9997 ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值