Skip to main content

Project Malmo is a platform for Artificial Intelligence experimentation and research built on top of Minecraft

Project description

# Pip installable package for Malmo #

Malmo can be built from source ([Instructions for building from source](https://github.com/Microsoft/malmo/tree/master/doc))
or easily installed from the pre-build version
([Install from pre-built version](https://github.com/Microsoft/malmo/releases)).
However, it is often even simpler and sufficient to install Malmo as a python native platform wheel for Windows, MacOS or Linux.

## Prerequisites ##

In order to `pip3 install malmo` there are some environment and OS dependency requirements that have to be met:

1. Java 8 must be installed and the JAVA_HOME environment variable set up for Java8.
2. [git](https://git-scm.com/) should be installed and on your shell search path.
3. MALMO_XSD_PATH must be set to where the XSD schema files are located (more on this below).
4. There are a few OS specific dependencies that must be pre-installed.

* For [Ubuntu Linux](https://github.com/Microsoft/malmo/blob/package/doc/install_linux.md) these are follows:
`python3-pip ffmpeg openjdk-8-jdk git`,
We'll add more Linux flavours specifics here soon but meanwhile the docker build scripts are a good place to start.

* Windows - please use the [manual install](https://github.com/Microsoft/malmo/blob/package/doc/install_windows_manual.md) to install dependencies.
(The dependencies are python3, ffmpeg, 7zip, Java8 and additionally git.)

* MacOSX - please see [MacOSX](https://github.com/Microsoft/malmo/blob/master/doc/install_macosx.md).

If you are unsure of what to pre-install for your Linux flavour,
the Malmo docker build files might be a good place to start
([Docker build files](https://github.com/Microsoft/malmo/tree/master/scripts/docker)).

## Using the prebuilt Docker image ##

Rather than installing these dependencies manually it's simper to use docker to launch a docker container using our prebuilt docker image.

Our docker image already has the Malmo Python package installed, as well as the source code and Minecraft
(and the dependencies of course), along with a Jupyter server so can start coding right away!

The docker container will launch the Malmo Minecraft Mod and a Jupyter server on start up,
and is set up to allow remote access via the
[VNC remote desktop display protocol](https://en.wikipedia.org/wiki/Virtual_Network_Computing)
so that you are able to see the Minecraft game running inside the container.

```
docker run -it -p 5901:5901 -p 6901:6901 -p8888:8888 -e VNC_PW=vncpassword andkram/malmo_0_35_6
```

You can add a `-v drive:/somedir:/somedir` option to the above docker run command to mount a directory
for sharing your coding project files. You should also select a different hard to guess password.

To access the container browse to `http://localhost:6901/?password=vncpassword` (or connect to port 5901 using a VNC client).

Once Minecraft is completely launched in the container (which can take some minutes the first time the container is run)
you should see it in the VNC desktop in your open browser tab.

After launching Minecraft, a Jupiter server is also started up and a connection advise hint is written on the docker container's output.
Please follow the advice to cut & paste the url into another browser tab but substituting `localhost` for `0.0.0.0` or address URL part
(as we are bridging port 8888 to the docker container).

The output looks something like this:

```
Copy/paste this URL into your browser when you connect for the first time,
to login with a token:
http://0.0.0.0:8888/?token=1c6390221431ca75146946c52e253f063431b6488420bbac
```
(Here you should have used: `http://localhost:8888/?token=1c6390221431ca75146946c52e253f063431b6488420bbac`for Jupyter.)

To run a sample mission in Jupyter, create a python3 notebook and enter `from malmo.run_mission import run; run()` and execute the notebook.

## Install using pip locally ##

If you would rather install Malmo locally without docker you can do that
(after satisfying the OS & environment variable requirements above) using:

```
pip3 install malmo
```

Create or change into a working directory where you would like Malmo to be installed (in a sub directory named MalmoPlatform) and do:

```
python3 -c 'import malmo.minecraftbootstrap; malmo.minecraftbootstrap.download()'
```

This command will create a new directory (called MalmoPlatform) containing the Malmo GitHub project in your (current) working directory. By default, the master branch is downloaded. You can specify a branch using a string keyword argument (named branch) to the download function - which can be necessary if the malmo package was not installed recently and the download is for some reason done again.

Please remember to set up the MALMO_XSD_PATH environment variable to point to the MalmoPlatform/Schemas directory.
i.e. full path of working dir and MalmoPlatform/Schema.

Alternatively, you could set it in Python temporarily with a `malmo.minecraftbootstrap.set_malmo_xsd_path();` statement after the
`import malmo.minecraftbootstrap;` module import in the python command below.

You can now launch Minecraft from your working directory:

```
python3 -c 'import malmo.minecraftbootstrap; malmo.minecraftbootstrap.launch_minecraft()'
```

This may take some time (minutes if it's the first run as it needs to build Minecraft Forge).

The malmo package includes a simple test mission which you can run as follows:

```
python3 -c 'from malmo.run_mission import run; run()'
```

(Again, add a `malmo.minecraftbootstrap.set_malmo_xsd_path()` statement if you have not set up the MALMO_XSD_PATH.)

You can also run the mission from Jupyter. Simply create a Python3 notebook and
add `from malmo.run_mission import run; run()` to the notebook and execute it.

To start coding you could try `import malmo; help(malmo)`.
The MalmoPython sub-module (`import malmo.MalmoPython`) is the native library used by all the Malmo Python examples.

## Running existing examples ##

If you wish to run old Malmo examples against the pip "malmo" module without editing imports
then you may want to copy in MalmoPython.py and malmoutil.py from the
[pip package backwards compatibility directory](https://github.com/Microsoft/malmo/tree/package/scripts/python-wheel/backwards-compatible-imports) or include them on your PYTHONPATH.

## Deinstall ##

To deinstall delete the (downloaded) MalmoPlatform directory and it's contents and do a `pip3 uninstall malmo`.



Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

malmo-0.36.0.0-cp37-cp37m-macosx_10_13_x86_64.whl (1.8 MB view details)

Uploaded CPython 3.7m macOS 10.13+ x86-64

malmo-0.36.0.0-cp36-cp36m-win_amd64.whl (724.2 kB view details)

Uploaded CPython 3.6m Windows x86-64

malmo-0.36.0.0-cp35-cp35m-manylinux1_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.5m

File details

Details for the file malmo-0.36.0.0-cp37-cp37m-macosx_10_13_x86_64.whl.

File metadata

  • Download URL: malmo-0.36.0.0-cp37-cp37m-macosx_10_13_x86_64.whl
  • Upload date:
  • Size: 1.8 MB
  • Tags: CPython 3.7m, macOS 10.13+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.7.0

File hashes

Hashes for malmo-0.36.0.0-cp37-cp37m-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 9633626a7621ffda012d64bc54a1d592f8da5925aeb018c55e9e4ec81e2cc505
MD5 9ceae6ec99786c3068c61672b59a0d64
BLAKE2b-256 a51271cfbf665a6b4c98e329691d738884721412072d08006e71367e3963dc4b

See more details on using hashes here.

File details

Details for the file malmo-0.36.0.0-cp36-cp36m-win_amd64.whl.

File metadata

  • Download URL: malmo-0.36.0.0-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 724.2 kB
  • Tags: CPython 3.6m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/28.8.0 requests-toolbelt/0.8.0 tqdm/4.23.1 CPython/3.6.4

File hashes

Hashes for malmo-0.36.0.0-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 02e93e7cc8788d625160490537528da95b9a65196acbe063eecd944611c2411a
MD5 a55fcf35ec594404a7ed2c655f29d078
BLAKE2b-256 75b458a46d9f4616e9dd883cc9a854c540c624a76b0ab373c0332b8ae5c692f0

See more details on using hashes here.

File details

Details for the file malmo-0.36.0.0-cp35-cp35m-manylinux1_x86_64.whl.

File metadata

  • Download URL: malmo-0.36.0.0-cp35-cp35m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: CPython 3.5m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.5.2

File hashes

Hashes for malmo-0.36.0.0-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 3ca94d8181668941e1d846ba4fe13569ae98f9ad36e15be8a523ac7b64bfcc61
MD5 eaa4a0fa1a7a63459e08cc20bc2a890d
BLAKE2b-256 c642b9407a4fa658e3254ac680c90ef6d677ba80e126162afb1d66fd9a6ae6c0

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page