# Cannot load file containing pickled data

**URL:** <https://discuss.flower.ai/t/cannot-load-file-containing-pickled-data/60>\
**Category:** Flower Framework\
**Created:** [February 21, 2024, 5:01pm UTC](https://discuss.flower.ai/t/cannot-load-file-containing-pickled-data/60 "2024-02-21T17:01:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![flower](https://dub1.discourse-cdn.com/flex013/user_avatar/discuss.flower.ai/flower/32/17_2.png) [@flower](https://discuss.flower.ai/u/flower)\
**Post date:** [February 21, 2024, 5:01pm UTC](https://discuss.flower.ai/t/cannot-load-file-containing-pickled-data/60/1 "2024-02-21T17:01:31Z")

</div>

\*This question was migrated from Github Discussions.

**Original questions:**  
"Hello,  
I’ve just started using FLower and I’m getting this error

`raise ValueError("Cannot load file containing pickled data " ValueError: Cannot load file containing pickled data when allow_pickle=False`

Could you help me find a solution?  
Thanks in advance"

**Answer (part 1):**  
“Hi! You seem to be trying to load a pickled file (are you using `numpy.load` ?), if you know the content of the file you are trying to load and know you can trust it, you should probably use `numpy.load` with `allow_pickle=True` . If you can share some of the code that leading to the error I could probably assist you with more certainty, but hope this already helps!”

**Answer (part 2):**  
"Hello, thank you for your reply.  
The error occurred in this piece of code:

```auto
def bytes_to_ndarray(tensor: bytes) -> NDArray: 
"""Deserialize NumPy ndarray from bytes.""" 
bytes_io = BytesIO(tensor)
# WARNING: NEVER set allow_pickle to true. 
# Reason: loading pickled data can execute arbitrary code 
# Source:
https://numpy.org/doc/stable/reference/generated/numpy.load.html ndarray_deserialized = np.load(bytes_io, allow_pickle=False) 
return cast(NDArray, ndarray_deserialized)

```

The problem came from the bytes I was sending for deserialization. I was able to solve the problem by reviewing the format of the bytes I was sending."
