ubuntu环境配置备忘

123zdq / 2024-07-11 / 原文

2024.7.10

目标:熟悉ubuntu环境

环境需求:ubuntu20.04+CUDA

  • done:在搭载亮机卡的机器上用移动硬盘实验,试验了环境部署

  • to do:在有显卡的机器上再部署一次环境,复现实验

  • ubuntu 20.04

配置环境变量
sudo gedit ~/.bashrc
立即生效
source ~/.bashrc

更新软件列表(用apt安装软件前都要做)
sudo apt-get update

双系统时间同步
sudo apt install ntpdate
sudo ntpdate time.windows.com
sudo hwclock --localtime --systohc

gcc安装
sudo apt install gcc
gcc --version

.deb文件(安装包)使用命令 技巧:使用 前几个字符*.deb 来描述包名
sudo dpkg -i

输入法安装
https://shurufa.sogou.com/linux
https://shurufa.sogou.com/linux/guide

实现右键新建文本文档:在主目录/模板 里面新建一个空的txt(touch命令,或者复制一个txt过来然后清空)

Vscode编辑器安装:https://code.visualstudio.com/Download#
文件用Vscode启动命令:(不加sudo)
code

.sh文件(安装脚本)使用命令
sudo bash

miniconda(跳到详细的版本页面,安装具体的版本,安装完后用 conda --version 检查安装结果和环境变量)
https://docs.anaconda.com/miniconda/miniconda-other-installer-links/

pip换源
pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/
阿里云: https://mirrors.aliyun.com/pypi/simple/
豆瓣: https://pypi.douban.com/simple/
清华大学: https://pypi.tuna.tsinghua.edu.cn/simple/
中国科学技术大学: https://pypi.mirrors.ustc.edu.cn/simple/

nvidia显卡计算环境
官网驱动查看(可选)
https://www.nvidia.cn/geforce/drivers/
https://developer.nvidia.com/cuda-downloads
https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html
https://www.zhihu.com/tardis/bd/art/654549597
驱动安装:和官网下载的CUDA.run包一并安装的(nvidia-fs无需安装,似乎是和容器相关的功能)
https://blog.csdn.net/m0_37605642/article/details/120101966
https://www.cnblogs.com/booturbo/p/13960935.html
https://blog.csdn.net/m0_37605642/article/details/119637836

  • legged_gym 配置备忘

测试安装是否成功

cd examples && python 1080_balls_of_solitude.py
此时出现报错:
[Error] [carb] [Plugin: libcarb.gym.plugin.so] Could not load the dynamic library from /home/zdq/桌面/legged_gym/isaacgym/python/isaacgym/_bindings/linux-x86_64/libcarb.gym.plugin.so. Error: libcuda.so.1: cannot open shared object file: No such file or directory
推测是CUDA环境没有配好,一会儿重配,目前解决方案https://blog.csdn.net/sinat_30440627/article/details/122047482
重启后已解决

Python环境:
follow飞书上步骤
降级numpy版本
pip install tensorboard

legged_gym出现运行时段错误,中间报错GPU显存分配失败(PxgCudaDeviceMemoryAllocator fail to allocate memory 67108864 bytes!! Result = 2),推测是驱动没有安装好,准备重装