google-deepmind / open_spiel

OpenSpiel is a collection of environments and algorithms for research in general reinforcement learning and search/planning in games.
Apache License 2.0
4.24k stars 933 forks source link

pybind11 error #1256

Closed PawBlo closed 3 months ago

PawBlo commented 3 months ago

I get error with pybind11 when I try build Open_spiel from source. Error:

In file included from /home/pawel/Desktop/open_spiel/my_open_spiel/open_spiel/../open_spiel/python/pybind11/algorithms_trajectories.h:18:
/home/pawel/Desktop/open_spiel/my_open_spiel/open_spiel/../open_spiel/python/pybind11/pybind11.h:34:10: fatal error: 'pybind11/include/pybind11/detail/smart_holder_type_casters.h' file not found
   34 | #include "pybind11/include/pybind11/detail/smart_holder_type_casters.h"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/pawel/Desktop/open_spiel/my_open_spiel/open_spiel/python/pybind11/algorithms_corr_dist.cc:15:
In file included from /home/pawel/Desktop/open_spiel/my_open_spiel/open_spiel/../open_spiel/python/pybind11/algorithms_corr_dist.h:18:
/home/pawel/Desktop/open_spiel/my_open_spiel/open_spiel/../open_spiel/python/pybind11/pybind11.h:34:10: fatal error: 'pybind11/include/pybind11/detail/smart_holder_type_casters.h' file not found
   34 | #include "pybind11/include/pybind11/detail/smart_holder_type_casters.h"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/pawel/Desktop/open_spiel/my_open_spiel/open_spiel/python/pybind11/games_backgammon.cc:15:
In file included from /home/pawel/Desktop/open_spiel/my_open_spiel/open_spiel/../open_spiel/python/pybind11/games_backgammon.h:18:
/home/pawel/Desktop/open_spiel/my_open_spiel/open_spiel/../open_spiel/python/pybind11/pybind11.h:34:10: fatal error: 'pybind11/include/pybind11/detail/smart_holder_type_casters.h' file not found
   34 | #include "pybind11/include/pybind11/detail/smart_holder_type_casters.h"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/pawel/Desktop/open_spiel/my_open_spiel/open_spiel/python/pybind11/bots.cc:15:
In file included from /home/pawel/Desktop/open_spiel/my_open_spiel/open_spiel/../open_spiel/python/pybind11/bots.h:18:
/home/pawel/Desktop/open_spiel/my_open_spiel/open_spiel/../open_spiel/python/pybind11/pybind11.h:34:10: fatal error: 'pybind11/include/pybind11/detail/smart_holder_type_casters.h' file not found
   34 | #include "pybind11/include/pybind11/detail/smart_holder_type_casters.h"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/pawel/Desktop/open_spiel/my_open_spiel/open_spiel/python/pybind11/games_bridge.cc:15:
In file included from /home/pawel/Desktop/open_spiel/my_open_spiel/open_spiel/../open_spiel/python/pybind11/games_bridge.h:18:
/home/pawel/Desktop/open_spiel/my_open_spiel/open_spiel/../open_spiel/python/pybind11/pybind11.h:34:10: fatal error: 'pybind11/include/pybind11/detail/smart_holder_type_casters.h' file not found
   34 | #include "pybind11/include/pybind11/detail/smart_holder_type_casters.h"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/pawel/Desktop/open_spiel/my_open_spiel/open_spiel/python/pybind11/games_bargaining.cc:15:
In file included from /home/pawel/Desktop/open_spiel/my_open_spiel/open_spiel/../open_spiel/python/pybind11/games_bargaining.h:18:
/home/pawel/Desktop/open_spiel/my_open_spiel/open_spiel/../open_spiel/python/pybind11/pybind11.h:34:10: fatal error: 'pybind11/include/pybind11/detail/smart_holder_type_casters.h' file not found
   34 | #include "pybind11/include/pybind11/detail/smart_holder_type_casters.h"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/pawel/Desktop/open_spiel/my_open_spiel/open_spiel/python/pybind11/games_chess.cc:15:
In file included from /home/pawel/Desktop/open_spiel/my_open_spiel/open_spiel/../open_spiel/python/pybind11/games_chess.h:18:
/home/pawel/Desktop/open_spiel/my_open_spiel/open_spiel/../open_spiel/python/pybind11/pybind11.h:34:10: fatal error: 'pybind11/include/pybind11/detail/smart_holder_type_casters.h' file not found
   34 | #include "pybind11/include/pybind11/detail/smart_holder_type_casters.h"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/pawel/Desktop/open_spiel/my_open_spiel/open_spiel/python/pybind11/games_colored_trails.cc:15:
