peter-ch / MultiNEAT

Portable NeuroEvolution Library
http://MultiNEAT.com
GNU Lesser General Public License v3.0
328 stars 104 forks source link

Ubuntu Boost.Python #62

Closed javadan closed 4 years ago

javadan commented 4 years ago

Hi

This has more to do with Ubuntu and Boost.Python, than MultiNEAT, I think.

The apt-get and pips and condas didn't work for me, so I downloaded Boost, and bootstrapped it and installed everything, and python

./bootstrap.sh --with-libraries=python --with-python=python3.6
./b2 install

Building MultiNEAT, I was getting errors saying it couldn't find python36 and numpy36.

But I got it to build when I changed setup.py to boost_python3 and boost_numpy3. If I cmake it, it finds python3 and numpy3, but not python36 and numpy36.

-- [ /usr/share/cmake-3.10/Modules/FindBoost.cmake:1783 ] Boost_FOUND = 1
-- Boost version: 1.65.1
-- Found the following Boost libraries:
--   date_time
--   system
--   filesystem
--   python3
--   numpy3
--   serialization

But now when I try run an example,

python3 TestHyperNEAT_xor.py

It is getting an implementation mismatch.

Boost.Python.ArgumentError: Python argument types in
Genome.init(Genome, int, int, int, int, bool, ActivationFunction, ActivationFunction, int, Parameters, int)
did not match C++ signature:
init(_object*, unsigned int, unsigned int, unsigned int, unsigned int, bool, NEAT::ActivationFunction, NEAT::ActivationFunction, int, NEAT::Parameters, unsigned int, unsigned int)

So I searched my computer for boost_python Here are all the .so and .a files.

./opt/boost_1_65_1/stage/lib/libboost_python3.a
./opt/boost_1_65_1/stage/lib/libboost_python3.so
./opt/boost_1_65_1/stage/lib/libboost_python3.so.1.65.1
./opt/boost_1_65_1/bin.v2/libs/python/build/gcc-7/release/link-static/threading-multi/libboost_python3.a
./opt/boost_1_65_1/bin.v2/libs/python/build/gcc-7/release/threading-multi/libboost_python3.so.1.65.1
./usr/local/lib/libboost_python3.a
./usr/local/lib/libboost_python3.so
./usr/local/lib/libboost_python3.so.1.65.1
./usr/lib/x86_64-linux-gnu/libboost_python-py36.so
./usr/lib/x86_64-linux-gnu/libboost_python3-py36.so.1.65.1
./usr/lib/x86_64-linux-gnu/libboost_python-py27.so.1.65.1
./usr/lib/x86_64-linux-gnu/libboost_python3-py36.so
./usr/lib/x86_64-linux-gnu/libboost_python-py27.a
./usr/lib/x86_64-linux-gnu/libboost_python-py36.a
./usr/lib/x86_64-linux-gnu/libboost_python.so
./usr/lib/x86_64-linux-gnu/libboost_python3.a
./usr/lib/x86_64-linux-gnu/libboost_python-py27.so
./usr/lib/x86_64-linux-gnu/libboost_python3.so
./usr/lib/x86_64-linux-gnu/libboost_python3-py36.a
./usr/lib/x86_64-linux-gnu/libboost_python.a

Hmm, so probably

./usr/lib/x86_64-linux-gnu/libboost_python3-py36.so

is different from

./usr/lib/x86_64-linux-gnu/libboost_python3.so

or something like that. But this is getting a bit complicated now, and it has been years since I did C++.

Any advice ?

peter-ch commented 4 years ago

This isn't a boost problem, the documentation needs to be updated. There is one extra int parameter now in the Genome constructor. Check the C++ code for details.

javadan commented 4 years ago

Ok thanks, I see that now, and it's working. I'll read the code and try work out what a_FS_NEAT_links does.

I tried running TestESHyperNEAT_xor.py next, but I see it threw: AttributeError: 'Genome' object has no attribute 'BuildESHyperNEATPhenotype' because it's commented out, and in the Genome.h file, it says "disabling because of errors I can't fix right now" Do you remember what the errors were, out of interest?