1.1 conda install gym[all]
出现错误:
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
PackagesNotFoundError: The following packages are not available from current channels:
- gym
Current channels:
- https://mirrors.aliyun.com/anaconda/cloud/bioconda/linux-64
- https://mirrors.aliyun.com/anaconda/cloud/bioconda/noarch
- https://mirrors.aliyun.com/anaconda/cloud/conda-forge/linux-64
- https://mirrors.aliyun.com/anaconda/cloud/conda-forge/noarch
- https://mirrors.aliyun.com/ananconda/pkgs/main/linux-64
- https://mirrors.aliyun.com/ananconda/pkgs/main/noarch
- https://mirrors.ustc.edu.cn/anaconda/pkgs/free/linux-64
- https://mirrors.ustc.edu.cn/anaconda/pkgs/free/noarch
- http://mirrors.aliyun.com/pypi/simple/linux-64
- http://mirrors.aliyun.com/pypi/simple/noarch
- http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/linux-64
- http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/noarch
- http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/linux-64
- http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/noarch
- http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r/linux-64
- http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r/noarch
- http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/pro/linux-64
- http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/pro/noarch
- http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2/linux-64
- http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2/noarch
To search for alternate channels that may provide the conda package you're
looking for, navigate to
https://anaconda.org
and use the search bar at the top of the page.
之前只有清华源,后来加了阿里云和中科大,同样还是找不到gym包
1.2 直接从anaconda下载
https://blog.csdn.net/weixin_45552562/article/details/109668589
该文章提出三种解决方法:
第二种:conda install -c conda-forge gym-all
得到同样的错误
第三种直接从anaconda下载,再进行安装,根据环境(linux-64, python=3.8.3)选择安装包
测试gym
conda list
import gym
env = gym.make('CartPole-v1')
for i_episode in range(20):
observation = env.reset()
for t in range(100):
env.render()
print(observation)
action = env.action_space.sample()
observation, reward, done, info = env.step(action)
if done:
print("Episode finished after {} timesteps".format(t+1))
break
出现错误:
Traceback (most recent call last):
File "test.py", line 2, in <module>
env = gym.make('CartPole-v1')
AttributeError: module 'gym' has no attribute 'make'
1.3 AttributeError: module ‘gym’ has no attribute ‘make’
这是因为我把git下载的Gym文件夹和test.py放一个目录下,当我移除gym文件夹后,gym模块便不存在了
(zhu_pytorch) [new402@~]$python zhu_xw/test.py
Traceback (most recent call last):
File "zhu_xw/test.py", line 1, in <module>
import gym
ModuleNotFoundError: No module named 'gym'
2. pip install gym[all]
ERROR: Could not find a version that satisfies the requirement gym[all] (from versions: none)
ERROR: No matching distribution found for gym[all]
https://www.codeprj.com/blog/d5cf301.html
该文章提出了将Git下载的gym文件夹复制到linux中再安装
git clone https://github.com/openai/gym.git
#进入 gym 文件夹:
cd gym
pip install -e .[all]
出现错误
ERROR: Command errored out with exit status 1:
command: /home/new402/anaconda3/envs/zhu_pytorch/bin/python /home/new402/anaconda3/envs/zhu_pytorch/lib/python3.8/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-vx48f_zn/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i 'https://pypi.tuna.tsinghua.edu.cn/simple/' --trusted-host pypi.douban.com -- 'setuptools>=40.8.0' wheel
cwd: None
简中并没有解决这个问题的帖子,类似问题的解决方法也解决不了。
2.1 安装依赖项
参考文章:https://blog.csdn.net/w523382154/article/details/121140823
sudo apt-get install -y cmake zlib1g-dev libjpeg-dev xvfb xorg-dev python-opengl libboost-all-dev libsdl2-dev swig
出现错误:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package cmake is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'cmake' has no installation candidate
E: Unable to locate package zlib1g-dev
E: Unable to locate package libjpeg-dev
E: Unable to locate package xvfb
E: Unable to locate package xorg-dev
E: Unable to locate package python-opengl
E: Unable to locate package libboost-all-dev
E: Unable to locate package libsdl2-dev
E: Unable to locate package swig
跟1.1同样的缺包问题
参考:https://www.cnblogs.com/zzwhjj/p/5567148.html
解决方法如下:
# apt-get update
# apt-get upgrade
# apt-get install <packagename>
这样就可以正常使用apt-get了~
出现错误
$apt-get update
Reading package lists... Done
E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)
E: Unable to lock directory /var/lib/apt/lists/
W: Problem unlinking the file /var/cache/apt/pkgcache.bin - RemoveCaches (13: Permission denied)
W: Problem unlinking the file /var/cache/apt/srcpkgcache.bin - RemoveCaches (13: Permission denied)
参考:https://blog.csdn.net/voke_/article/details/78656383
缺包问题另一篇文章提出不同看法(https://blog.csdn.net/www_helloworld_com/article/details/84778641)
表示这个问题的原因是ubuntu的/etc/apt/source.list中的源比较旧了,需要更新一下,更新方法:
sudo apt-get update
出现问题
$sudo apt-get update
Get:1 http://mirrors.aliyun.com/ubuntu focal InRelease [3,190 B]
Get:2 http://mirrors.aliyun.com/ubuntu focal-security InRelease [3,190 B]
Get:3 http://mirrors.aliyun.com/ubuntu focal-updates InRelease [3,190 B]
Get:4 http://mirrors.aliyun.com/ubuntu focal-proposed InRelease [3,190 B]
Get:5 http://mirrors.aliyun.com/ubuntu focal-backports InRelease [3,190 B]
Err:1 http://mirrors.aliyun.com/ubuntu focal InRelease
Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
Err:2 http://mirrors.aliyun.com/ubuntu focal-security InRelease
Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
Err:3 http://mirrors.aliyun.com/ubuntu focal-updates InRelease
Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
Err:4 http://mirrors.aliyun.com/ubuntu focal-proposed InRelease
Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
Err:5 http://mirrors.aliyun.com/ubuntu focal-backports InRelease
Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
Reading package lists... Done
N: See apt-secure(8) manpage for repository creation and user configuration details.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
E: The repository 'http://mirrors.aliyun.com/ubuntu focal InRelease' is not signed.
E: Failed to fetch http://mirrors.aliyun.com/ubuntu/dists/focal/InRelease Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
N: See apt-secure(8) manpage for repository creation and user configuration details.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
E: The repository 'http://mirrors.aliyun.com/ubuntu focal-security InRelease' is not signed.
E: Failed to fetch http://mirrors.aliyun.com/ubuntu/dists/focal-security/InRelease Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
N: See apt-secure(8) manpage for repository creation and user configuration details.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
E: The repository 'http://mirrors.aliyun.com/ubuntu focal-updates InRelease' is not signed.
E: Failed to fetch http://mirrors.aliyun.com/ubuntu/dists/focal-updates/InRelease Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
E: Failed to fetch http://mirrors.aliyun.com/ubuntu/dists/focal-proposed/InRelease Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
E: The repository 'http://mirrors.aliyun.com/ubuntu focal-proposed InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: Failed to fetch http://mirrors.aliyun.com/ubuntu/dists/focal-backports/InRelease Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
E: The repository 'http://mirrors.aliyun.com/ubuntu focal-backports InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
2.1.1 更新源
参考:
- https://blog.csdn.net/jh_luchi/article/details/102812031
- https://blog.csdn.net/www_helloworld_com/article/details/84778641
第一步,在官网源https://mirrors.ustc.edu.cn/repogen/下载对应版本最新的源,我的版本是9.4.0
cat /proc/version
Linux version 5.15.0-48-generic (buildd@lcy02-amd64-043) (gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4. 0, GNU ld (GNU Binutils for Ubuntu) 2.34)
实验室给的服务器版本太老了,连网页都给出警告
第二步,用vim替换原有的source.list的内容
sudo vim /etc/apt/sources.list
第三步,更新:sudo apt-get update,仍然有错误
sudo apt-get update
Ign:1 https://mirrors.ustc.edu.cn/ubuntu-old-releases/ubuntu jaunty InRelease
Ign:2 https://mirrors.ustc.edu.cn/ubuntu-old-releases/ubuntu jaunty-security InRelease
Ign:3 https://mirrors.ustc.edu.cn/ubuntu-old-releases/ubuntu jaunty-updates InRelease
Ign:4 https://mirrors.ustc.edu.cn/ubuntu-old-releases/ubuntu jaunty-backports InRelease
Err:5 https://mirrors.ustc.edu.cn/ubuntu-old-releases/ubuntu jaunty Release
Certificate verification failed: The certificate is NOT trusted. The certificate issuer is unknown.certificate does not match the expected. Could not handshake: Error in the certificate verification.10 443]
Err:6 https://mirrors.ustc.edu.cn/ubuntu-old-releases/ubuntu jaunty-security Release
Certificate verification failed: The certificate is NOT trusted. The certificate issuer is unknown.certificate does not match the expected. Could not handshake: Error in the certificate verification.10 443]
Err:7 https://mirrors.ustc.edu.cn/ubuntu-old-releases/ubuntu jaunty-updates Release
Certificate verification failed: The certificate is NOT trusted. The certificate issuer is unknown.certificate does not match the expected. Could not handshake: Error in the certificate verification.10 443]
Err:8 https://mirrors.ustc.edu.cn/ubuntu-old-releases/ubuntu jaunty-backports Release
Certificate verification failed: The certificate is NOT trusted. The certificate issuer is unknown.certificate does not match the expected. Could not handshake: Error in the certificate verification.10 443]
Reading package lists... Done
E: The repository 'https://mirrors.ustc.edu.cn/ubuntu-old-releases/ubuntu jaunty Release' does not ha.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: The repository 'https://mirrors.ustc.edu.cn/ubuntu-old-releases/ubuntu jaunty-security Release' doease file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: The repository 'https://mirrors.ustc.edu.cn/ubuntu-old-releases/ubuntu jaunty-updates Release' doease file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: The repository 'https://mirrors.ustc.edu.cn/ubuntu-old-releases/ubuntu jaunty-backports Release' dlease file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
2.1.2 安装ca-certificates
参考:
- https://blog.csdn.net/qq_19729599/article/details/114682507
- https://blog.csdn.net/Chaowanq/article/details/121559709
$sudo apt install ca-certificates
Reading package lists... Done
Building dependency tree
Reading state information... Done
ca-certificates is already the newest version (20211016~20.04.1).
The following packages were automatically installed and are no longer required:
g++-8 javascript-common libaccinj64-10.1 libcublas10 libcublaslt10 libcudart10.1 libcufft10
libcufftw10 libcuinj64-10.1 libcupti-dev libcupti-doc libcupti10.1 libcurand10 libcusolver10
libcusolvermg10 libcusparse10 libegl-dev libgl-dev libgl1-mesa-dev libgles-dev libgles1
libglvnd-dev libglx-dev libjs-jquery libjs-underscore libncurses5 libnppc10 libnppial10
libnppicc10 libnppicom10 libnppidei10 libnppif10 libnppig10 libnppim10 libnppist10 libnppisu10
libnppitc10 libnpps10 libnvblas10 libnvgraph10 libnvidia-ml-dev libnvjpeg10 libnvrtc10.1
libnvtoolsext1 libnvvm3 libopengl-dev libstdc++-8-dev libthrust-dev libtinfo5 libvdpau-dev
node-html5shiv nsight-compute nsight-systems ocl-icd-opencl-dev opencl-c-headers
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
安装成功
2.1.3 继续sudo apt-get update
仍然出错:
Get:1 http://202.204.48.82/1.htm?mv6=2001:0da8:0208:0125:ac18:4098:bd8e:346b&url=http://mirrors.edu.cn/ubuntu-old-releases/ubuntu jaunty InRelease [3,190 B]
Err:1 http://202.204.48.82/1.htm?mv6=2001:0da8:0208:0125:ac18:4098:bd8e:346b&url=http://mirrors.edu.cn/ubuntu-old-releases/ubuntu jaunty InRelease
Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
Get:2 http://202.204.48.82/1.htm?mv6=2001:0da8:0208:0125:ac18:4098:bd8e:346b&url=http://mirrors.edu.cn/ubuntu-old-releases/ubuntu jaunty-security InRelease [3,190 B]
Err:2 http://202.204.48.82/1.htm?mv6=2001:0da8:0208:0125:ac18:4098:bd8e:346b&url=http://mirrors.edu.cn/ubuntu-old-releases/ubuntu jaunty-security InRelease
Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
Get:3 http://202.204.48.82/1.htm?mv6=2001:0da8:0208:0125:ac18:4098:bd8e:346b&url=http://mirrors.edu.cn/ubuntu-old-releases/ubuntu jaunty-updates InRelease [3,190 B]
Err:3 http://202.204.48.82/1.htm?mv6=2001:0da8:0208:0125:ac18:4098:bd8e:346b&url=http://mirrors.edu.cn/ubuntu-old-releases/ubuntu jaunty-updates InRelease
Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
Get:4 http://202.204.48.82/1.htm?mv6=2001:0da8:0208:0125:ac18:4098:bd8e:346b&url=http://mirrors.edu.cn/ubuntu-old-releases/ubuntu jaunty-backports InRelease [3,190 B]
Err:4 http://202.204.48.82/1.htm?mv6=2001:0da8:0208:0125:ac18:4098:bd8e:346b&url=http://mirrors.edu.cn/ubuntu-old-releases/ubuntu jaunty-backports InRelease
Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
Reading package lists... Done
N: See apt-secure(8) manpage for repository creation and user configuration details.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
E: The repository 'http://mirrors.ustc.edu.cn/ubuntu-old-releases/ubuntu jaunty InRelease' is noned.
E: Failed to fetch http://mirrors.ustc.edu.cn/ubuntu-old-releases/ubuntu/dists/jaunty/InRelease rsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
N: See apt-secure(8) manpage for repository creation and user configuration details.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
E: The repository 'http://mirrors.ustc.edu.cn/ubuntu-old-releases/ubuntu jaunty-security InReleas not signed.
E: Failed to fetch http://mirrors.ustc.edu.cn/ubuntu-old-releases/ubuntu/dists/jaunty-security/Iase Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
E: Failed to fetch http://mirrors.ustc.edu.cn/ubuntu-old-releases/ubuntu/dists/jaunty-updates/Inse Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
E: The repository 'http://mirrors.ustc.edu.cn/ubuntu-old-releases/ubuntu jaunty-updates InReleas not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: Failed to fetch http://mirrors.ustc.edu.cn/ubuntu-old-releases/ubuntu/dists/jaunty-backports/ease Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
E: The repository 'http://mirrors.ustc.edu.cn/ubuntu-old-releases/ubuntu jaunty-backports InReleis not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
解决方法众说纷纭,莫衷一是
有改DNS
未完待续…
2.2 安装mujoco
参考文章:https://blog.csdn.net/qq_37921030/article/details/121305417
cd ~
mkdir .mujoco
wget https://www.roboti.us/download/mjpro150_linux.zip
unzip mjpro150_linux.zip
在第三步下载出错:
ERROR: cannot verify www.roboti.us's certificate, issued by ‘C=CN,O=Doctorcom LTD.,CN=demotest.doctorcom.com’:
Self-signed certificate encountered.
ERROR: certificate common name ‘demotest.doctorcom.com’ doesn't match requested host name ‘www.roboti.us’.
To connect to www.roboti.us insecurely, use `--no-check-certificate'.
于是直接下载到windows解压再复制到服务器里,放在.mujoco下
把如下内容添加到 .bashrc 文件中(参考https://blog.csdn.net/bornfree5511/article/details/107341116)
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/.mujoco/mjpro150/bin:/usr/local/cuda-10.2/lib64
export MUJOCO_KEY_PATH=~/.mujoco:~/.mujoco/mjpro150/bin:$MUJOCO_KEY_PATH
验证一下安装的正确性
cd ~/.mujoco/mjpro150/bin
./simulate
报错
[new402@~/.mujoco/mjpro150/bin]$./simulate
./simulate: error while loading shared libraries: libmujoco150.so: cannot open shared object file: No such file or directory
需source ~/.bashrc使.bashrc 文件生效再验证
2.2.1 安装mujoco-py
下载好对应的150版本的文件
wget https://github.com/openai/mujoco-py/archive/refs/tags/1.50.1.0.tar.gz
按照GitHub上说的,安装好必备的一些包
sudo apt install libosmesa6-dev libgl1-mesa-glx libglfw3
出现错误
$sudo apt install libosmesa6-dev libgl1-mesa-glx libglfw3sudo apt install libosmesa6-dev libgl1-mesa-glx libglfw3
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package libgl1-mesa-glx is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Unable to locate package libosmesa6-dev
E: Package 'libgl1-mesa-glx' has no installation candidate
E: Unable to locate package libglfw3sudo
E: Unable to locate package install
E: Unable to locate package libosmesa6-dev
E: Package 'libgl1-mesa-glx' has no installation candidate
E: Unable to locate package libglfw3
与2.1同样的问题