Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: Can't get attribute 'Individual' on #59

Open
sparo-jack opened this issue Nov 5, 2018 · 6 comments
Open

AttributeError: Can't get attribute 'Individual' on #59

sparo-jack opened this issue Nov 5, 2018 · 6 comments

Comments

@sparo-jack
Copy link

#24
still have the problem
Traceback (most recent call last):
File "C:\Users\uesr\Anaconda3\lib\multiprocessing\process.py", line 258, in _bootstrap
self.run()
File "C:\Users\uesr\Anaconda3\lib\multiprocessing\process.py", line 93, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\uesr\Anaconda3\lib\multiprocessing\pool.py", line 108, in worker
task = get()
File "C:\Users\uesr\Anaconda3\lib\multiprocessing\queues.py", line 337, in get
return _ForkingPickler.loads(res)
AttributeError: Can't get attribute 'Individual' on <module 'deap.creator' from 'C:\Users\uesr\Anaconda3\lib\site-packages\deap\creator.py'>

package version:
deap-1.2.2
sklearn-deap-0.2.2

@omarcr
Copy link

omarcr commented Mar 12, 2019

I have the same problem:


Process SpawnPoolWorker-9:
Traceback (most recent call last):
  File "C:\Users\Omar\AppData\Local\conda\conda\envs\tensor19\lib\multiprocessing\process.py", line 258, in _bootstrap
    self.run()
  File "C:\Users\Omar\AppData\Local\conda\conda\envs\tensor19\lib\multiprocessing\process.py", line 93, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\Omar\AppData\Local\conda\conda\envs\tensor19\lib\multiprocessing\pool.py", line 108, in worker
    task = get()
  File "C:\Users\Omar\AppData\Local\conda\conda\envs\tensor19\lib\multiprocessing\queues.py", line 337, in get
    return _ForkingPickler.loads(res)
AttributeError: Can't get attribute 'Individual' on <module 'deap.creator' from 'C:\\Users\\Omar\\AppData\\Local\\conda\\conda\\envs\\tensor19\\lib\\site-packages\\deap\\creator.py'>
(array([0, 1, 2, 3]), array([3064, 3064, 3064, 3064], dtype=int64))
Process SpawnPoolWorker-10:
Traceback (most recent call last):
  File "C:\Users\Omar\AppData\Local\conda\conda\envs\tensor19\lib\multiprocessing\process.py", line 258, in _bootstrap
    self.run()
  File "C:\Users\Omar\AppData\Local\conda\conda\envs\tensor19\lib\multiprocessing\process.py", line 93, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\Omar\AppData\Local\conda\conda\envs\tensor19\lib\multiprocessing\pool.py", line 108, in worker
    task = get()
  File "C:\Users\Omar\AppData\Local\conda\conda\envs\tensor19\lib\multiprocessing\queues.py", line 337, in get
    return _ForkingPickler.loads(res)
AttributeError: Can't get attribute 'Individual' on <module 'deap.creator' from 'C:\\Users\\Omar\\AppData\\Local\\conda\\conda\\envs\\tensor19\\lib\\site-packages\\deap\\creator.py'>

@omarcr
Copy link

omarcr commented Mar 12, 2019

code only works with 1 worker :(

@rsteca
Copy link
Owner

rsteca commented Mar 12, 2019

This seems to be a bug of the deap library. There is a similar issue here: DEAP/deap#268

I linux I didn't have any problems running many workers and I don't have a windows environment to test it on, sorry.

@ryanpeach
Copy link
Contributor

I've seen this issue recently. I dont have time to fix it at the moment, but there are some tricks to making it work in the comments of my code in the project. Has to do with defining some attributes ahead of time before calling run. But if that doesnt work for anyone, I think it would be worth having a windows dev debug and write instructions on the process. This is a small codebase, very open and accessible to outside contributions.

@Yike-Li
Copy link

Yike-Li commented Oct 31, 2019

I am using deap. I encountered the exact same issue and made it work by following exactly as the example mentioned https://github.com/DEAP/deap/blob/master/examples/ga/onemax_mp.py.
Make sure the toolbox.register comes before the if name == 'main' and pool=multiprocessing.Pool(processes=4) comes after if name == 'main'.

@TiesdeKok
Copy link

I was running into this error when trying to use joblib to run predict on a model generated with sklearn-deap (EvolutionaryAlgorithmSearchCV to be exact). I was able to solve it by following the examples on this page: https://joblib.readthedocs.io/en/latest/auto_examples/serialization_and_wrappers.html

In particular, wrapping my joblib code in with parallel_backend('multiprocessing'): solved it for me. By the looks of it this only works on UNIX systems, but some of the other solutions discussed on that page might work on Windows as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants