Skip to main content

Wrapper for running/rendering OpenAI Gym on Jupyter Notebook

Project description

Gym-Notebook-Wrapper

Gym-Notebook-Wrapper provides small wrapper for running and rendering OpenAI Gym on Jupyter Notebook or similar (e.g. Google Corab).

Requirement

  • Linux
  • Xvfb
    • On Ubuntu, you can install sudo apt update && sudo apt install xvfb.
  • Open GL (for some environment)
    • On Ubuntu, you can install sudo apt update && sudo apt install python-opengl

Installation

You can install from PyPI with pip install gym-notebook-wrapper

Usage

Wrap gym.Env class with gnwrapper.Animation. That's all! The render() method shows the environment on its output. An example code is following;

import gnwrapper
import gym

env = gnwrapper.Animation(gym.make('CartPole-v1'))

obs = env.reset()

for _ in range(1000):
    next_obs, reward, done, info = env.step(env.action_space.sample())
    env.render()

    obs = next_obs
    if done:
        obs = env.reset()

Limitation

  • Calling render() method delete the other output for the same cell.
  • The output image is shown only once.

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 Distribution

If you're not sure about the file name format, learn more about wheel file names.

gym_notebook_wrapper-0.0.3-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

Details for the file gym_notebook_wrapper-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: gym_notebook_wrapper-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 3.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for gym_notebook_wrapper-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 a7fb757280a821aedd01c984eba1e576359bd8e8d57886d1dbf5657769e226a2
MD5 3bc51c83c93445f3873c3699b025b85d
BLAKE2b-256 9b001bde608804126a3a1ab4ded1b207dbf8228cfdfb18bc5ce700658e364914

See more details on using hashes here.

Supported by

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