-
Notifications
You must be signed in to change notification settings - Fork 122
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
Cannot import dmlab2d_pybind on MacBook Pro Apple M1 #46
Comments
Hey, can you go to the directory where the wheel is in? You can install dmlab2d via pip. On my M1 Macbook, after compiling, I can install dmlab2d via pip: $ cd bazel-bin/dmlab2d
$ ll
_objs
dmlab2d-1.0-cp37-cp37m-macosx_10_16_x86_64.whlname
dmlab2d_pybind.so-2.params
dmlab2d-1.0-cp37-cp37m-macosx_10_16_x86_64.whl
dmlab2d_pybind.so
lib
$ pip install dmlab2d-1.0-cp37-cp37m-macosx_10_16_x86_64.whl Test it import dmlab2d
import dmlab2d.runfiles_helper
lab = dmlab2d.Lab2d(dmlab2d.runfiles_helper.find(), {"levelName": "chase_eat"})
env = dmlab2d.Environment(lab, ["WORLD.RGB"])
env.step({}) |
Hi, I have successfully installed dmlab2d and can do the test. However, after installing Melting Pot and using pytest to test the installation, my M1 chip says illegal hardware instruction, I wonder how you solve this problem. Thank you! |
Hey @YuhengHe, can you show more context? |
So in the Installation 3. Test the dmlab2d installation in python3, i ran the codes and here is the result: import dmlab2d
which, I assume, means that dmlab2d is successfully installed. Then moving on to 4. Install Melting Pot and I have this: Successfully installed dm-meltingpot-1.0.3. However, when I tried to execute pytest meltingpot, it gave me the following warning: ============================= test session starts ============================== So I was wondering if I have installed something wrong. Could you please share how you install the pakages and execute the program on your end? The information for installation on M1 chip is too limited :( Thank you! |
Did you try using |
#46 PiperOrigin-RevId: 456245065 Change-Id: I56456a30747e17494eafcd5e2e64beccc8133886
Also I see OP was using Lua 5.2 which doesn't work (see #24). |
HI, I tried
|
Hi @YuhengHe - thanks for reaching out! So I ran a fresh install via I was able to run all tests and got:
The only hiccup was that I had to install bazel first (via I did not modify Hope that helps! |
@akbir glad it worked out. @YuhengHe Just tried this out on my M1 mac in a clean venv, and Here's my tool versions:
|
#46 PiperOrigin-RevId: 456495902 Change-Id: Ia1e9f6645590b86942927cef54683d18e4103ed2
Hello @jagapiou I tried to fresh install meltingpot on a M1 Macbook pro. I ensured that I was using conda for M1 and I have the following tools versions
I am just running the
Do you know what can be causing it? |
This works for me:
I'm guessing that some part of your toolchain isn't arm64 so doesn't build
|
See google-deepmind/lab2d#19 for issues building |
Closing issue as cannot reproduce: meltingpot works for me on M1. It seems like the remaining issues are more with |
@jagapiou Just for the record, the problem was bazel. After ensuring that I was using an arm version of bazel, Meltingpot was installed and ran smoothly on my MAC M1 machine! Thank you for your support! |
Amazing, glad to hear it worked :-) |
Same issue on M1. I solved this issue by reading through previous comments. Thanks @jagapiou and @ManuelRios18 |
Hello again! Sorry for late reply, but the updated versions of "install.sh" and "setup.py" are perfect and solved all my initial issues. Thanks for all information shared above. There is only one remaining minor problem related to a missing folder when I want to test the functionality of meltingpot. First, I try this line of code: (meltingpot) asataryd@Aslans-MacBook-Pro meltingpot-main % pytest meltingpot and it gives the following error: collected 1218 items / 1 error ====================================================================== ERRORS ======================================================================= Then I try this line of code: pytest -n auto -ra --durations=10 meltingpot and it gives the following error: gw0 [1218] / gw1 [1218] / gw2 [1218] / gw3 [1218] / gw4 [1218] / gw5 [1218] / gw6 [1218] / gw7 [1218] The folder "assets/saved_models" is already missing in the meltingpot repository. Anyway I just wanted to see if any one of you have already tested meltingpot with the provided codes or not, and this is not a crucial issue. |
Thanks @manuel! It solved the problem! |
Hello all!
I am trying to install and run lab2d and meltingpot on my laptop:
Model Name: MacBook Pro
Model Identifier: MacBookPro17,1
Chip: Apple M1
Total Number of Cores: 8 (4 performance and 4 efficiency)
Memory: 16 GB
Here is the miniconda version:
(meltingpot) asataryd@Aslans-MacBook-Pro lab2d-main % python
Python 3.10.4 (main, Mar 31 2022, 03:37:37) [Clang 12.0.0 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
I installed lab2d via the following command:
(meltingpot) asataryd@Aslans-MacBook-Pro lab2d-main % bazel build -c opt --config=lua5_2 //dmlab2d:dmlab2d_wheel
INFO: Build option --//dmlab2d/lib/lua:lua_version has changed, discarding analysis cache.
INFO: Analyzed target //dmlab2d:dmlab2d_wheel (0 packages loaded, 1772 targets configured).
INFO: Found 1 target...
Target //dmlab2d:dmlab2d_wheel up-to-date:
bazel-bin/dmlab2d/dmlab2d-1.0-cp39-cp39-macosx_12_0_arm64.whl
bazel-bin/dmlab2d/dmlab2d-1.0-cp39-cp39-macosx_12_0_arm64.whlname
INFO: Elapsed time: 20.048s, Critical Path: 16.83s
INFO: 52 processes: 3 internal, 49 darwin-sandbox.
INFO: Build completed successfully, 52 total actions
Then when I try to import "dmlab2d" from inside "lab2d-main" folder, it gives the following error:
(meltingpot) asataryd@Aslans-MacBook-Pro lab2d-main % python
Python 3.9.12 (main, Apr 5 2022, 01:52:34)
[Clang 12.0.0 ] :: Anaconda, Inc. on darwin
Type "help", "copyright", "credits" or "license" for more information.
It seems the problem is related to the type of the "dmlab2d_pybind" file which is a c++ file.
However, I already installed gcc:
(meltingpot) asataryd@Aslans-MacBook-Pro lab2d-main % where gcc
/opt/homebrew/bin/gcc
/opt/homebrew/bin/gcc
/usr/bin/gcc
(meltingpot) asataryd@Aslans-MacBook-Pro lab2d-main % gcc --version
gcc (Homebrew GCC 11.3.0_2) 11.3.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Also, this is the content of the PATH file:
(meltingpot) asataryd@Aslans-MacBook-Pro lab2d-main % echo $PATH
/Users/asataryd/opt/miniconda3/bin:/Users/asataryd/opt/miniconda3/condabin:/Users/asataryd/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/local/sbin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/bin:/bin:/usr/sbin:/sbin
Additionally, this is the list of python modules installed in the environment:
(meltingpot) asataryd@Aslans-MacBook-Pro lab2d-main % conda list
packages in environment at /Users/asataryd/opt/miniconda3/envs/meltingpot:
Name Version Build Channel
absl-py 1.1.0 pypi_0 pypi
appnope 0.1.2 py310hca03da5_1001 anaconda
asttokens 2.0.5 pyhd3eb1b0_0 anaconda
backcall 0.2.0 pyhd3eb1b0_0 anaconda
bzip2 1.0.8 h620ffc9_4 anaconda
ca-certificates 2022.6.15 h4653dfc_0 conda-forge
certifi 2022.5.18.1 py310hca03da5_0
debugpy 1.5.1 py310hc377ac9_0 anaconda
decorator 5.1.1 pyhd3eb1b0_0 anaconda
dm-env 1.5 pypi_0 pypi
dm-tree 0.1.7 pypi_0 pypi
entrypoints 0.4 py310hca03da5_0 anaconda
executing 0.8.3 pyhd3eb1b0_0 anaconda
ipykernel 6.9.1 py310hca03da5_0 anaconda
ipython 8.2.0 py310hca03da5_0 anaconda
jedi 0.18.1 py310hca03da5_1 anaconda
jupyter_client 7.2.2 py310hca03da5_0 anaconda
jupyter_core 4.9.2 py310hca03da5_0 anaconda
libcxx 12.0.0 hf6beb65_1 anaconda
libffi 3.4.2 hc377ac9_2 anaconda
libsodium 1.0.18 h1a28f6b_0 anaconda
libzlib 1.2.12 ha287fd2_1 conda-forge
matplotlib-inline 0.1.2 pyhd3eb1b0_2 anaconda
ncurses 6.3 h1a28f6b_2 anaconda
nest-asyncio 1.5.5 py310hca03da5_0 anaconda
numpy 1.22.4 pypi_0 pypi
openssl 1.1.1o ha287fd2_0 conda-forge
packaging 21.3 pypi_0 pypi
parso 0.8.3 pyhd3eb1b0_0 anaconda
pexpect 4.8.0 pyhd3eb1b0_3 anaconda
pickleshare 0.7.5 pyhd3eb1b0_1003 anaconda
pip 22.1.2 pypi_0 pypi
prompt-toolkit 3.0.20 pyhd3eb1b0_0 anaconda
ptyprocess 0.7.0 pyhd3eb1b0_2 anaconda
pure_eval 0.2.2 pyhd3eb1b0_0 anaconda
pygments 2.11.2 pyhd3eb1b0_0 anaconda
pyparsing 3.0.9 pypi_0 pypi
python 3.10.4 hbdb9e5c_0 anaconda
python-dateutil 2.8.2 pyhd3eb1b0_0 anaconda
pyzmq 22.3.0 py310hc377ac9_2 anaconda
readline 8.1.2 h1a28f6b_1 anaconda
setuptools 61.2.0 py310hca03da5_0 anaconda
six 1.16.0 pyhd3eb1b0_1 anaconda
sqlite 3.38.2 h1058600_0 anaconda
stack_data 0.2.0 pyhd3eb1b0_0 anaconda
tk 8.6.11 hb8d0fd4_0 anaconda
tornado 6.1 py310h1a28f6b_0 anaconda
traitlets 5.1.1 pyhd3eb1b0_0 anaconda
tzdata 2022a hda174b7_0 anaconda
wcwidth 0.2.5 pyhd3eb1b0_0 anaconda
wheel 0.37.1 pyhd3eb1b0_0 anaconda
xz 5.2.5 h1a28f6b_0 anaconda
zeromq 4.3.4 hc377ac9_0 anaconda
zlib 1.2.12 ha287fd2_1 conda-forge
Very recently, I started to work with MacBook Pro Apple M1. Also, I am not that much expert in software issues. So I greatly appreciate any help. Also, I would be happy to share more information if you need.
The text was updated successfully, but these errors were encountered: