MultiNEAT icon indicating copy to clipboard operation
MultiNEAT copied to clipboard

Install problem with python 3.5 on Ubuntu 16.04 with Cython

Open njvanbal opened this issue 7 years ago • 10 comments

I am getting the following error when trying to install with cython. Not sure if it is a version problem, or if I am misunderstanding the build process.

Compiling _MultiNEAT.pyx because it changed.
[1/1] Cythonizing _MultiNEAT.pyx

Error compiling Cython file:
------------------------------------------------------------
...
    def __dealloc__(self):
        if not self.borrowed:
            del self.thisptr

    def __repr__(self):
        return 'ID {} Age {}'.format(self.thisptr.ID(), self.thisptr.Age())
                                                                   ^
------------------------------------------------------------

_MultiNEAT.pyx:953:68: Object of type 'Species' has no attribute 'Age'
Traceback (most recent call last):
  File "setup.py", line 96, in <module>
    ext_modules=getExtensions())
  File "setup.py", line 71, in getExtensions
    extra_compile_args=extra)],
  File "/usr/local/lib/python3.5/dist-packages/Cython/Build/Dependencies.py", line 1039, in cythonize
    cythonize_one(*args)
  File "/usr/local/lib/python3.5/dist-packages/Cython/Build/Dependencies.py", line 1161, in cythonize_one
    raise CompileError(None, pyx_file)
Cython.Compiler.Errors.CompileError: _MultiNEAT.pyx

njvanbal avatar Dec 04 '17 18:12 njvanbal

I also tried removing the reference to age and am getting the following error, I have confirmed that the constructor in the Genome file does in fact have 9 arguments, but for some reason Cython thinks it has 10.

_MultiNEAT.cpp:19088:166: error: no matching function for call to ‘NEAT::Genome::Genome(unsigned int&, unsigned int&, unsigned int&, unsigned int&, bool&, NEAT::ActivationFunction&, NEAT::ActivationFunction&, unsigned int&, NEAT::Parameters&)’
     __pyx_v_self->thisptr = new NEAT::Genome(__pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_21, __pyx_t_22, __pyx_t_23, __pyx_t_24, (*__pyx_v_a_ps->thisptr));
                                                                                                                                                                      ^
In file included from src/Innovation.h:37:0,
                 from src/Population.h:36,
                 from _MultiNEAT.cpp:589:
src/Genome.h:193:9: note: candidate: NEAT::Genome::Genome(unsigned int, unsigned int, unsigned int, unsigned int, bool, NEAT::ActivationFunction, NEAT::ActivationFunction, unsigned int, const NEAT::Parameters&, unsigned int)
         Genome(unsigned int a_ID,
         ^
src/Genome.h:193:9: note:   candidate expects 10 arguments, 9 provided
src/Genome.h:189:9: note: candidate: NEAT::Genome::Genome(unsigned int, unsigned int, unsigned int, unsigned int, NEAT::ActivationFunction, NEAT::ActivationFunction, const NEAT::Parameters&)
         Genome(unsigned int a_ID, unsigned int a_NumInputs, unsigned int a_NumHidden, unsigned int a_NumOutputs,
         ^
src/Genome.h:189:9: note:   candidate expects 7 arguments, 9 provided
src/Genome.h:186:9: note: candidate: NEAT::Genome::Genome(std::ifstream&)
         Genome(std::ifstream &a_DataFile);
         ^
src/Genome.h:186:9: note:   candidate expects 1 argument, 9 provided
src/Genome.h:183:9: note: candidate: NEAT::Genome::Genome(const char*)
         Genome(const char *a_filename);
         ^
src/Genome.h:183:9: note:   candidate expects 1 argument, 9 provided
src/Genome.h:170:9: note: candidate: NEAT::Genome::Genome(const NEAT::Genome&)
         Genome(const Genome &a_g);
         ^
src/Genome.h:170:9: note:   candidate expects 1 argument, 9 provided
src/Genome.h:167:9: note: candidate: NEAT::Genome::Genome()
         Genome();
         ^
src/Genome.h:167:9: note:   candidate expects 0 arguments, 9 provided
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

njvanbal avatar Dec 04 '17 20:12 njvanbal

fix seems to be an older version

joel-simon avatar Dec 15 '17 19:12 joel-simon

I`m having the same issue (using Cython on Ubuntu 16.04 (x86_64)). Have tried two machines with the same OS but no luck.

@Sloth6 Older version of what?

lionliam96 avatar Dec 28 '17 10:12 lionliam96

An older commit. But I would recommend just using the boost version which fixes the issue. Cython seems not supported recently, it isn't documented but things like genome pickling (and therefore parallelism) and traits don't work with cython.

joel-simon avatar Dec 29 '17 03:12 joel-simon

The Cython stuff is way out of date, I'm using Boost for development and all new features rely on it.

peter-ch avatar Jan 26 '18 13:01 peter-ch

it doesn't compile even with boost src/PythonBindings.h:31:10: fatal error: 'boost/python/numeric.hpp' file not found Since boost 1.65 numeric.hpp is deprecated in favor of numpy.hpp

anton-matosov avatar Mar 12 '18 20:03 anton-matosov

I have updated MultiNEAT to build with boost 1.65 and created conda package out of it. I will create PR shortly

anton-matosov avatar Mar 20 '18 22:03 anton-matosov

Thanks!

peter-ch avatar Mar 29 '18 09:03 peter-ch

I am facing the exact same problem. Exact same error message with MN_Build=cython

RiseOoi avatar Apr 17 '18 15:04 RiseOoi

cython is no longer supported. currently build works only with boost I have added a Conda support, so you can grab pre-build binaries. Currently packages are available from my personal channel with boost from conda-forge: conda install multineat -c anton.matosov -c conda-forge

In future I want to submit it as feedstock to conda-forge to make re-distribution easy.

More details of changes and how this build was created are here https://github.com/peter-ch/MultiNEAT/pull/45

anton-matosov avatar Apr 17 '18 18:04 anton-matosov