Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows support #11

Closed
salarian opened this issue Apr 28, 2016 · 101 comments
Closed

Windows support #11

salarian opened this issue Apr 28, 2016 · 101 comments

Comments

@salarian
Copy link

It would be nice if you could add support for Windows.

@andrewssobral
Copy link

True

@steenblikrs
Copy link

Please!! Support windows. I know I should have a dual boot linux distro, but I only have a little solid state. Adding a linux distro would cripple me... Long story short, it would be very convenient to have this available on windows!!

Thank you for all of your hard work thus far.

@gdb
Copy link
Collaborator

gdb commented May 16, 2016

I know a non-trivial number of people are currently using Gym on Windows. I think at this point, it mostly works (with the possible exception of Atari, though I think that too may be not too hard).

We don't have any Windows users at OpenAI currently. Is anyone on this thread interested in doing the work to get Gym fully supported on Windows (which mostly involves getting a CI service set up, and making sure our current functionality actually works there)? Happy to provide guidance.

See also #99.

@vrxacs
Copy link

vrxacs commented Jun 21, 2016

Is this still an issue worth resolving? It looks like there was an attempt in #99 but it never really went anywhere. I'd be interested in getting this set up.

@gdb
Copy link
Collaborator

gdb commented Jun 21, 2016

Yep, definitely!

@vrxacs
Copy link

vrxacs commented Jun 22, 2016

Alright, then! I'll start looking into it. I'm going to start by setting up a CI service somewhere. Let me know if there's anything else I should be looking into for this issue.

@quibsorg
Copy link

Any update on this?

@maxosmith
Copy link

maxosmith commented Aug 28, 2016

I've got OpenAI gym working on Windows 10 (at least CartPole). Preface: you need to run all the python commands as root because it does path look-ups differently by user.

Very rough instructions:

  1. Update to the latest version of Windows (>version 1607, "Anniversary Update")
  2. Enable Windows Subsystem for Linux (WSL)
  3. Open cmd, run bash
  4. Install python & gym (using sudo, and NOT PIP to install gym). So by now you should probably be able to run things and get really nasty graphics related errors. This is because WSL doesn't support any displays, so we need to fake it.
  5. Install vcXsrv, and run it (you should just have a little tray icon)
  6. In bash run "export DISPLAY=:0" Now when you run it you should get a display to pop-up, there may be issues related to graphics drivers. Sadly, this is where the instructions diverge if you don't have an NVIDIA graphics card.
  7. Get the drivers: "sudo apt-get install nvidia-319 nvidia-settings-319 nvidia-prime"
  8. Run!

Let me know if you have any questions or if I should do a detailed guide.

@lunzueta
Copy link

@maxosmith Good news! I have one question about this: why nvidia-319 and not a newer version?

@lbandy
Copy link

lbandy commented Aug 28, 2016

Just a heads-up for anyone not having Windows 10, I'm able to run the gym on Windows 7 using cygwin and ImageMagick, although I haven't tried the atari games yet. One issue though, the recording doesn't seem to work because of ffmpeg issues, but I assume this could be sorted after some investigation.

@maxosmith
Copy link

@lunzueta I knew it was a safe version for working with vcXsrv, I would imagine newer versions work.

@icoxfog417
Copy link

icoxfog417 commented Sep 13, 2016

@maxosmith Thank you for nice tutorial to enable gym work on Windows! I succeeded to run gym on my Windows PC (bash on Windows/Python 3.5.2). pip install also works fine, below is my setup procedure.

  • install vcXsrv on Windows
  • run bash on Windows
  • install all dependencies
  • pip install gym
  • pip install 'gym[atari]'
  • invoke vcXsrv Window (I recommend to reboot PC before it)
  • run export DISPLAY=:0
  • run below script, Invaders works fine.
import gym


if __name__ == "__main__":
    env = gym.make("SpaceInvaders-v0")
    env.reset()
    for _ in range(1000):
        env.render()
        env.step(env.action_space.sample())

Invaders

@fedorzh
Copy link

fedorzh commented Sep 21, 2016

After multiple hours of trial-and-error, this procedure worked for me from scratch, includes Jupyter:

Install Ubuntu (run in cmd) on Windows:
lxrun /uninstall /all
lxrun /install

