Recently a foreign friend in a project to reproduce the code when the environment configuration problems, ask me to help solve. To tell the truth, the game and enhance learning these two aspects I am not very familiar with, but fortunately for Ubuntu is also familiar with, after a long time, finally let the program smoothly run up. Have to say, these deep learning environment configuration is really annoying, a variety of library version of Endless, a careless full plate is lost, but we can do it, only bite the bullet duck!
Project Address Stamp This--minecraft-reinforcement-learning
Installation Environment
Ubuntu 16.04
Python 3.6
malmo==0.34.0
gym==0.7.4
minecraft-py==0.0.2
gym-minecraft==0.0.2
Pygame==1.9.4.dev0
1. Installing Malmo and dependent libraries
wget https://github.com/Microsoft/malmo/releases/download/0.34.0/Malmo-0.34.0-Linux-Ubuntu-16.04-64bit_withBoost_Python3.5.zipunzip Malmo-0.34.0-Linux-Ubuntu-16.04-64bit_withBoost_Python3.5.zipmv Malmo-0.34.0-Linux-Ubuntu-16.04-64bit_withBoost_Python3.5 Malmocp -r Malmo ~ # 移动文件夹到任意位置即可sudo apt-get install libboost-all-dev libpython2.7 openjdk-8-jdk lua5.1 libxerces-c3.1 liblua5.1-0-dev ffmpeg python-tk python-imaging-tksudo update-ca-certificates -f
2. Install OpenAI Gym
whereis pip> pip: /usr/local/bin/pip2.7 /usr/local/bin/pip3.6 /usr/local/bin/pip /home/lab/anaconda3/bin/pip3.6 /home/lab/anaconda3/bin/pip /usr/share/man/man1/pip.1.gzsudo /usr/local/bin/pip3.6 install gym==0.7.4
- If you have multiple versions of PIP, you need to specify a specific path and then install gym 0.7.4
3. Installing Minecraft_py
git clone https://github.com/tambetm/minecraft-py.gitcd minecraft-pycp -r ../Malmo/Minecraft/ minecraft_py/Malmocp -r ../Malmo/Mod/ minecraft_py/Malmocp -r ../Malmo/Python_Examples/ minecraft_py/Malmocp -r ../Malmo/Schemas/ minecraft_py/Malmo/# 复制第一步 Malmo 文件夹下的 Minecraft、Mod、Python_Examples 和 Schemas 到 minecraft_py/Malmo 下sudo /usr/bin/python3.6 setup.py install
- If the direct installation will report the following error
warning: no directories found matching ‘minecraft_py/Malmo/Minecraft‘warning: no directories found matching ‘minecraft_py/Malmo/Mod‘warning: no directories found matching ‘minecraft_py/Malmo/Python_Examples‘warning: no directories found matching ‘minecraft_py/Malmo/Schemas‘
4. Installing Gym-minecraft
cd ..git clone https://github.com/tambetm/gym-minecraft.gitcd gym-minecraftsudo /usr/bin/python3.6 setup.py install
5. Installing Pygame
sudo apt-get install mercurial python3-dev python3-setuptools python3-numpy python3-opengl libav-tools libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev libsmpeg-dev libsdl1.2-dev libportmidi-dev libswscale-dev libavformat-dev libavcodec-dev libtiff5-dev libx11-6 libx11-dev fluid-soundfont-gm timgm6mb-soundfont xfonts-base xfonts-100dpi xfonts-75dpi xfonts-cyrillic fontconfig fonts-freefont-ttfcd ..hg clone https://bitbucket.org/pygame/pygamecd pygamesudo /usr/bin/python3.6 setup.py buildsudo /usr/bin/python3.6 setup.py install
6. Add Scoreboard to Gym
wget https://github.com/openai/gym/archive/v0.7.4.zipunzip v0.7.4.zipsudo cp -r gym-0.7.4/gym/scoreboard /usr/local/lib/python3.6/dist-packages/gym/
7. Add Environment variables
echo "export MALMO_XSD_PATH=/usr/local/lib/python3.6/dist-packages/minecraft_py-0.0.2-py3.6.egg/minecraft_py/Malmo/Schemas" >> ~/.bashrcsource ~/.bashrc
8. Some issues
- At this point, you can first try to run
/usr/local/lib/python3.6/dist-packages/minecraft_py-0.0.2-py3.6.egg/minecraft_py/Malmo/Minecraft
the next launchclient.sh, if you can run successfully, basically no problem. If you encounter some permissions, you can also /usr/local/lib/python3.6/dist-packages/minecraft_py-0.0.2-py3.6.egg/minecraft_py/__init__.py
change the folder path after the two path is the first step in the file.
malmo_xsd_path = ‘/media/lab/data/yongsen/pygame/Malmo/Schemas‘malmo_dir = ‘/media/lab/data/yongsen/pygame/Malmo‘
- If a library relies on the error, only need to install the corresponding dependency.
For example Importerror:cannot import name ' _psutil_linux ',sudo /usr/local/bin/pip3.6 install psutil
For more highlights, please follow "seniusen"!
A lengthy code-replication experience