Farama-Foundation / Arcade-Learning-Environment

The Arcade Learning Environment (ALE) -- a platform for AI research.
https://ale.farama.org/
GNU General Public License v2.0
2.18k stars 424 forks source link

Installation issue with Pybind11 #438

Closed JustinS6626 closed 2 years ago

JustinS6626 commented 3 years ago

Hi @JesseFarebro, this issue is an addendum to https://github.com/mgbellemare/Arcade-Learning-Environment/issues/430. I managed to resolve that one, but there is another problem now:

/tmp/ccVyzzL6.ltrans16.ltrans.o: In function `pybind11::tuple pybind11::cast<pybind11::tuple, 0>(pybind11::handle const&) [clone .isra.0]':
<artificial>:(.text+0x19ed): undefined reference to `PySequence_Tuple'
<artificial>:(.text+0x1a44): undefined reference to `_Py_Dealloc'
/tmp/ccVyzzL6.ltrans16.ltrans.o: In function `pybind11::handle::dec_ref() const & [clone .isra.0]':
<artificial>:(.text+0x7a1): undefined reference to `_Py_Dealloc'
collect2: error: ld returned 1 exit status
src/python/CMakeFiles/ale-py.dir/build.make:441: recipe for target 'src/python/_ale_py.cpython-38-x86_64-linux-gnu.so' failed
make[2]: *** [src/python/_ale_py.cpython-38-x86_64-linux-gnu.so] Error 1
CMakeFiles/Makefile2:353: recipe for target 'src/python/CMakeFiles/ale-py.dir/all' failed
make[1]: *** [src/python/CMakeFiles/ale-py.dir/all] Error 2
Makefile:159: recipe for target 'all' failed
make: *** [all] Error 2

I would really appreciate your help with this one as well. There are more lines in the output, but it is very long so I just added the ones that seemed most relevant.

JesseFarebro commented 3 years ago

Why do you need to enable Python support? I thought you wanted to use the C++ interface?

These issues are related to linking the Python development library. You need to install this on your system. The package should be something like python-devel or python3-devel.

JustinS6626 commented 2 years ago

I was actually hoping to implement my algorithm in python 3.8, but I needed SDL support in order to render the game screens. Based on the error message that I am getting, I think the problem is that ALE wants either an older or newer version of pybind11 than what I have. Which version of pybind11 did you have installed when you tested the latest version of ALE for python?

JesseFarebro commented 2 years ago

If you only want to use Python you can just use the ale-py package from PyPi. We package SDL with the library so there shouldn't be any issues using it. You can simply, pip install ale-py and start using the library.

The error you're getting when compiling from source has to do with how you're linking to pybind11. You shouldn't have to do anything to get pybind to work, we download the specific version for you using CMake (i.e., https://github.com/mgbellemare/Arcade-Learning-Environment/blob/0af0ff4a49a981d113c67b866fa152dbc7a1c0a7/src/python/CMakeLists.txt#L3-L8 ). If you've installed your own version then you've done something wrong. You shouldn't need to mess around with pybind at all when compiling from source.

JesseFarebro commented 2 years ago

I'm closing this as it's gone stale. @DarthMalloc if you require any further help feel free to update this thread.

JustinS6626 commented 1 year ago

Hi @JesseFarebro, I posted this thread quite a while back, and I am trying to install the Arcade Learning Environment for python3.8 with SDL support again, this time on another computer with Linux Mint 20.3. When I try to run the cmake build, I get the follow output:

cmake ../ -DCMAKE_BUILD_TYPE=Release -DSDL_SUPPORT=ON
CMake Error at /usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:146 (message):
  Could NOT find Python3 (missing: Development.Module) (found version
  "3.8.10")
Call Stack (most recent call first):
  /usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:393 (_FPHSA_FAILURE_MESSAGE)
  /usr/share/cmake-3.16/Modules/FindPython/Support.cmake:2214 (find_package_handle_standard_args)
  /usr/share/cmake-3.16/Modules/FindPython3.cmake:300 (include)
  src/python/CMakeLists.txt:1 (find_package)

-- Configuring incomplete, errors occurred!
See also "/home/justin/Arcade-Learning-Environment/build/CMakeFiles/CMakeOutput.log".
See also "/home/justin/Arcade-Learning-Environment/build/CMakeFiles/CMakeError.log".

This is occurring even though I have libpython3-dev installed. I would really appreciate any suggestions you have on how to fix this.