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 WSL2 with WSLg on Windows (Success) #377

Open
ghost opened this issue Nov 14, 2022 · 2 comments
Open

Running spinningup in WSL2 with WSLg on Windows (Success) #377

ghost opened this issue Nov 14, 2022 · 2 comments

Comments

@ghost
Copy link

ghost commented Nov 14, 2022

Don't know if this has been detailed before, but I have gotten spinningup to work on WSL2 on windows without needing to install a X server for X11 forwarding. If you didn't know, WSL2 has WSLg which allows for you to run GUI apps in WSL.

First make sure you have WSL2 enabled in your system, you can check by using: wsl -l -v in cmd/powershell. To upgrade to WSL2, issue the command wsl --set-version <distro name> 2 replacing <distro name> with the name of the distribution you want to upgrade.

Next, install the vGPU driver for Ubuntu by following this link here. At the time of this post, the cuda version was 11.8, this will be important later on.

Install miniconda by downloading the .sh from here. Personally, I use pyenv which you can check out here. If you run into any dependency issues creating your virtualenv you might need to find one with python=3.6 support.

Follow spinningup for the rest of the installation.

Here is where we need to potentially fix things. If you encounter no errors, then maybe the issues were patched out. However, when trying to watch the trained policy you might encounter this error:

ImportError:
    Error occurred while running `from pyglet.gl import *`
    HINT: make sure you have OpenGL install. On Ubuntu, you can run 'apt-get install python-opengl'.
    If you're running on a server, you may need a virtual frame buffer; something like this should work:
    'xvfb-run -s "-screen 0 1400x900x24" python <your_script.py>'

To fix this issue, install an OpenGL library. The python-opengl library may not be present in your Ubuntu WSL distro, but you can install sudo apt install freeglut3-dev

You might also encounter another error:

libGL error: MESA-LOADER: failed to open swrast: /usr/lib/dri/swrast_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
libGL error: failed to load driver: swrast

Most likely this is due to the anaconda/miniconda install having too old of an GLIBCXX binary (even if your system has a new one). We can check this by exporting this variable: export LIBGL_DEBUG=verbose and running the command again. If we see:

libGL: MESA-LOADER: failed to open /usr/lib/x86_64-linux-gnu/dri/swrast_dri.so: /home/dev/.pyenv/versions/miniconda3-latest/envs/su/bin/../lib/libstdc++.so.6: version `GLIBCXX_3.4.30' not found (required by /lib/x86_64-linux-gnu/libLLVM-13.so.1)

Then we can fix this by symlinking our systems GLIBCXX to conda distribution by executing:

ln -s -f /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.30 $CONDA_PREFIX/lib/libstdc++.so.6

If everything works you should see the training video when running the command again.

@ZzzzzzS
Copy link

ZzzzzzS commented Aug 21, 2023

That solved my problem, thanks a lot!

@richard-agbeyibor
Copy link

Thank you :-D

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

2 participants