In file included from /home/pawel/Desktop/open_spiel/my_open_spiel/open_spiel/../open_spiel/python/pybind11/games_colored_trails.h:18:
/home/pawel/Desktop/open_spiel/my_open_spiel/open_spiel/../open_spiel/python/pybind11/pybind11.h:34:10: fatal error: 'pybind11/include/pybind11/detail/smart_holder_type_casters.h' file not found
   34 | #include "pybind11/include/pybind11/detail/smart_holder_type_casters.h"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
make[2]: *** [python/CMakeFiles/pyspiel.dir/build.make:90: python/CMakeFiles/pyspiel.dir/pybind11/algorithms_trajectories.cc.o] Error 1
make[2]: *** Waiting for unfinished jobs....
1 error generated.
1 error generated.
make[2]: *** [python/CMakeFiles/pyspiel.dir/build.make:76: python/CMakeFiles/pyspiel.dir/pybind11/algorithms_corr_dist.cc.o] Error 1
[ 97%] Building CXX object utils/CMakeFiles/tensor_view_test.dir/tensor_view_test.cc.o
make[2]: *** [python/CMakeFiles/pyspiel.dir/build.make:118: python/CMakeFiles/pyspiel.dir/pybind11/games_backgammon.cc.o] Error 1
[ 97%] Building CXX object utils/CMakeFiles/threaded_queue_test.dir/threaded_queue_test.cc.o
[ 97%] Building CXX object tests/CMakeFiles/spiel_test.dir/spiel_test.cc.o
1 error generated.
1 error generated.
make[2]: *** [python/CMakeFiles/pyspiel.dir/build.make:146: python/CMakeFiles/pyspiel.dir/pybind11/games_bridge.cc.o] Error 1
1 error generated.
make[2]: *** [python/CMakeFiles/pyspiel.dir/build.make:104: python/CMakeFiles/pyspiel.dir/pybind11/bots.cc.o] Error 1
make[2]: *** [python/CMakeFiles/pyspiel.dir/build.make:132: python/CMakeFiles/pyspiel.dir/pybind11/games_bargaining.cc.o] Error 1
[ 97%] Building CXX object tests/CMakeFiles/action_view_test.dir/action_view_test.cc.o
1 error generated.
1 error generated.
make[2]: *** [python/CMakeFiles/pyspiel.dir/build.make:160: python/CMakeFiles/pyspiel.dir/pybind11/games_chess.cc.o] Error 1
make[2]: *** [python/CMakeFiles/pyspiel.dir/build.make:174: python/CMakeFiles/pyspiel.dir/pybind11/games_colored_trails.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:17536: python/CMakeFiles/pyspiel.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 97%] Linking CXX executable tensor_view_test
[ 97%] Linking CXX executable threaded_queue_test
[ 97%] Built target tensor_view_test
[ 97%] Built target threaded_queue_test
[ 97%] Linking CXX executable action_view_test
[ 97%] Built target action_view_test
[ 97%] Linking CXX executable spiel_test
[ 97%] Built target spiel_test
make: *** [Makefile:101: all] Error 2

My env:

Ubuntu 24.04 LTS
Python 3.12.3
absl-py==2.1.0
attrs==23.2.0
contextlib2==21.6.0
ml_collections==0.1.1
numpy==2.0.1
pbr==6.0.0
pybind11==2.13.1
PyYAML==6.0.1
scipy==1.14.0
setuptools==72.1.0
six==1.16.0
testresources==2.0.1
g++ (Ubuntu 13.2.0-23ubuntu4) 13.2.0
GNU ld (GNU Binutils for Ubuntu) 2.42
lanctot commented 3 months ago

Hi, thanks.

Did you install pybind via the ./install.sh script?

You need to checkout the smart_holder branch, see here: https://github.com/google-deepmind/open_spiel/blob/3cdecf7b2c88095eec13a49c13b768cf7a82189b/open_spiel/scripts/install.sh#L104

There have been some changes to that branch lately that could be backward-incompatible, so we can look into it. But, I did a sync 2 days ago to github and everything built fine, so it'd be quite a coincidence. So, please confirm that you checkout out the smart_holder branch as in that line above, thanks!

lanctot commented 3 months ago

Looking into the smart_holder branch it seems like maybe this header was removed recently. Tagging @rwgk for the suggested fix. We'll update master as soon as we have a fix, thanks for reporting.

lanctot commented 3 months ago

@PawBlo if you just remove those includes, does it work? My guess is that everything in those headers got put into the other pybind11 headers.

rwgk commented 3 months ago

Yes, simply remove the include. It was always private. In the past you had to include smart_holder.h, which still exists, but just for backward compatibility.

lanctot commented 3 months ago

Ahh, ok. Great.

Looks like we only had two instances of it, so this PR should fix it: https://github.com/google-deepmind/open_spiel/pull/1258