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

Running spinningup in Linux Subsystem on Windows (Success) #23

Closed
ibrahiminfinite opened this issue Nov 12, 2018 · 36 comments
Closed

Running spinningup in Linux Subsystem on Windows (Success) #23

ibrahiminfinite opened this issue Nov 12, 2018 · 36 comments

Comments

@ibrahiminfinite
Copy link
Contributor

ibrahiminfinite commented Nov 12, 2018

For people who are on windows 10 and do not have linux but want to make things work.

  1. you can enable the WSL in your windows 10 following this.
  2. Install Xming X window server for windows from here. and make sure it is running.
  3. Once WSL is working :
    Open cmd, type in "bash", this will switch the cmd to WSL terminal, then run the following it will enable GUI for WSL .
    Copied from this stackoverflow answer.
    sudo apt-get install x11-apps
    export DISPLAY=localhost:0.0 
    nano ~/.bashrc  #(add  export DISPLAY=localhost:0.0   at the end. Ctrl+X to exit/save)
    sudo apt-get install gnome-calculator #will get you GTK
  1. Download miniconda for linux from here. It will be an ".sh" file.
  2. from the terminal go to the folder you downloaded the file to and run "bash <name_of_downloaded_file>", this will install conda.
  3. follow the spinningup tutorial for rest of installation.
@ibrahiminfinite ibrahiminfinite changed the title Running spinningup on Linux Subsystem Windows (Success) Running spinningup in Linux Subsystem on Windows (Success) Nov 12, 2018
@jachiam
Copy link
Contributor

jachiam commented Nov 12, 2018

Awesome! Thanks for doing this. I've updated the installation page to reference this issue, so others can follow your instructions.

@jachiam jachiam closed this as completed Nov 12, 2018
@TheoryofEverthing
Copy link

Thanks!

@mikeydavison
Copy link

Works as advertised. I did have to install Open GL prior to running the animated examples though. The exact name of the package escapes me but it is explicitly mentioned in the error message that occurred when running the example. Fantastic work here. Thanks for sharing!

@debadeepta
Copy link

It was this package: sudo apt-get install python-opengl

@FernandoTN
Copy link

Thanks, so far so good.

@rastringer
Copy link

This is fantastic, thank you

@alanjfs
Copy link

alanjfs commented Feb 21, 2019

Has anyone tried using Microsoft's version of MPI?

@daniele-niero
Copy link

Awesome! Thanks for doing this. I've updated the installation page to reference this issue, so others can follow your instructions.

Spinning Up should also work on Windows though. Limiting its usage to Linux and Mac means shutting the door to many potential users, contributors and people that eager to learn.
Even if we all agree that Windows is a lesser system, we can't deny that is widely spread one, one that teaching material such as Spinning Up shouldn't ignore.

@zengzhi2015
Copy link

Thanks a lot for your suggestion. I have just one question left. If we install spinning up in this way on WSL, could we still use GPU-version Pytorch?

@kevin5k
Copy link

kevin5k commented Jun 13, 2019

First of all, its great you linked the WSL installation on SpinUp's page. I have git cloned and setup the latest Spinup in both my Conda environment (Win10) and Ubuntu (WSL). But despite following the Installation instructions diligently, I am having issues with executing the "installtest" program. An excerpt of the error message is attached below. On the other hand, it works perfectly fine on my native Linux machine.

=======================
This is the traceback message"
Traceback (most recent call last):
File "/home/dreamcore/Development/spinningup/spinup/utils/run_entrypoint.py", line 10, in
thunk = pickle.loads(zlib.decompress(base64.b64decode(args.encoded_thunk)))
ModuleNotFoundError: No module named 'spinup'"

Anyone advice?

@ibrahiminfinite
Copy link
Contributor Author

ibrahiminfinite commented Jun 13, 2019

Thanks a lot for your suggestion. I have just one question left. If we install spinning up in this way on WSL, could we still use GPU-version Pytorch?

I only tried running it on CPU, never tried GPU from WSL.
It @zengzhi2015 it would be great if you could test it out and let us know.

Edit : It looks like WSL does not support GPU by default.
someone has suggested a solution here

@zengzhi2015
Copy link

Thanks a lot for your suggestion. I have just one question left. If we install spinning up in this way on WSL, could we still use GPU-version Pytorch?

