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

free-mujoco-py on PyPi with included binaries #1

Closed
wants to merge 26 commits into from

Conversation

vwxyzjn
Copy link

@vwxyzjn vwxyzjn commented Oct 25, 2021

To help with the transition and offer alternatives, I have made a temporary mujoco-py release named free-mujoco-py on PyPi using @nimrod-gileadi's PR (see openai#640) that leverages the new free MuJoCo binaries. Try executing

python -m venv venv
source venv/bin/activate
pip install gym
pip install free-mujoco-py
python -c "import mujoco_py;import gym;env=gym.make('HalfCheetah-v2')"

asciicast

The source code is at #1. For convenience, the release automatically includes the MuJoCo binaries so there's no need to download it. At this point, it should only work with Linux, but could work out-of-the-box for Mac and maybe windows, I just don't have the machines to test it out.

&& rm mujoco.tar.gz

mkdir -p mujoco_py/binaries/windows \
&& wget https://mujoco.org/download/mujoco210-windows-x86_64.zip -O mujoco.tar.gz \
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Windows file is zip rather than tar.gz.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the catch! Just fixed. I will see if I can make the build work on macos

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Windows support has been DEPRECATED and removed in 2.0.2.0" according to mujoco-py readme...

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I don’t have a convenient way to test it out on windows and intel mac…

@vwxyzjn
Copy link
Author

vwxyzjn commented Oct 25, 2021

I did a quick investigation into the macos build using my m1 mac mini. A couple thing is I needed to install gcc@7 using the rosetta 2 shell (openai#601).

# run this in rosetta 2 shell
/usr/local/Homebrew/bin/brew install gcc@7

I ended up getting this error similar to openai#605. But maybe this is gonna work for intel macs. In any case, probably waiting for upstream changes (google-deepmind/mujoco#2)

costahuang@Costas-Mac-mini mujoco-py % poetry run python
Python 3.9.5 (default, Jul 28 2021, 11:55:01) 
[Clang 13.0.0 (clang-1300.0.27.3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import mujoco_py
Compiling /Users/costahuang/go/src/github.com/vwxyzjn/mujoco-py/mujoco_py/cymj.pyx because it changed.
[1/1] Cythonizing /Users/costahuang/go/src/github.com/vwxyzjn/mujoco-py/mujoco_py/cymj.pyx
running build_ext
building 'mujoco_py.cymj' extension
creating /Users/costahuang/go/src/github.com/vwxyzjn/mujoco-py/mujoco_py/generated/_pyxbld_2.0.2.13_39_macextensionbuilder
creating /Users/costahuang/go/src/github.com/vwxyzjn/mujoco-py/mujoco_py/generated/_pyxbld_2.0.2.13_39_macextensionbuilder/temp.macosx-12.0-x86_64-3.9
creating /Users/costahuang/go/src/github.com/vwxyzjn/mujoco-py/mujoco_py/generated/_pyxbld_2.0.2.13_39_macextensionbuilder/temp.macosx-12.0-x86_64-3.9/Users
creating /Users/costahuang/go/src/github.com/vwxyzjn/mujoco-py/mujoco_py/generated/_pyxbld_2.0.2.13_39_macextensionbuilder/temp.macosx-12.0-x86_64-3.9/Users/costahuang
creating /Users/costahuang/go/src/github.com/vwxyzjn/mujoco-py/mujoco_py/generated/_pyxbld_2.0.2.13_39_macextensionbuilder/temp.macosx-12.0-x86_64-3.9/Users/costahuang/go
creating /Users/costahuang/go/src/github.com/vwxyzjn/mujoco-py/mujoco_py/generated/_pyxbld_2.0.2.13_39_macextensionbuilder/temp.macosx-12.0-x86_64-3.9/Users/costahuang/go/src
creating /Users/costahuang/go/src/github.com/vwxyzjn/mujoco-py/mujoco_py/generated/_pyxbld_2.0.2.13_39_macextensionbuilder/temp.macosx-12.0-x86_64-3.9/Users/costahuang/go/src/github.com
creating /Users/costahuang/go/src/github.com/vwxyzjn/mujoco-py/mujoco_py/generated/_pyxbld_2.0.2.13_39_macextensionbuilder/temp.macosx-12.0-x86_64-3.9/Users/costahuang/go/src/github.com/vwxyzjn
creating /Users/costahuang/go/src/github.com/vwxyzjn/mujoco-py/mujoco_py/generated/_pyxbld_2.0.2.13_39_macextensionbuilder/temp.macosx-12.0-x86_64-3.9/Users/costahuang/go/src/github.com/vwxyzjn/mujoco-py
creating /Users/costahuang/go/src/github.com/vwxyzjn/mujoco-py/mujoco_py/generated/_pyxbld_2.0.2.13_39_macextensionbuilder/temp.macosx-12.0-x86_64-3.9/Users/costahuang/go/src/github.com/vwxyzjn/mujoco-py/mujoco_py
creating /Users/costahuang/go/src/github.com/vwxyzjn/mujoco-py/mujoco_py/generated/_pyxbld_2.0.2.13_39_macextensionbuilder/temp.macosx-12.0-x86_64-3.9/Users/costahuang/go/src/github.com/vwxyzjn/mujoco-py/mujoco_py/gl
/usr/local/bin/gcc-7 -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -DONMAC -Imujoco_py -I/Users/costahuang/go/src/github.com/vwxyzjn/mujoco-py/mujoco_py -I/Users/costahuang/go/src/github.com/vwxyzjn/mujoco-py/mujoco_py/binaries/macos/mujoco210/include -I/Users/costahuang/Library/Caches/pypoetry/virtualenvs/free-mujoco-py-635KI1VO-py3.9/lib/python3.9/site-packages/numpy/core/include -I/Users/costahuang/Library/Caches/pypoetry/virtualenvs/free-mujoco-py-635KI1VO-py3.9/include -I/Users/costahuang/.pyenv/versions/3.9.5/include/python3.9 -c /Users/costahuang/go/src/github.com/vwxyzjn/mujoco-py/mujoco_py/cymj.c -o /Users/costahuang/go/src/github.com/vwxyzjn/mujoco-py/mujoco_py/generated/_pyxbld_2.0.2.13_39_macextensionbuilder/temp.macosx-12.0-x86_64-3.9/Users/costahuang/go/src/github.com/vwxyzjn/mujoco-py/mujoco_py/cymj.o -fopenmp -w
gcc-7: warning: couldn't understand version 12.0

/usr/local/bin/gcc-7 -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -DONMAC -Imujoco_py -I/Users/costahuang/go/src/github.com/vwxyzjn/mujoco-py/mujoco_py -I/Users/costahuang/go/src/github.com/vwxyzjn/mujoco-py/mujoco_py/binaries/macos/mujoco210/include -I/Users/costahuang/Library/Caches/pypoetry/virtualenvs/free-mujoco-py-635KI1VO-py3.9/lib/python3.9/site-packages/numpy/core/include -I/Users/costahuang/Library/Caches/pypoetry/virtualenvs/free-mujoco-py-635KI1VO-py3.9/include -I/Users/costahuang/.pyenv/versions/3.9.5/include/python3.9 -c /Users/costahuang/go/src/github.com/vwxyzjn/mujoco-py/mujoco_py/gl/dummyshim.c -o /Users/costahuang/go/src/github.com/vwxyzjn/mujoco-py/mujoco_py/generated/_pyxbld_2.0.2.13_39_macextensionbuilder/temp.macosx-12.0-x86_64-3.9/Users/costahuang/go/src/github.com/vwxyzjn/mujoco-py/mujoco_py/gl/dummyshim.o -fopenmp -w
gcc-7: warning: couldn't understand version 12.0

creating /Users/costahuang/go/src/github.com/vwxyzjn/mujoco-py/mujoco_py/generated/_pyxbld_2.0.2.13_39_macextensionbuilder/lib.macosx-12.0-x86_64-3.9
creating /Users/costahuang/go/src/github.com/vwxyzjn/mujoco-py/mujoco_py/generated/_pyxbld_2.0.2.13_39_macextensionbuilder/lib.macosx-12.0-x86_64-3.9/mujoco_py
/usr/local/bin/gcc-7 -bundle -undefined dynamic_lookup -L/usr/local/opt/readline/lib -L/usr/local/opt/readline/lib -L/Users/costahuang/.pyenv/versions/3.9.5/lib -L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/readline/lib -L/Users/costahuang/.pyenv/versions/3.9.5/lib -L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib /Users/costahuang/go/src/github.com/vwxyzjn/mujoco-py/mujoco_py/generated/_pyxbld_2.0.2.13_39_macextensionbuilder/temp.macosx-12.0-x86_64-3.9/Users/costahuang/go/src/github.com/vwxyzjn/mujoco-py/mujoco_py/cymj.o /Users/costahuang/go/src/github.com/vwxyzjn/mujoco-py/mujoco_py/generated/_pyxbld_2.0.2.13_39_macextensionbuilder/temp.macosx-12.0-x86_64-3.9/Users/costahuang/go/src/github.com/vwxyzjn/mujoco-py/mujoco_py/gl/dummyshim.o -L/Users/costahuang/go/src/github.com/vwxyzjn/mujoco-py/mujoco_py/binaries/macos/mujoco210/bin -L/Users/costahuang/go/src/github.com/vwxyzjn/mujoco-py/mujoco_py/binaries/macos/mujoco210/bin -lmujoco210 -lglfw.3 -o /Users/costahuang/go/src/github.com/vwxyzjn/mujoco-py/mujoco_py/generated/_pyxbld_2.0.2.13_39_macextensionbuilder/lib.macosx-12.0-x86_64-3.9/mujoco_py/cymj.cpython-39-darwin.so -fopenmp
gcc-7: warning: couldn't understand version 12.0

ld: warning: object file (/Users/costahuang/go/src/github.com/vwxyzjn/mujoco-py/mujoco_py/generated/_pyxbld_2.0.2.13_39_macextensionbuilder/temp.macosx-12.0-x86_64-3.9/Users/costahuang/go/src/github.com/vwxyzjn/mujoco-py/mujoco_py/gl/dummyshim.o) was built for newer macOS version (12.0) than being linked (10.4)
ld: warning: object file (/Users/costahuang/go/src/github.com/vwxyzjn/mujoco-py/mujoco_py/generated/_pyxbld_2.0.2.13_39_macextensionbuilder/temp.macosx-12.0-x86_64-3.9/Users/costahuang/go/src/github.com/vwxyzjn/mujoco-py/mujoco_py/cymj.o) was built for newer macOS version (12.0) than being linked (10.4)
ld: warning: dylib (/Users/costahuang/go/src/github.com/vwxyzjn/mujoco-py/mujoco_py/binaries/macos/mujoco210/bin/libmujoco210.dylib) was built for newer macOS version (10.15) than being linked (10.4)
ld: warning: dylib (/Users/costahuang/go/src/github.com/vwxyzjn/mujoco-py/mujoco_py/binaries/macos/mujoco210/bin/libglfw.3.dylib) was built for newer macOS version (10.11) than being linked (10.4)
ld: warning: dylib (/usr/local/Cellar/gcc@7/7.5.0_4/lib/gcc/7/libgomp.dylib) was built for newer macOS version (10.16.3) than being linked (10.4)
zsh: illegal hardware instruction  poetry run python

@nimrod-gileadi
Copy link
Owner

Apologies I didn't get to review this change - I didn't think mujoco-py were going to accept my PR.

I guess you could send this directly to the mujoco-py project.

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