{"action":"closed","issue":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/3596","labels_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/3596/labels{/name}","comments_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/3596/comments","events_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/3596/events","html_url":"https://github.com/scikit-learn/scikit-learn/issues/3596","id":41301077,"number":3596,"title":"Python 2 / 3 incompatibility when fetching joblib compressed datasets","user":{"login":"ogrisel","id":89061,"avatar_url":"https://avatars.githubusercontent.com/u/89061?v=3","gravatar_id":"","url":"https://api.github.com/users/ogrisel","html_url":"https://github.com/ogrisel","followers_url":"https://api.github.com/users/ogrisel/followers","following_url":"https://api.github.com/users/ogrisel/following{/other_user}","gists_url":"https://api.github.com/users/ogrisel/gists{/gist_id}","starred_url":"https://api.github.com/users/ogrisel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ogrisel/subscriptions","organizations_url":"https://api.github.com/users/ogrisel/orgs","repos_url":"https://api.github.com/users/ogrisel/repos","events_url":"https://api.github.com/users/ogrisel/events{/privacy}","received_events_url":"https://api.github.com/users/ogrisel/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/labels/Bug","name":"Bug","color":"e10c02"}],"state":"closed","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/milestones/15","html_url":"https://github.com/scikit-learn/scikit-learn/milestones/0.17","labels_url":"https://api.github.com/repos/scikit-learn/scikit-learn/milestones/15/labels","id":995666,"number":15,"title":"0.17","description":"","creator":{"login":"amueller","id":449558,"avatar_url":"https://avatars.githubusercontent.com/u/449558?v=3","gravatar_id":"","url":"https://api.github.com/users/amueller","html_url":"https://github.com/amueller","followers_url":"https://api.github.com/users/amueller/followers","following_url":"https://api.github.com/users/amueller/following{/other_user}","gists_url":"https://api.github.com/users/amueller/gists{/gist_id}","starred_url":"https://api.github.com/users/amueller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amueller/subscriptions","organizations_url":"https://api.github.com/users/amueller/orgs","repos_url":"https://api.github.com/users/amueller/repos","events_url":"https://api.github.com/users/amueller/events{/privacy}","received_events_url":"https://api.github.com/users/amueller/received_events","type":"User","site_admin":false},"open_issues":59,"closed_issues":22,"state":"open","created_at":"2015-02-25T18:59:07Z","updated_at":"2015-09-14T14:36:18Z","due_on":"2015-09-20T04:00:00Z","closed_at":null},"comments":1,"created_at":"2014-08-27T16:09:49Z","updated_at":"2015-09-14T14:36:18Z","closed_at":"2015-09-14T14:36:18Z","body":"For instance when running a Python 2 script that loads the olivetti dataset when it has already been loaded with Python 3 in the past:\r\n\r\n```\r\n---------------------------------------------------------------------------\r\nValueError                                Traceback (most recent call last)\r\n<ipython-input-4-d64d4cc01dcf> in <module>()\r\n      1 from sklearn import datasets\r\n----> 2 lfw_people = datasets.fetch_olivetti_faces()\r\n      3 lfw_people.data.shape\r\n\r\n/Users/ogrisel/venvs/py27/lib/python2.7/site-packages/sklearn/datasets/olivetti_faces.pyc in fetch_olivetti_faces(data_home, shuffle, random_state, download_if_missing)\r\n    116         del mfile\r\n    117     else:\r\n--> 118         faces = joblib.load(join(data_home, TARGET_FILENAME))\r\n    119     # We want floating point data, but float32 is enough (there is only\r\n    120     # one byte of precision in the original uint8s anyway)\r\n\r\n/Users/ogrisel/code/joblib/joblib/numpy_pickle.pyc in load(filename, mmap_mode)\r\n    417                               'ignoring mmap_mode \"%(mmap_mode)s\" flag passed'\r\n    418                               % locals(), Warning, stacklevel=2)\r\n--> 419             unpickler = ZipNumpyUnpickler(filename, file_handle=file_handle)\r\n    420         else:\r\n    421             unpickler = NumpyUnpickler(filename, file_handle=file_handle,\r\n\r\n/Users/ogrisel/code/joblib/joblib/numpy_pickle.pyc in __init__(self, filename, file_handle)\r\n    306         NumpyUnpickler.__init__(self, filename,\r\n    307                                 file_handle,\r\n--> 308                                 mmap_mode=None)\r\n    309\r\n    310     def _open_pickle(self, file_handle):\r\n\r\n/Users/ogrisel/code/joblib/joblib/numpy_pickle.pyc in __init__(self, filename, file_handle, mmap_mode)\r\n    264         self._dirname = os.path.dirname(filename)\r\n    265         self.mmap_mode = mmap_mode\r\n--> 266         self.file_handle = self._open_pickle(file_handle)\r\n    267         Unpickler.__init__(self, self.file_handle)\r\n    268         try:\r\n\r\n/Users/ogrisel/code/joblib/joblib/numpy_pickle.pyc in _open_pickle(self, file_handle)\r\n    309\r\n    310     def _open_pickle(self, file_handle):\r\n--> 311         return BytesIO(read_zfile(file_handle))\r\n    312\r\n    313\r\n\r\n/Users/ogrisel/code/joblib/joblib/numpy_pickle.pyc in read_zfile(file_handle)\r\n     63     length = file_handle.read(len(_ZFILE_PREFIX) + _MAX_LEN)\r\n     64     length = length[len(_ZFILE_PREFIX):]\r\n---> 65     length = int(length, 16)\r\n     66     # We use the known length of the data to tell Zlib the size of the\r\n     67     # buffer to allocate.\r\n\r\nValueError: invalid literal for int() with base 16: '0x1900a2           x'\r\n```\r\n\r\nThis should be fixed upstream in joblib but it's good to track the issue here as well for discoverability."}}