I only tried running it on CPU, never tried GPU from WSL.
It @zengzhi2015 it would be great if you could test it out and let us know.

Hi, it is sadly found that GPU pass through in WSL is currently NOT possible.
See this discussion.

Though there are some tricks to use GPU powered python programs in WSL, these programs are actually running in Windows. Thus, these tricks are useless for spinningup.
See this article.

@kevin5k
Copy link

kevin5k commented Jun 13, 2019

Thanks a lot for your suggestion. I have just one question left. If we install spinning up in this way on WSL, could we still use GPU-version Pytorch?

I only tried running it on CPU, never tried GPU from WSL.
It @zengzhi2015 it would be great if you could test it out and let us know.

Hi, it is sadly found that GPU pass through in WSL is currently NOT possible.
See this discussion.

Though there are some tricks to use GPU powered python programs in WSL, these programs are actually running in Windows. Thus, these tricks are useless for spinningup.
See this article.

Thanks for the info.

@ibrahiminfinite
Copy link
Contributor Author

First of all, its great you linked the WSL installation on SpinUp's page. I have git cloned and setup the latest Spinup in both my Conda environment (Win10) and Ubuntu (WSL). But despite following the Installation instructions diligently, I am having issues with executing the "installtest" program. An excerpt of the error message is attached below. On the other hand, it works perfectly fine on my native Linux machine.

=======================

This is the traceback message"
Traceback (most recent call last):
File "/home/dreamcore/Development/spinningup/spinup/utils/run_entrypoint.py", line 10, in
thunk = pickle.loads(zlib.decompress(base64.b64decode(args.encoded_thunk)))
ModuleNotFoundError: No module named 'spinup'"

Anyone advice?

Hi,
Is the issue solved ?
if not , which version of python are you using ?
Is the environment activated properly?
was there any errors during the installation procedures before "installtest" ?

@kevin5k
Copy link

kevin5k commented Jun 13, 2019

First of all, its great you linked the WSL installation on SpinUp's page. I have git cloned and setup the latest Spinup in both my Conda environment (Win10) and Ubuntu (WSL). But despite following the Installation instructions diligently, I am having issues with executing the "installtest" program. An excerpt of the error message is attached below. On the other hand, it works perfectly fine on my native Linux machine.

=======================

This is the traceback message"
Traceback (most recent call last):
File "/home/dreamcore/Development/spinningup/spinup/utils/run_entrypoint.py", line 10, in
thunk = pickle.loads(zlib.decompress(base64.b64decode(args.encoded_thunk)))
ModuleNotFoundError: No module named 'spinup'"
Anyone advice?

Hi,
Is the issue solved ?
if not , which version of python are you using ?
Is the environment activated properly?
was there any errors during the installation procedures before "installtest" ?

@ibrahiminfinite,

  • Am using python=3.6.8.
  • Am running the cpu version of tensorflow
  • Yes, my environment is activated when i executed the command
  • The only error is that they cannot find mujoco
  • I have also re-ran 'pip install' for spinup package but to no avail.

The only thing different between my native unix machine and my Windows is the former has an nvidia GPU; my windows machine is an intel NUC i7

@ibrahiminfinite
Copy link
Contributor Author

First of all, its great you linked the WSL installation on SpinUp's page. I have git cloned and setup the latest Spinup in both my Conda environment (Win10) and Ubuntu (WSL). But despite following the Installation instructions diligently, I am having issues with executing the "installtest" program. An excerpt of the error message is attached below. On the other hand, it works perfectly fine on my native Linux machine.

=======================

This is the traceback message"
Traceback (most recent call last):
File "/home/dreamcore/Development/spinningup/spinup/utils/run_entrypoint.py", line 10, in
thunk = pickle.loads(zlib.decompress(base64.b64decode(args.encoded_thunk)))
ModuleNotFoundError: No module named 'spinup'"
Anyone advice?

Hi,
Is the issue solved ?
if not , which version of python are you using ?
Is the environment activated properly?
was there any errors during the installation procedures before "installtest" ?

@ibrahiminfinite,

* Am using python=3.6.8.

* Am running the cpu version of tensorflow

* Yes, my environment is activated when i executed the command

* The only error is that they cannot find mujoco

* I have also re-ran 'pip install' for spinup package but to no avail.

