Stable-baselines: [suggestion] Easier Installation for Windows

Created on 9 Oct 2019  路  8Comments  路  Source: hill-a/stable-baselines

To install this library on Windows 10, one may follow the tutorial, which instructs the user to replace the line gym[atari,classic_control]>=0.10.9 in _setup.py_ by gym[classic_control]>=0.10.9 before installation.

I've changed one simple detail in this _setup.py_ that will probably allow the installation on Windows 10 by simply running python setup.py install in prompt, without needing to ask the user to change a line of the code. At least, it worked fine for me.

Currently, the _setup.py_ code (in lines 105 to 109) is like this:

setup(name='stable_baselines',
      packages=[package for package in find_packages()
                if package.startswith('stable_baselines')],
      install_requires=[
          'gym[atari,classic_control]>=0.10.9',

Here is the deal. You can change this piece of code by the following one (not forgeting to import os):

if os.name == 'nt':
  gym_version = 'gym[classic_control]>=0.10.9'
else:
  gym_version = 'gym[atari,classic_control]>=0.10.9'

setup(name='stable_baselines',
      packages=[package for package in find_packages()
                if package.startswith('stable_baselines')],
      install_requires=[
          gym_version,

In this code, the change that is instructed in the tutorial is now done automatically. This is because of os.name, which indicates which operating system is running in your machine.

I hope this suggestion can contribute to your project at some level.

documentation windows

All 8 comments

Hello,

Looks like a good suggestion, I would even simplify the expression to:

gym_extras = 'classic_control' if os.name == 'nt' else 'atari,classic_control'

gym_package = 'gym[{}]>=0.10.9'.format(gym_extras)

We would appreciate a PR to solve that issue ;) (don't forget to update the documentation and the changelog if you do)

Question: What is the reason we do not install atari extras for gym? Nowadays atari-py package has prebuilt wheels for Windows and for me pip install atari-py works on Windows 10. _That said_, the wheels depend on some specific version of Windows runtime things (C/C++/Visual/etc...), and trying to create Atari environments results in "Specified module could not be found".

If nothing else is used from atari extras, I think it can be installed for Windows users as well.

Question: What is the reason we do not install atari extras for gym?
Nowadays atari-py package has prebuilt wheels for Windows

I was not aware of that... I'm not using windows (and travis uses linux too) so we were relying on user feedback for this one.

@lrthorita

Could you confirm if installing stable-baselines without modifications works for you? I am able to install current master branch (git clone the repository and then in the directory pip install .) on Windows 10 without issues.

@Miffyli

I've just tested the installation without modifications. It worked!
In the beginning, I had just followed the tutorial and thought it would be more practical to make the instructed change automatically. But, I hadn't thought about the possibility of trying the installation without changes.

So we just need to update the documentation in that case?

It looks like this is the case.
I appreciate your attention.

This has now been addressed in #506 , along with optional MPI instructions.

Thanks to @HoritaL once more for bringing this up! :)

Was this page helpful?
0 / 5 - 0 ratings