Kautenja / gym-super-mario-bros

An OpenAI Gym interface to Super Mario Bros. & Super Mario Bros. 2 (Lost Levels) on The NES
Other
678 stars 133 forks source link

Can't install on M1 MacBook? #106

Closed slerman12 closed 2 years ago

slerman12 commented 2 years ago

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
lucasschoenhold commented 2 years ago

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

mshr-h commented 2 years ago

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
Rus00 commented 2 years ago

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'.

Kautenja commented 2 years ago

Resolved in https://github.com/Kautenja/nes-py/pull/79