The only thing different between my native unix machine and my Windows is the former has an nvidia GPU; my windows machine is an intel NUC i7

Hi @kevin5k
if you do not plan to use mujoco .
please remove 'mujoco-py<2.1,>=2.0' from 'install_requires' in setup.py file. and do 'pip install -e .' again, it should proceed without errors. Once that is done try running the installtest again.

@kevin5k
Copy link

kevin5k commented Jun 13, 2019

First of all, its great you linked the WSL installation on SpinUp's page. I have git cloned and setup the latest Spinup in both my Conda environment (Win10) and Ubuntu (WSL). But despite following the Installation instructions diligently, I am having issues with executing the "installtest" program. An excerpt of the error message is attached below. On the other hand, it works perfectly fine on my native Linux machine.

=======================

This is the traceback message"
Traceback (most recent call last):
File "/home/dreamcore/Development/spinningup/spinup/utils/run_entrypoint.py", line 10, in
thunk = pickle.loads(zlib.decompress(base64.b64decode(args.encoded_thunk)))
ModuleNotFoundError: No module named 'spinup'"
Anyone advice?

Hi,
Is the issue solved ?
if not , which version of python are you using ?
Is the environment activated properly?
was there any errors during the installation procedures before "installtest" ?

@ibrahiminfinite,

* Am using python=3.6.8.

* Am running the cpu version of tensorflow

* Yes, my environment is activated when i executed the command

* The only error is that they cannot find mujoco

* I have also re-ran 'pip install' for spinup package but to no avail.

The only thing different between my native unix machine and my Windows is the former has an nvidia GPU; my windows machine is an intel NUC i7

Hi @kevin5k
if you do not plan to use mujoco .
please remove 'mujoco-py<2.1,>=2.0' from 'install_requires' in setup.py file. and do 'pip install -e .' again, it should proceed without errors. Once that is done try running the installtest again.

@ibrahiminfinite,
As I encountered another issue on the Win10 version, I think it may be better if I create a separate thread on my issue - either later today or tomorrow.

@kevin5k
Copy link

kevin5k commented Jun 14, 2019

@ibrahiminfinite,

Thanks for your help. I discovered that the issue is possibly caused by nested activation of environments (unusual). I have since re-installed the spinningup in the proper environment and it works now in WSL-Ubuntu!!!

On a similar note, I encountered another issue regarding mpi4py and have managed to solved that too. For those interested, I have posted the mpi4py solution here. Hope it helps those.

@scooby359
Copy link

scooby359 commented Aug 12, 2019

I've follwed this guide today with Ubuntu on WSL and it mostly works, however trying to view the video with python -m spinup.run test_policy data/installtest/installtest_s0 causes Xming to crash, and so the python process fails as the display isn't available.

I've followed all the steps, and added sudo apt-get install python-opengl. I can view the results plotted as a graph, and can seperately run other apps, like xclock. Xming doesn't leave any log file when it crashes, so I can't find the error from there.

Any suggestions?

@sytelus
Copy link

sytelus commented Aug 28, 2019

Here's slightly cleaned up version:

LINE="export DISPLAY=:0"
FILE=~/.bashrc
grep -q "$LINE" "$FILE" || echo "$LINE" >> "$FILE"
sudo apt-get -y install gnome-calculator #will get you GTK

curl -O https://repo.anaconda.com/archive/Anaconda3-2019.07-Linux-x86_64.sh
bash Anaconda3-2019.07-Linux-x86_64.sh
source ~/.bashrc
conda create --yes -n p36 python=3.6
conda activate p36

sudo apt-get install python-opengl

Make sure to install xming.

@sahiljain11
Copy link

Mine worked like a charm. Thank you!

@Brownbull
Copy link

Done here too on Windows 10 Pro.

@clearsense
Copy link

clearsense commented Feb 12, 2020

All works for me except video rendering:

  1. python -m spinup.run ppo --hid "[32,32]" --env LunarLander-v2 --exp_name installtest --gamma 0.999 - OK
  2. python -m spinup.run plot data/installtest/installtest_s0 - OK
  3. python -m spinup.run test_policy data/installtest/installtest_s0
    Error:
Loading from data/installtest/installtest_s0/pyt_save/model.pt.


