close

[Solved] Cannot read pickle file in Cloud Run App. TypeError: __cinit__() takes at least 2 positional arguments

Hello Guys, How are you all? Hope You all Are Fine. Today I am facing the following error Cannot read pickle file in Cloud Run App. TypeError: cinit() takes at least 2 positional arguments in python. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How Cannot read pickle file in Cloud Run App. TypeError: cinit() takes at least 2 positional arguments Error Occurs ?

I am just loading my pickle file in my python project But I am facing following error in my traceback.

    File "pandas/_libs/internals.pyx", line 572, in pandas._libs.internals.BlockManager.__cinit__: TypeError: __cinit__() takes at least 2 positional arguments (0 given) at <module> (/app/src/api/util.py:25)
at <module> (/app/src/api/main.py:8) at
    _call_with_frames_removed (<frozen importlib._bootstrap>:219) at exec_module (<frozen importlib._bootstrap_external>:728) 
at _load_unlocked (<frozen importlib._bootstrap>:677) 

How To Solve Cannot read pickle file in Cloud Run App. TypeError: cinit() takes at least 2 positional arguments Error ?

  1. How To Solve Cannot read pickle file in Cloud Run App. TypeError: cinit() takes at least 2 positional arguments Error ?

    To Solve Cannot read pickle file in Cloud Run App. TypeError: cinit() takes at least 2 positional arguments Error This is Pandas Bug But Bug is fixed now in pandas 1.3.1 So just update Pandas and use pickle load as define below. Just replace this line pickle.load() With this in pandas 1.3.1 pandas.read_pickle()

  2. Cannot read pickle file in Cloud Run App. TypeError: cinit() takes at least 2 positional arguments

    To Solve Cannot read pickle file in Cloud Run App. TypeError: cinit() takes at least 2 positional arguments Error This is Pandas Bug But Bug is fixed now in pandas 1.3.1 So just update Pandas and use pickle load as define below. Just replace this line pickle.load() With this in pandas 1.3.1 pandas.read_pickle()

Solution 1: Just update Pandas version

This is Pandas Bug But Bug is fixed now in pandas 1.3.1 So just update Pandas and use pickle load as define below.

Just replace this line

pickle.load()

With this in pandas 1.3.1

pandas.read_pickle()

Solution 2: Just Downgrade Pandas version

I just reverted pandas to the old version and my error was solved just run the below command to downgrade the pandas version.

pip uninstall pandas
pip install pandas==1.2.5

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you?

Also Read

Leave a Comment