如何使用 Google Colab 安装 vizdoom?
How to install vizdoom using Google Colab?
我正在使用 Google Colab 关注 this tutorial。但是我遇到了 运行 from vizdoom import *
应该启用 Doom 环境的问题。
我尝试执行 !pip install vizdoom
,但它失败了。
Collecting vizdoom
Using cached https://files.pythonhosted.org/packages/45/15/8053139ab32054bed0b1bf46473f54c5a8d85e5c1d25b23410bc5de913c1/vizdoom-1.1.4.tar.gz
Requirement already satisfied: numpy in /usr/local/lib/python2.7/dist-packages (from vizdoom) (1.14.3)
Building wheels for collected packages: vizdoom
Running setup.py bdist_wheel for vizdoom ... error
Complete output from command /usr/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-GsCBh9/vizdoom/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/pip-wheel-tsUxvp --python-tag cp27:
running bdist_wheel
running build
error: [Errno 2] No such file or directory
----------------------------------------
Failed building wheel for vizdoom
Running setup.py clean for vizdoom
Failed to build vizdoom
Installing collected packages: vizdoom
Running setup.py install for vizdoom ... error
Complete output from command /usr/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-GsCBh9/vizdoom/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-N3TTEU/install-record.txt --single-version-externally-managed --compile:
running install
running build
error: [Errno 2] No such file or directory
----------------------------------------
Command "/usr/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-GsCBh9/vizdoom/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-N3TTEU/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-GsCBh9/vizdoom/
指令表明"You need to download vizdoom and place the folder in the repos"。但我不清楚如何在 Google Colab 中执行此操作。
非常感谢任何帮助。
您首先需要为 Linux 安装 vizdoom deps。它们列在此页面上:
https://github.com/mwydmuch/ViZDoom/blob/master/doc/Building.md#-linux
%%bash
# Install deps from
# https://github.com/mwydmuch/ViZDoom/blob/master/doc/Building.md#-linux
apt-get install build-essential zlib1g-dev libsdl2-dev libjpeg-dev \
nasm tar libbz2-dev libgtk2.0-dev cmake git libfluidsynth-dev libgme-dev \
libopenal-dev timidity libwildmidi-dev unzip
# Boost libraries
apt-get install libboost-all-dev
# Lua binding dependencies
apt-get install liblua5.1-dev
安装这些后,我能够成功导入所有库:
import tensorflow as tf # Deep Learning library
import numpy as np # Handle matrices
from vizdoom import * # Doom Environment
import random # Handling random number generation
import time # Handling time calculation
from skimage import transform# Help us to preprocess the frames
from collections import deque# Ordered collection with ends
import matplotlib.pyplot as plt # Display graphs
这是一个完整的示例笔记本:
https://colab.research.google.com/drive/1zDRkLhgjfOzW9C8jCtQ7-99TPDhxpCev
安装大约需要 10 分钟。您可能需要考虑将 Colab 与 a local Jupyter runtime 结合使用,这样您就可以跳过后续调用笔记本的设置开销。
如果您遇到以下错误
Collecting vizdoom
Using cached https://files.pythonhosted.org/packages/2d/6c/23565c09387173423883e7881fce53541ff89b5209ca0904c67e577dd6ac/vizdoom-1.1.7.tar.gz
Requirement already satisfied: numpy in /usr/local/lib/python3.6/dist-packages (from vizdoom) (1.16.4)
Building wheels for collected packages: vizdoom
Building wheel for vizdoom (setup.py) ... error
ERROR: Failed building wheel for vizdoom
Running setup.py clean for vizdoom
Failed to build vizdoom
Installing collected packages: vizdoom
Running setup.py install for vizdoom ... error
ERROR: Command "/usr/bin/python3 -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-install-4cphk6e9/vizdoom/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-u_ywx8n5/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-4cphk6e9/vizdoom/
只需运行apt-get更新再安装依赖:
%%bash
# Install deps from
# https://github.com/mwydmuch/ViZDoom/blob/master/doc/Building.md#-linux
apt-get update
apt-get install build-essential zlib1g-dev libsdl2-dev libjpeg-dev \
nasm tar libbz2-dev libgtk2.0-dev cmake git libfluidsynth-dev libgme-dev \
libopenal-dev timidity libwildmidi-dev unzip
# Boost libraries
apt-get install libboost-all-dev
# Lua binding dependencies
apt-get install liblua5.1-dev
我正在使用 Google Colab 关注 this tutorial。但是我遇到了 运行 from vizdoom import *
应该启用 Doom 环境的问题。
我尝试执行 !pip install vizdoom
,但它失败了。
Collecting vizdoom
Using cached https://files.pythonhosted.org/packages/45/15/8053139ab32054bed0b1bf46473f54c5a8d85e5c1d25b23410bc5de913c1/vizdoom-1.1.4.tar.gz
Requirement already satisfied: numpy in /usr/local/lib/python2.7/dist-packages (from vizdoom) (1.14.3)
Building wheels for collected packages: vizdoom
Running setup.py bdist_wheel for vizdoom ... error
Complete output from command /usr/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-GsCBh9/vizdoom/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/pip-wheel-tsUxvp --python-tag cp27:
running bdist_wheel
running build
error: [Errno 2] No such file or directory
----------------------------------------
Failed building wheel for vizdoom
Running setup.py clean for vizdoom
Failed to build vizdoom
Installing collected packages: vizdoom
Running setup.py install for vizdoom ... error
Complete output from command /usr/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-GsCBh9/vizdoom/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-N3TTEU/install-record.txt --single-version-externally-managed --compile:
running install
running build
error: [Errno 2] No such file or directory
----------------------------------------
Command "/usr/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-GsCBh9/vizdoom/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-N3TTEU/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-GsCBh9/vizdoom/
指令表明"You need to download vizdoom and place the folder in the repos"。但我不清楚如何在 Google Colab 中执行此操作。 非常感谢任何帮助。
您首先需要为 Linux 安装 vizdoom deps。它们列在此页面上: https://github.com/mwydmuch/ViZDoom/blob/master/doc/Building.md#-linux
%%bash
# Install deps from
# https://github.com/mwydmuch/ViZDoom/blob/master/doc/Building.md#-linux
apt-get install build-essential zlib1g-dev libsdl2-dev libjpeg-dev \
nasm tar libbz2-dev libgtk2.0-dev cmake git libfluidsynth-dev libgme-dev \
libopenal-dev timidity libwildmidi-dev unzip
# Boost libraries
apt-get install libboost-all-dev
# Lua binding dependencies
apt-get install liblua5.1-dev
安装这些后,我能够成功导入所有库:
import tensorflow as tf # Deep Learning library
import numpy as np # Handle matrices
from vizdoom import * # Doom Environment
import random # Handling random number generation
import time # Handling time calculation
from skimage import transform# Help us to preprocess the frames
from collections import deque# Ordered collection with ends
import matplotlib.pyplot as plt # Display graphs
这是一个完整的示例笔记本: https://colab.research.google.com/drive/1zDRkLhgjfOzW9C8jCtQ7-99TPDhxpCev
安装大约需要 10 分钟。您可能需要考虑将 Colab 与 a local Jupyter runtime 结合使用,这样您就可以跳过后续调用笔记本的设置开销。
如果您遇到以下错误
Collecting vizdoom
Using cached https://files.pythonhosted.org/packages/2d/6c/23565c09387173423883e7881fce53541ff89b5209ca0904c67e577dd6ac/vizdoom-1.1.7.tar.gz
Requirement already satisfied: numpy in /usr/local/lib/python3.6/dist-packages (from vizdoom) (1.16.4)
Building wheels for collected packages: vizdoom
Building wheel for vizdoom (setup.py) ... error
ERROR: Failed building wheel for vizdoom
Running setup.py clean for vizdoom
Failed to build vizdoom
Installing collected packages: vizdoom
Running setup.py install for vizdoom ... error
ERROR: Command "/usr/bin/python3 -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-install-4cphk6e9/vizdoom/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-u_ywx8n5/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-4cphk6e9/vizdoom/
只需运行apt-get更新再安装依赖:
%%bash
# Install deps from
# https://github.com/mwydmuch/ViZDoom/blob/master/doc/Building.md#-linux
apt-get update
apt-get install build-essential zlib1g-dev libsdl2-dev libjpeg-dev \
nasm tar libbz2-dev libgtk2.0-dev cmake git libfluidsynth-dev libgme-dev \
libopenal-dev timidity libwildmidi-dev unzip
# Boost libraries
apt-get install libboost-all-dev
# Lua binding dependencies
apt-get install liblua5.1-dev