/home/vlad/miniconda3/envs/spinningup/lib/python3.6/site-packages/gym/logger.py:30: UserWarning: WARN: Box bound precision lowered by casting to float32
  warnings.warn(colorize('%s: %s'%('WARN', msg % args), 'yellow'))
Logging data to /tmp/experiments/1581531018/progress.txt
XIO:  fatal IO error 11 (Resource temporarily unavailable) on X server "localhost:0.0"
      after 140 requests (134 known processed) with 0 events remaining.
Traceback (most recent call last):
  File "/home/vlad/miniconda3/envs/spinningup/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/home/vlad/miniconda3/envs/spinningup/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/vlad/spinningup/spinup/run.py", line 243, in <module>
    subprocess.check_call(args, env=os.environ)
  File "/home/vlad/miniconda3/envs/spinningup/lib/python3.6/subprocess.py", line 311, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/home/vlad/miniconda3/envs/spinningup/bin/python', '/home/vlad/spinningup/spinup/utils/test_policy.py', 'data/installtest/installtest_s0']' returned non-zero exit status 1.

And Xming get crached after this.
Runned in ubuntu console on Win10.
Maybe someone could help?

@ibrahiminfinite
Copy link
Contributor Author

@clearsense
Was the issue resolved ?

@clearsense
Copy link

@clearsense
Was the issue resolved ?

It worked only once, maybe after install and run other graphical linux app.
I give up on resolving after that. Later I plan to install Arch and use it there.

@rayanelhelou
Copy link

@clearsense
Was the issue resolved ?

I have the same issue .. Training with plot completes, but no render of video. Instead a black screen shows up for several seconds then closes. Is there a way to somehow export the results to view externally? Otherwise, can you please help with a fix?

Using Ubuntu 18.04 LTS on Windows 10.

@Jamesohare1
Copy link

@clearsense @rayanelhelou Same issue for me too, did you find a solution?

@clearsense
Copy link

@clearsense @rayanelhelou Same issue for me too, did you find a solution?

No

@Jamesohare1
Copy link

@clearsense @rayanelhelou

The following fixed this for me

Run "export DISPLAY=:0.0" in WSL

Then restart WSL and all worked fine

@clearsense
Copy link

@Jamesohare1 nope, not worked for me. I also tried add export DISPLAY=:0.0 to .bashrc and restart WSL - also don't work. When I run gnome-calculator i get error:

Unable to init server: Could not connect: Connection refused                                                                                                                                                                                    (gnome-calculator:72): Gtk-WARNING **: 14:42:19.115: cannot open display: :0.0

Maybe this error could be fixed other way, but I don't use spinningup for now.

@sephirxth
Copy link

sephirxth commented Apr 22, 2020

@joaomacp @ibrahiminfinite @clearsense

All works for me except video rendering:

  1. python -m spinup.run ppo --hid "[32,32]" --env LunarLander-v2 --exp_name installtest --gamma 0.999 - OK
  2. python -m spinup.run plot data/installtest/installtest_s0 - OK
  3. python -m spinup.run test_policy data/installtest/installtest_s0
    Error:
Loading from data/installtest/installtest_s0/pyt_save/model.pt.


/home/vlad/miniconda3/envs/spinningup/lib/python3.6/site-packages/gym/logger.py:30: UserWarning: WARN: Box bound precision lowered by casting to float32
  warnings.warn(colorize('%s: %s'%('WARN', msg % args), 'yellow'))
Logging data to /tmp/experiments/1581531018/progress.txt
XIO:  fatal IO error 11 (Resource temporarily unavailable) on X server "localhost:0.0"
      after 140 requests (134 known processed) with 0 events remaining.
Traceback (most recent call last):
  File "/home/vlad/miniconda3/envs/spinningup/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/home/vlad/miniconda3/envs/spinningup/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/vlad/spinningup/spinup/run.py", line 243, in <module>
    subprocess.check_call(args, env=os.environ)
  File "/home/vlad/miniconda3/envs/spinningup/lib/python3.6/subprocess.py", line 311, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/home/vlad/miniconda3/envs/spinningup/bin/python', '/home/vlad/spinningup/spinup/utils/test_policy.py', 'data/installtest/installtest_s0']' returned non-zero exit status 1.

And Xming get crached after this.
Runned in ubuntu console on Win10.
Maybe someone could help?

