Open merak0514 opened 1 year ago
I am getting the same issue on linux with pip install magent2
command
pip version: 23.1.2
linux version: Ubuntu 20.04.4 LTS
Collecting magent2
Using cached magent2-0.3.2.tar.gz (4.1 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... error
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> [19 lines of output]
Traceback (most recent call last):
File "/home/yungisimon/anaconda3/envs/Farama_Hetero/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
main()
File "/home/yungisimon/anaconda3/envs/Farama_Hetero/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/yungisimon/anaconda3/envs/Farama_Hetero/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
return hook(config_settings)
^^^^^^^^^^^^^^^^^^^^^
File "/tmp/pip-build-env-ycn_xn10/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 341, in get_requires_for_build_wheel
return self._get_build_requires(config_settings, requirements=['wheel'])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/tmp/pip-build-env-ycn_xn10/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 323, in _get_build_requires
self.run_setup()
File "/tmp/pip-build-env-ycn_xn10/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 338, in run_setup
exec(code, locals())
File "<string>", line 116, in <module>
File "<string>", line 21, in get_version
FileNotFoundError: [Errno 2] No such file or directory: 'magent2/__init__.py'
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
failed to compile from source, with python3 setup.py install
as well.
python3 setup.py install
Sorry for the delay on this issue, but I think this is now fixed. Editable mode (pip install -e .
) still has some issues due to CMake which I'm not well versed enough to be able to fix, but running python3 setup.py install
should work now. Installing locally via pip install .
also works.
If you are interested in helping out further we would love to have extra hands helping with making proper testing to ensure things like this work (on other farama projects our CI installs on different python versions on linux and mac osx to ensure things work as intended). This project doesn't currently have any testing through pytest
either, but that requires domain knowledge of the library, which I unfortunately do not have, and the other previous maintainers haven't had much time to get around to it.
python3 setup.py install
Sorry for the delay on this issue, but I think this is now fixed. Editable mode (
pip install -e .
) still has some issues due to CMake which I'm not well versed enough to be able to fix, but runningpython3 setup.py install
should work now. Installing locally viapip install .
also works.If you are interested in helping out further we would love to have extra hands helping with making proper testing to ensure things like this work (on other farama projects our CI installs on different python versions on linux and mac osx to ensure things work as intended). This project doesn't currently have any testing through
pytest
either, but that requires domain knowledge of the library, which I unfortunately do not have, and the other previous maintainers haven't had much time to get around to it.
I installed successfully using pip install .
, but still got the following error message when executing from magent2.environments import battle_v4
:
from magent2.environments import battle_v4 Traceback (most recent call last): File "
", line 1, in File "/Users/xxx/CodeProject/MARL/MAgent2/magent2/init.py", line 1, in from magent2 import gridworld, utility File "/Users/xxx/CodeProject/MARL/MAgent2/magent2/gridworld.py", line 10, in from magent2.c_lib import _LIB, as_float_c_array, as_int32_c_array File "/Users/xxx/CodeProject/MARL/MAgent2/magent2/c_lib.py", line 43, in _LIB = _load_lib() File "/Users/xxx/CodeProject/MARL/MAgent2/magent2/c_lib.py", line 22, in _load_lib lib = ctypes.CDLL(path_to_so_file, ctypes.RTLD_GLOBAL) File "/Users/xxx/anaconda3/envs/marl/lib/python3.8/ctypes/init.py", line 373, in init self._handle = _dlopen(self._name, mode) OSError: dlopen(/Users/xxx/CodeProject/MARL/MAgent2/magent2/libmagent.dylib, 0x000A): tried: '/Users/xxx/CodeProject/MARL/MAgent2/magent2/libmagent.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/xxx/CodeProject/MARL/MAgent2/magent2/libmagent.dylib' (no such file), '/Users/xxx/CodeProject/MARL/MAgent2/magent2/libmagent.dylib' (no such file)
I wonder if there are any solutions to this? thx.
Again I’m not a domain expert but it appears that the installation process involves copying the “libmagent” file in the build folder, explained here: https://github.com/Farama-Foundation/MAgent2/blob/d4ec94d243c1fe3fdeb3dc45a366637504127afa/setup.py#L15 and done for Linux here: https://github.com/Farama-Foundation/MAgent2/blob/d4ec94d243c1fe3fdeb3dc45a366637504127afa/.github/workflows/gh-pages.yml#L27
It seems that that libmagent file has a different extension (.so) on Linux and .dylib on MacOS, as seen here: https://github.com/Farama-Foundation/MAgent2/blob/d4ec94d243c1fe3fdeb3dc45a366637504127afa/magent2/c_lib.py#L15
TLDR look for that file it says is missing, and copy it to the place where it is looking for it.
I think this should be something that can be fixed in the setup.py or elsewhere, but maybe it’s a manual process. I will leave fixing this to someone better versed in c++ as I am quite unfamiliar. FWIW the way I found those links above was just searching this repo for the file in the error, if in doubt you can usually figure things like that out in the same way yourself if someone like me isn’t able to respond quickly
When running
pip install magent2
I get the result