在AWS EC2环境下运行baselines的步骤

本文档详述了在AWS EC2环境中安装Baselines和Minerl库的过程,包括遇到的依赖问题和解决方案。首先在根目录下克隆gym仓库并使用sudo安装,接着尝试安装pathlib2,由于遇到问题,最终通过pip安装minerl成功。注意不同库的安装方法可能不同,避免混淆gym与minerl的安装方式。
摘要由CSDN通过智能技术生成

1、python behavioral_cloning.py

(base) [ec2-user@ip- workspace]$ cd baselines/general/chainerrl/baselines/agents
(base) [ec2-user@ip- agents]$ python behavioral_cloning.py
Traceback (most recent call last):
  File "behavioral_cloning.py", line 9, in <module>
    import minerl  # noqa: register MineRL envs as Gym envs.
ModuleNotFoundError: No module named 'minerl'
  1. python gail.py
(base) [ec2-user@ip- agents]$ python gail.py
Traceback (most recent call last):
  File "gail.py", line 16, in <module>
    import chainer
ModuleNotFoundError: No module named 'chainer'
  1. cd ~ 而非cd …
    因为不要在子baselines下安装,这会把baselines的文件体系弄乱,要在根目录下下载存储安装

  2. git clone git@github.com:openai/gym.git

  3. cd gym

6.python setup.py install
前面没有加sudo,所以有bug

python setup.py install
running install
error: can't create or remove files in install directory

The following error occurred while trying to add or remove files in the
installation directory:

    [Errno 13] Permission denied: '/home/ec2-user/anaconda/lib/python3.7/site-packages/test-easy-install-2981.write-test'

The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:

    /home/ec2-user/anaconda/lib/python3.7/site-packages/

Perhaps your account does not have write access to this directory?  If the
installation directory is a system-owned directory, you may need to sign in
as the administrator or "root" account.  If you do not have administrative
access to this machine, you may wish to choose a different installation
directory, preferably one that is listed in your PYTHONPATH environment
variable.

For information on other options, you may wish to consult the
documentation at:

  https://setuptools.readthedocs.io/en/latest/easy_install.html

Please make the appropriate changes for your system and try again.
  1. 加sudo,安装成功。

sudo python setup.py install
running install
………………
Using /usr/lib/python2.7/dist-packages
Finished processing dependencies for gym==0.17.2

  1. 记住这里不是要加pip3,而是要加sudo

  2. 再安装minerl

(base) [ec2-user@ip- ~]$ git clone git@github.com:minerllabs/minerl.git
Cloning into 'minerl'...
remote: Enumerating objects: 370, done.
remote: Counting objects: 100% (370/370), done.
remote: Compressing objects: 100% (273/273), done.
remote: Total 4281 (delta 177), reused 247 (delta 85), pack-reused 3911
Receiving objects: 100% (4281/4281), 71.81 MiB | 32.15 MiB/s, done.
Resolving deltas: 100% (2397/2397), done.
(base) [ec2-user@ip- ~]$ cd minerl
(base) [ec2-user@ip-minerl]$ sudo python setup.py install
Traceback (most recent call last):
  File "setup.py", line 5, in <module>
    import pathlib
ImportError: No module named pathlib 
  1. 安装pathlib
    (base) [ec2-user@ip- minerl]$ cd ~
    (base) [ec2-user@ip- ~]$ git clone git@github.com:mcmtroffaes/pathlib2.git
    Cloning into ‘pathlib2’…
    remote: Enumerating objects: 1473, done.
    remote: Total 1473 (delta 0), reused 0 (delta 0), pack-reused 1473
    Receiving objects: 100% (1473/1473), 2.30 MiB | 16.55 MiB/s, done.
    Resolving deltas: 100% (884/884), done.
    (base) [ec2-user@ip- ~]$ cd pathlib2
    (base) [ec2-user@ip- pathlib2]$ sudo python setup.py install
    running install
    running bdist_egg
    ……………………

Using /usr/lib/python2.7/dist-packages
Finished processing dependencies for pathlib2==2.3.6a0

  1. 再装minerl
    不成功
  2. 装pathlib库始终不成功
pip install pathlib
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
Defaulting to user installation because normal site-packages is not writeable
Collecting pathlib
  Using cached pathlib-1.0.1.tar.gz (49 kB)
Building wheels for collected packages: pathlib
  Building wheel for pathlib (setup.py) ... done
  Created wheel for pathlib: filename=pathlib-1.0.1-py3-none-any.whl size=14347 sha256=cbbf6266d9be91108f34ff632b07c4ece227c2d3db9f37916b6a59567fd91be3
  Stored in directory: /home/ec2-user/.cache/pip/wheels/6e/96/b8/10037fe231e23970bac58361d7c93571ab983a7bbc55e68550
Successfully built pathlib
Installing collected packages: pathlib
Successfully installed pathlib-1.0.1
(base) [ec2-user@ip-~]$ cd minerl
(base) [ec2-user@ip- minerl]$ sudo python setup.py install
Traceback (most recent call last):
  File "setup.py", line 5, in <module>
    import pathlib
ImportError: No module named pathlib
  1. 废了九牛二虎之力,终于把pathlib2删除了
(base) [ec2-user@ip- ~]$ cd /usr/local/lib/python2.7/site-packages
(base) [ec2-u
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值