What causes the unpickling error in numpy?

Aivan Eugene Gan Chua Francisc

I'm currently getting an unpickling error for loading a gz file using the numpy load function. I'm not sure what's causing this. Could offer some suggestions. I'm not sure if the data inside the file might be the problem.

 import numpy as np
 import gzip
 import io
 import pickle


 n = np.load("proteins1.npy.gz",mmap_mode='r')
 print(n)

Here is the error:

UnpicklingError                           Traceback (most recent call last)
C:\Users\Aivan Francisco\Anaconda3\lib\site-packages\numpy\lib\npyio.py in load(file, mmap_mode, allow_pickle, fix_imports, encoding)
    412             try:
--> 413                 return pickle.load(fid, **pickle_kwargs)
    414             except:

UnpicklingError:

During handling of the above exception, another exception occurred:

OSError                                   Traceback (most recent call last)
 <ipython-input-1-b9f88486c866> in <module>()
      7 #file_name = open("proteins1.npy.gz","r")
      8 

----> 9 n = np.load("proteins1.npy.gz",mmap_mode='r') 10 print(n) 11

 C:\Users\Aivan Francisco\Anaconda3\lib\site-packages\numpy\lib\npyio.py in load(file, mmap_mode, allow_pickle, fix_imports, encoding)
     414             except:
     415                 raise IOError(
 --> 416                     "Failed to interpret file %s as a pickle" %   repr(file))
    417     finally:
    418         if own_fid:

 OSError: Failed to interpret file 'proteins1.npy.gz' as a pickle
K. A. Buhr

I believe that numpy.load expects to read an uncompressed *.npy file, not a gzipped *.npy.gz file. Try uncompressing the file first before loading it.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Error when unpickling pandas dataframe

From Dev

parsing error - what causes it?

From Dev

parsing error - what causes it?

From Dev

what causes the error in the jmh measurements?

From Dev

What causes this attribute error in python?

From Dev

What causes outOfBounds error in cellForRowAtIndexPath?

From Dev

What causes the error 'Not Found SoftDeletingTrait Class'?

From Dev

What causes the 'Inconsistent Accesibility' error in the follow code?

From Java

What actually causes a Stack Overflow error?

From Dev

What causes Happy to throw a parse error?

From Dev

What exactly causes a 'spin on suspend' error in Android?

From Dev

What causes division error in this CUDA kernel?

From Dev

What causes a "Virtual Memory exhausted" error?

From Dev

What causes an unbound variable error in Scheme?

From Dev

What causes error in the poll() function, c++?

From Dev

Java InputMismatchException error. What causes it?

From Dev

what causes this error by `apt-get update`

From Dev

What causes run time error in the following program?

From Dev

Ubuntu 19.10 , What causes a login loop error?

From Dev

What causes a 403 error with the Klout API?

From Dev

Python 3: Pickling and UnPickling class instances returning "no persistent load" error

From Dev

Python unpickling error when using base64encoding

From Dev

Unpickling Error while using Word2Vec.load()

From Dev

How-to find out what causes a didHideZoomSlider error on IOS 8?

From Dev

What Causes DynamoDB UpdateItem to Giv Fatal Error in Swift?

From Dev

What causes this Page Not Found error in my Codeigniter 3 application?

From Dev

What causes a "The search key was not found in any record" error in Access 2010?

From Dev

What causes "urlopen error [Errno 13] Permission denied" errors?

From Dev

What causes this error in grunt-contrib-compass after update to Yosemite?

Related Related

  1. 1

    Error when unpickling pandas dataframe

  2. 2

    parsing error - what causes it?

  3. 3

    parsing error - what causes it?

  4. 4

    what causes the error in the jmh measurements?

  5. 5

    What causes this attribute error in python?

  6. 6

    What causes outOfBounds error in cellForRowAtIndexPath?

  7. 7

    What causes the error 'Not Found SoftDeletingTrait Class'?

  8. 8

    What causes the 'Inconsistent Accesibility' error in the follow code?

  9. 9

    What actually causes a Stack Overflow error?

  10. 10

    What causes Happy to throw a parse error?

  11. 11

    What exactly causes a 'spin on suspend' error in Android?

  12. 12

    What causes division error in this CUDA kernel?

  13. 13

    What causes a "Virtual Memory exhausted" error?

  14. 14

    What causes an unbound variable error in Scheme?

  15. 15

    What causes error in the poll() function, c++?

  16. 16

    Java InputMismatchException error. What causes it?

  17. 17

    what causes this error by `apt-get update`

  18. 18

    What causes run time error in the following program?

  19. 19

    Ubuntu 19.10 , What causes a login loop error?

  20. 20

    What causes a 403 error with the Klout API?

  21. 21

    Python 3: Pickling and UnPickling class instances returning "no persistent load" error

  22. 22

    Python unpickling error when using base64encoding

  23. 23

    Unpickling Error while using Word2Vec.load()

  24. 24

    How-to find out what causes a didHideZoomSlider error on IOS 8?

  25. 25

    What Causes DynamoDB UpdateItem to Giv Fatal Error in Swift?

  26. 26

    What causes this Page Not Found error in my Codeigniter 3 application?

  27. 27

    What causes a "The search key was not found in any record" error in Access 2010?

  28. 28

    What causes "urlopen error [Errno 13] Permission denied" errors?

  29. 29

    What causes this error in grunt-contrib-compass after update to Yosemite?

HotTag

Archive