<commit_before># DIANNE OpenAI Gym environments

The DIANNE OpenAI Gym environments are enabled through Java Embedded Python (JEP), a native interface enabling to call Python code from Java through CPython.

In order for the environments to work, one needs to have installed:

* Python (2.7)
* OpenAI Gym
* Additional simulators (e.g. Box2D or Mujoco)

## Install Jep

Jep embeds CPython in Java through JNI and is used to communicate with the Python based OpenAI gym. Install Jep using pip:

```
pip install jep
```

## Installing OpenAI gym

Fetch the gym source and install:

```
git clone https://github.com/openai/gym
cd gym
pip install -e . # minimal install
```

To perform a full install:

```
pip install -e .[all]
```

More info on OpenAI gym, take a look at their [website](https://gym.openai.com/docs)

## Running an OpenAI environment in DIANNE

To run an OpenAI environment in DIANNE, select "Gym" as DIANNE environment id and pass as config "env=CartPole-v0" to select the actual gym environment to launch.



 <commit_msg>add Jep instructions in readme<commit_after># DIANNE OpenAI Gym environments

The DIANNE OpenAI Gym environments are enabled through Java Embedded Python (JEP), a native interface enabling to call Python code from Java through CPython.

In order for the environments to work, one needs to have installed:

* Python (2.7)
* OpenAI Gym
* Additional simulators (e.g. Box2D or Mujoco)

## Install Jep

Jep embeds CPython in Java through JNI and is used to communicate with the Python based OpenAI gym. Install Jep using pip:

```
pip install jep
```

## Installing OpenAI gym

Fetch the gym source and install:

```
git clone https://github.com/openai/gym
cd gym
pip install -e . # minimal install
```

To perform a full install:

```
pip install -e .[all]
```

More info on OpenAI gym, take a look at their [website](https://gym.openai.com/docs)

## Running an OpenAI environment in DIANNE

In order to run Jep from your OSGi runtime on Linux, make sure you have LD_PRELOAD defined to the Python 2.7 library .so:

```
export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libpython2.7.so
```

To run an OpenAI environment in DIANNE, select "Gym" as DIANNE environment id and pass as config "env=CartPole-v0" to select the actual gym environment to launch.



 
{'fraction_non_alphanumeric': 0.07833698030634573, 'fraction_numerical': 0.00700218818380744, 'mean_word_length': 4.102678571428571, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6264714', 'n_tokens_mistral': 730, 'n_tokens_neox': 692, 'n_words': 327}