Same issue

  1. sudo apt-get install python-opengl

  2. install this version of xserver.
    https://sourceforge.net/projects/vcxsrv/

  3. Run export DISPLAY=localhost:0.0 in WSL.

It works for me.

@TravisCao
Copy link

@sephirxth It works for me! Previous problems about returning the black screen of in Xming resolved! Thanks a lot!

@borninfreedom
Copy link

For people who are on windows 10 and do not have linux but want to make things work.

  1. you can enable the WSL in your windows 10 following this.
  2. Install Xming X window server for windows from here. and make sure it is running.
  3. Once WSL is working :
    Open cmd, type in "bash", this will switch the cmd to WSL terminal, then run the following it will enable GUI for WSL .
    Copied from this stackoverflow answer.
    sudo apt-get install x11-apps
    export DISPLAY=localhost:0.0 
    nano ~/.bashrc  #(add  export DISPLAY=localhost:0.0   at the end. Ctrl+X to exit/save)
    sudo apt-get install gnome-calculator #will get you GTK
  1. Download miniconda for linux from here. It will be an ".sh" file.
  2. from the terminal go to the folder you downloaded the file to and run "bash <name_of_downloaded_file>", this will install conda.
  3. follow the spinningup tutorial for rest of installation.

The method is useful for WSL1, but not working with WSL2, because WSL2 has it's own IP address, so export DISPLAY=localhost:0.0 will not work.

The method for installing a GUI window for WSL1 and WSL2 with xfce4 desktop can be found at https://blog.csdn.net/bornfree5511/article/details/108632513. Sorry for that it doesn't have an English version, maybe you can use google translation.

And after win10 build 20145 version, you can try a GPU support with WSL2, it can be used to train neural networks. The version after 20145 can be get by open the insider preview. And these days (9-27-2020) , I don't recommed to upgrade, cause the latest version is 20211, and it break the wsl down.

@marginloop
Copy link

To add to the thread, this resolved my issues.

I had to run apt-get update to update the WSL ubuntu package listing:

sudo apt-get update

Then I had to add the miniconda3 bin folder to the path for minianaconda to work:

nano ~/.bashrc 
export PATH=/path/to/miniconda3/bin:$PATH

@Aniruddha120
Copy link

Has anyone tried using Microsoft's version of MPI?

whats you feedback? is it good?

@jack-ning080
Copy link

@joaomacp @ibrahiminfinite @clearsense

All works for me except video rendering:

  1. python -m spinup.run ppo --hid "[32,32]" --env LunarLander-v2 --exp_name installtest --gamma 0.999 - OK
  2. python -m spinup.run plot data/installtest/installtest_s0 - OK
  3. python -m spinup.run test_policy data/installtest/installtest_s0
    Error:
Loading from data/installtest/installtest_s0/pyt_save/model.pt.


/home/vlad/miniconda3/envs/spinningup/lib/python3.6/site-packages/gym/logger.py:30: UserWarning: WARN: Box bound precision lowered by casting to float32
  warnings.warn(colorize('%s: %s'%('WARN', msg % args), 'yellow'))
Logging data to /tmp/experiments/1581531018/progress.txt
XIO:  fatal IO error 11 (Resource temporarily unavailable) on X server "localhost:0.0"
      after 140 requests (134 known processed) with 0 events remaining.
Traceback (most recent call last):
  File "/home/vlad/miniconda3/envs/spinningup/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/home/vlad/miniconda3/envs/spinningup/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/vlad/spinningup/spinup/run.py", line 243, in <module>
    subprocess.check_call(args, env=os.environ)
  File "/home/vlad/miniconda3/envs/spinningup/lib/python3.6/subprocess.py", line 311, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/home/vlad/miniconda3/envs/spinningup/bin/python', '/home/vlad/spinningup/spinup/utils/test_policy.py', 'data/installtest/installtest_s0']' returned non-zero exit status 1.

And Xming get crached after this.
Runned in ubuntu console on Win10.
Maybe someone could help?

Same issue

  1. sudo apt-get install python-opengl
  2. install this version of xserver.
    https://sourceforge.net/projects/vcxsrv/
  3. Run export DISPLAY=localhost:0.0 in WSL.

It works for me.

It works for me too, I used Xming before. thank you

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