Python and Jupyter (reference to microsoft/WSL#185 (comment)):
apt-get update
add-apt-repository ppa:aseering/wsl
apt-get update
apt-get install python-pip ipython ipython-notebook
pip install jupyter
jupyter notebook --no-browser

Gym:
apt-get install -y python-numpy python-dev cmake zlib1g-dev libjpeg-dev xvfb libav-tools xorg-dev python-opengl libboost-all-dev libsdl2-dev swig
pip install gym
pip install 'gym[atari]'

Graphics, I have Intel HD Graphics 4400, launch Xming first (vcXsrv didn't work!):
apt-get install mesa-utils
export DISPLAY=:0

@Viliami
Copy link

Viliami commented Oct 1, 2016

windows only has 90% market share, it's no big deal...

@Viliami
Copy link

Viliami commented Oct 2, 2016

I got OpenAI gym to work in windows without BASH but installing the extra dependencies like 'atari' can't be done because they install it using the make command

@Warr1611
Copy link

Warr1611 commented Oct 7, 2016

@Viliami Could you give detail on how you got OpenAI gym working without BASH?

@tihomir-kit
Copy link

tihomir-kit commented Dec 21, 2016

It's fascinating that I haven't been able to run even the cartpole on either a fresh install of the latest ubuntu on the hardware or in a vm, but the whole "ubuntu on windows" thing work flawlessly after the first try... :D thanks for the setup instructions @maxosmith @icoxfog417 !

@rybskej
Copy link

rybskej commented Dec 22, 2016

I've gotten atari_py to build and install on Windows 7 x86_64, using msys2/mingw64 for the compiler tools, Python 3.5 Anaconda, Xming for graphics, and TensorFlow 0.12.0 + CUDA GPU enabled.

For simplicity, I've forked this project with relatively minor changes applied and full install instructions included: https://github.com/rybskej/atari-py

It should be possible to merge these changes back into this project, with minor edits. I'll try to work on a portable patch.

@davidtellez
Copy link

@rybskej you are my hero! I followed your instructions in https://github.com/rybskej/atari-py and I can finally render Atari games in Windows 10 (no WSL bash): python 3.5 Anaconda, Xming, TensorFlow 0.12.0 + CUDA GPU and PyCharm :) It would be very interesting to merge the changes back, since many more people could benefit from it.

I also tested Ubuntu bash under Windows 10 WSL following @icoxfog417 instructions and it works using Xming, as suggested by @fedorzh.

@rybskej
Copy link

rybskej commented Jan 11, 2017 via email

@edupard
Copy link

edupard commented Jan 19, 2017

@rybskej Crystal clear instructions and it just works! Thanks a lot! Win7 x64, python 3.5

@VXLearning
Copy link

VXLearning commented Jan 30, 2017

Was able to get VcXsrv to work with Bash on Windows 10 (Dell Latitude 6220), python 2.7.6 by install the
opengl library:

  1. sudo apt-get install python-opengl
  2. export DISPLAY=:0
  3. run the cart pole example from gym or other games

Best of luck.

@Kojoley
Copy link

Kojoley commented Feb 20, 2017

I have opend a PR openai/atari-py#7 but I am asking here for help in testing it out.
All you need is to enter pip install -U git+https://github.com/Kojoley/atari-py.git
(requires zlib so have one installed in your system, the path to it can be provided with ZLIB_ROOT environment variable)

@edupard
Copy link

edupard commented Feb 21, 2017

@Kojoley
Win7_x64: I installed zlib from here Set ZLIB_ROOT to installation directory. But compiler could not find zlib.h. If i change ZLIB_ROOT to INSTALL_DIR/include it could not link...

@Kojoley
Copy link

Kojoley commented Feb 21, 2017

@edupard I have pushed a fix, but I am afraid that package you have provided link to is suitable only for mingw/cygwin (it requires unistd.h which is the part of posix that msvc does not support)

@edupard
Copy link

edupard commented Feb 21, 2017

@Kojoley Can you please tell exact package i have to use?

@Kojoley
Copy link

Kojoley commented Feb 21, 2017

@edupard If you use mingw as compiler for python - you can use one you have provided. Otherwise you have to compile it by yourself from official site. (I have not done conda support yet)

@jamartinh
Copy link

@rybskej and others, I found the method of @rybskej simpler than any other.
I works nicely. Also, it seems to render on windows 10 without the need of xming.

@ghost
Copy link

ghost commented Feb 27, 2017

@rybskej I was initially having problems building with make (something about not being able to find the compiler) but I tried again after reinstalling python and msys2 numerous times. It works beautifully! Thank you.
Running Windows 10 Insider Preview, Surface Book with dGPU, and Anaconda 4.2.0 with Python 3.5.2

@Kojoley
Copy link

Kojoley commented Feb 27, 2017

I got rid of zlib depency completely, so except the need of compiler it is now simply as typing pip install -U git+https://github.com/Kojoley/atari-py.git

@JaeDukSeo
Copy link

This was such as useful thread.

@jamartinh
Copy link

It seems that pyglet==1.2.4 is required instead of the current 1.3?

@Kojoley
Copy link

Kojoley commented Mar 6, 2018

It seems that pyglet==1.2.4 is required instead of the current 1.3?

If you are talking about this
https://bitbucket.org/pyglet/pyglet/issues/170/nameerror-name-puint-is-not-defined issue --
it is a problem with pyglet==1.3.1 on Python 2.7. You can roll back to pyglet==1.3.0 or install it from trunk.

@jamartinh
Copy link

jamartinh commented Mar 8, 2018

I am on python36, I had to downgrade to pyglet==1.2.4

@averdones
Copy link

averdones commented Mar 20, 2018

I'm on python 3.6.4 and I got an error when running pip install gym[all]
: Failed building wheel for Box2D-kengz.

Anyone got the same?

@jamartinh
Copy link

jamartinh commented Mar 21, 2018 via email

@averdones
Copy link

Do you know how to fix it @jamartinh?

I followed @aywi instructions and I could do pip install gym, but not pip install gym[all].

@jamartinh
Copy link

jamartinh commented Mar 23, 2018 via email

@ghost
Copy link

ghost commented Apr 19, 2018

Greetings, What is the long range strategy for windows support?
Please consider adding support for windows installation via pip.

Thanks, coast

@viper7882
Copy link

@jamartinh , I faced the same issue and apparently get resolved when following instructions at https://github.com/j8lp/atari-py.

@ivenzor
Copy link

ivenzor commented Jul 9, 2018

@jamartinh , I found the same error with Box2D-kengz while installing Box2d on Windows 10. I just went to http://www.swig.org/download.html, downloaded the zip file, unzipped it, changed windows PATH environmental to include swig.exe, then installed Box2D again and it seems to be working:

import gym
env = gym.make('LunarLander-v2')
env.reset()
for _ in range(1000):
env.render()
env.step(env.action_space.sample())
box2d

@jamartinh
Copy link

jamartinh commented Jul 9, 2018 via email

@thingersoft
Copy link

Let me say that given the OpenAI mission (and the reasons behind the gym toolkit) the lack of official support for the most widespread OS on the planet is pretty puzzling.

@ph-dev-2016
Copy link

when trying to use gym I get error from file
gym\wrappers\monitoring\video_recorder.py", line 254, in init
raise error.DependencyNotInstalled("""Found neithethe ffmpeg nor avconv executables.

Is this because
elif distutils.spawn.find_executable('ffmpeg')
should look for ffmpeg.exe in Windows version?

@ssokhey
Copy link

ssokhey commented Dec 11, 2018

I would like to share how I got it working on Windows 10:

First I enabled & installed Windows Subsystem for Linux. I went ahead and installed entire ubuntu-desktop which was not required I guess. You can also install Xming if you want to enable using GUI's like gedit, firefox (You would need to set Display:0).

Later I installed anaconda followed by pip install gym['atari'] & used jupyter notebook with --no-browser flag to open it in native Windows chrome browser. It works without any problem for me.

NOTE: I've skipped some things like pip refusing to install gym because of some permission error etc. I resolved it but I think that wasn't a generic error. If anyone is trying and facing any error, do report. I will share the solutions.

@itegmark
Copy link

itegmark commented Apr 8, 2019

This instruction worked like charm: https://towardsdatascience.com/how-to-install-openai-gym-in-a-windows-environment-338969e24d30

@NicoEssi
Copy link

Any update on how the Windows support is coming along? Been years now.

@daniel-fudge
Copy link

Just ran successfully in Windows 10. Just follow the readme with the addition of installing the "Build Tools for Visual Studio 2019" from the following site.

https://visualstudio.microsoft.com/downloads/
image

I also found this by reading the following article.
https://towardsdatascience.com/how-to-install-openai-gym-in-a-windows-environment-338969e24d30

I think if the readme was updated with this reference, this issue could be closed.

@leemorris
Copy link

leemorris commented Jan 12, 2020

@jamartinh - I needed to edit a file after installing Swig from here.

https://github.com/pybox2d/pybox2d/issues/106#issuecomment-535283336

@jkterry1
Copy link
Collaborator

I will accept PRs from the community for this, but almost everything should work for Windows and me and those helping maintain Gym don't have the ability to deal extend Gym to Windows ourselves. I'm going to close this issue for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests