Kautenja / gym-super-mario-bros

An OpenAI Gym interface to Super Mario Bros. & Super Mario Bros. 2 (Lost Levels) on The NES

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't install on M1 MacBook?

slerman12 opened this issue · comments

When I run the pip command, I get:

Best match: nes-py 8.1.8
Processing nes_py-8.1.8.tar.gz
Writing /tmp/easy_install-scpbrqyb/nes_py-8.1.8/setup.cfg
Running nes_py-8.1.8/setup.py -q bdist_egg --dist-dir /tmp/easy_install-scpbrqyb/nes_py-8.1.8/egg-dist-tmp-8e0r2jpk
clang: error: the clang compiler does not support '-march=native'
error: Setup script exited with error: command '/usr/bin/g++' failed with exit code 1

Experiencing the same problem. Any news on when this will be fixed?

The error occurred when trying to build nes-py from source.

Here's how I installed nes-py on my M1 Mac.

git clone https://github.com/Kautenja/nes-py
cd nes-py

Open setup.py with your favorite editor.
And remove '-march=native' in the EXTRA_COMPILE_ARGS.

-EXTRA_COMPILE_ARGS = ['-std=c++1y', '-march=native', '-pipe', '-O3']
+EXTRA_COMPILE_ARGS = ['-std=c++1y', '-pipe', '-O3']

Build the wheel package and install it.

python3 setup.p bdist_wheel
pip install dist/nes_py-8.1.8-cp39-cp39-macosx_11_0_arm64.whl

Then you can install gym-super-mario-bros.

pip install gym-super-mario-bros
commented

The error occurred when trying to build nes-py from source.

Here's how I installed nes-py on my M1 Mac.

git clone https://github.com/Kautenja/nes-py
cd nes-py

Open setup.py with your favorite editor. And remove '-march=native' in the EXTRA_COMPILE_ARGS.

-EXTRA_COMPILE_ARGS = ['-std=c++1y', '-march=native', '-pipe', '-O3']
+EXTRA_COMPILE_ARGS = ['-std=c++1y', '-pipe', '-O3']

Build the wheel package and install it.

python3 setup.p bdist_wheel
pip install dist/nes_py-8.1.8-cp39-cp39-macosx_11_0_arm64.whl

Then you can install gym-super-mario-bros.

pip install gym-super-mario-bros

This works but it is not optimized for M1 chip. Instead you can change '-march=native' to '-mcpu=apple-m1'.