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

ValueError: Object arrays cannot be loaded when allow_pickle=False #2

Closed
Coaxecva opened this issue May 1, 2019 · 3 comments
Closed
Labels

Comments

@Coaxecva
Copy link

Coaxecva commented May 1, 2019

Hi Vitor,

I tried to run with the sample data, and had this error:

DUDes.py -s sampledata/hiseq_accuracy_k60.sam -d sampledata/arc-bac_refseq-cg_201503.npz -o sampledata/dudes_profile_output

- - - - - - - - - - - - - - - - - - - - -
|		DUDes v0.08		|
- - - - - - - - - - - - - - - - - - - - -
Output prefix = sampledata/dudes_profile_output
SAM (format) = sampledata/hiseq_accuracy_k60.sam (nm)
Database = sampledata/arc-bac_refseq-cg_201503.npz
Threads = 1
TaxID Start/Last rank = 1/species
Max. Read Matches = 0.000000
Min. Ref. Matches = 0.001000
Bin size = 0.250000
- - - - - - - - - - - - - - - - - - - - -
Loading database file ...Traceback (most recent call last):
  File "DUDes.py", line 645, in <module>
    main()
  File "DUDes.py", line 119, in main
    refids_lookup = npzfile["refids_lookup"].item()
  File "/<path-to-python>/lib/python3.7/site-packages/numpy/lib/npyio.py", line 262, in __getitem__
    pickle_kwargs=self.pickle_kwargs)
  File "/<path-to-python>/lib/python3.7/site-packages/numpy/lib/format.py", line 692, in read_array
    raise ValueError("Object arrays cannot be loaded when "
ValueError: Object arrays cannot be loaded when allow_pickle=False

The numpy version I am using: python '3.7.3' numpy '1.16.3'.

Thanks,
Coax,

@Coaxecva
Copy link
Author

Coaxecva commented May 1, 2019

Think you should add this option allow_pickle=True for np.load in DUDes.py:

npzfile = np.load(args.database_file, allow_pickle=True)

@pirovc pirovc added the bug label May 2, 2019
@pirovc
Copy link
Owner

pirovc commented May 2, 2019

Indeed, for any python > 3.5 the bug occurs. Thanks for the solution, I will provide a fix in the current version.

@shenwei356
Copy link

I met the same issue, and python 3.7 + numpy 1.21 still failed. Luckily it works after downgradeing numpy to 1.16.

@pirovc pirovc closed this as completed Feb 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants