Python Forum
AttributeError: Can't get attribute 'Individual' on <module 'deap.creator'
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
AttributeError: Can't get attribute 'Individual' on <module 'deap.creator'
#1
Hi everyone,

I'm quite new to Python, so excuse me if this question sounds basic, but here it is:

A colleague of mine is now on vacation and I have to access a pickle file (more than one, actually...) filled with data that I have to analyze. First, I used the following line of code to open the file in Python, but without any success...

import numpy as np
import deap
import pickle
import scipy

with open('fronts.pkl','rb') as pickle_file:
    data = pickle.load(pickle_file)
It gives me the following error message:

AttributeError: Can't get attribute 'Individual' on <module 'deap.creator' from 'C:\\python\\lib\\site-packages\\deap\\creator.py'>

I use Python 3.7.0 on my computer, but my colleague used 2.7 on his. Should I downgrade back to 2.7 to fit his version?

I read on another forum about pickle files that one could have problems reading a pickle file that was written on someone else's device. However, I do not have access to my colleague's computer, as it is being used by someone at the moment. It would really be best if I did not monopolize his device, since what I have to do with the data might take a while.

Does anyone have an idea on how to solve this? I've been looking for far too long for what it seems like a insignificant problem...

Thank you!
Reply
#2
Do you have access to this 'deep.creator' module? I suppose it could be a py2/py3 conversion problem if 'deep.creator' is using a module that is not longer supported.
Reply
#3
(Jul-27-2018, 02:12 PM)DomClout Wrote: I use Python 3.7.0 on my computer, but my colleague used 2.7 on his. Should I downgrade back to 2.7 to fit his version?
No need to downgrade,you just install 2.7 and do add to Path under installation.
Then access trough py,this is file that 3.7 install in Windows folder(py.exe) to access other version.
C:\>python -V
Python 3.7.0

C:\>pip -V
pip 10.0.1 from c:\python37\lib\site-packages\pip (python 3.7)

# Access 2.7 
C:\>py -2.7 -V                                                                                                   
Python 2.7.9 

# Using pip to install to 2.7                                                                            
C:\>py -2.7 -m pip install logzero                                                                               
Requirement already satisfied: logzero in c:\python27\lib\site-packages
So running a script with 2.7 is py -2.7 my_script.py and using pip is py -2.7 -m pip install package_name
3.7 will be as normal with python and pip command python my_script.py and pip install package_name.
Reply
#4
snippsat :

I did as you suggested, and when I run the script with 2.7.15, I receive this error message:

>py -2.7 lecture_fronts_idle.py
Traceback (most recent call last):
File "lecture_fronts_idle.py", line 9, in <module>
data = pickle.load(pickle_file)
File "C:\Python27\lib\pickle.py", line 1384, in load
return Unpickler(file).load()
File "C:\Python27\lib\pickle.py", line 864, in load
dispatch[key](self)
File "C:\Python27\lib\pickle.py", line 1096, in load_global
klass = self.find_class(module, name)
File "C:\Python27\lib\pickle.py", line 1132, in find_class
klass = getattr(mod, name)
AttributeError: 'module' object has no attribute 'Individual'

The last line is the same line I get with Python 3.7
Reply
#5
(Jul-27-2018, 07:12 PM)DomClout Wrote: snippsat :

I did as you suggested, and when I run the script with 2.7.15, I receive this error message:

>py -2.7 lecture_fronts_idle.py
Traceback (most recent call last):
File "lecture_fronts_idle.py", line 9, in <module>
data = pickle.load(pickle_file)
File "C:\Python27\lib\pickle.py", line 1384, in load
return Unpickler(file).load()
File "C:\Python27\lib\pickle.py", line 864, in load
dispatch[key](self)
File "C:\Python27\lib\pickle.py", line 1096, in load_global
klass = self.find_class(module, name)
File "C:\Python27\lib\pickle.py", line 1132, in find_class
klass = getattr(mod, name)
AttributeError: 'module' object has no attribute 'Individual'

The last line is the same line I get with Python 3.7

Must not be a conversion error. I would attempt looking at that module. Is there a chance that your colleague changes something prior to leaving?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Using Python and scikitlearn, how to output the individual feature dependencies? warren8r 8 3,952 May-20-2021, 08:02 PM
Last Post: Caprone
  AttributeError: (“module 'pandas' has no attribute 'rolling_std'” Mariana136 4 7,606 Sep-23-2019, 12:56 PM
Last Post: Mariana136
  AttributeError: module 'numpy' has no attribute 'array aapurdel 7 45,573 May-29-2019, 02:48 AM
Last Post: heiner55
  Pandas to_csv in for loop AttributeError: 'tuple' object has no attribute 'to_csv' NSearch 9 16,879 Apr-22-2019, 05:05 PM
Last Post: Yoriz
  AttributeError: 'NoneType' object has no attribute 'all' synthex 2 5,283 Mar-07-2019, 11:11 AM
Last Post: synthex
  Please help with AttributeError: 'Netz' object has no attribute 'conv' DerBerliner 2 3,781 Feb-27-2019, 06:01 PM
Last Post: DerBerliner
  AttributeError: module 'mnist' has no attribute 'train_images' pythonbeginner 1 8,199 Jun-14-2018, 09:29 PM
Last Post: snippsat
  AttributeError: 'set' object has no attribute 'items hey_arnold 3 26,653 Apr-29-2018, 04:33 PM
Last Post: hey_arnold
  AttributeError: module 'plotly' has no attribute 'offline' charlesczc 8 17,113 Jan-21-2018, 08:34 AM
Last Post: buran
  AUCPR of individual features using Random Forest (Error: unhashable Type) melissa 1 3,308 Jul-10-2017, 12:48 PM
Last Post: sparkz_alot

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020