ModuleNotFoundError: No module named 'pandas.core.indexes.numeric'

While deploying my app I face this error but on a local host It work properly. however I don’t import ‘pandas.core.indexes.numeric’ in my code. I used xgboost regressor in my pipeline Get me out of this error.
Below my all import statment of that file

import streamlit as st
import numpy as np
import pandas as pd
import pickle as pk

1.APP
2.Github link
(App dependencies<!-- --> - Streamlit Docs)).
3.Error message:


Traceback (most recent call last):

  File "/home/adminuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 534, in _run_script

    exec(code, module.__dict__)

  File "/mount/src/gurgaonhomevaluepredictorapp/pages/price predictor app.py", line 19, in <module>

    pipeline=pk.load(file)

ModuleNotFoundError: No module named 'pandas.core.indexes.numeric'
4. Name: streamlit
Version: 1.28.0
Python 3.9.13

Hi @Abhijeetkashyap-ds87,

Thanks for posting!

Instead of using pk.load(file) please try using pd.read_pickle(file) instead. The later might be more robust and not affected much by version changes that might be causing the clash.

# loading the dataframe
with open('database/modified_df.pkl','rb') as file:
    df=pd.read_pickle(file)
# loading the pipeline
with open('database/xgboost_pipeline.pkl','rb') as file:
    pipeline=pd.read_pickle(file)

Let me know if this works.

It arising to a different error
Error → ModuleNotFoundError: No module named ‘xgboost’
my requirments.txt
Python==3.9.13
numpy==1.24.4
pandas==1.5.3
scikit-learn==1.2.2
category_encoders==2.6.2
scipy==1.9.1
xgboost==2.0.3
help me to get out of this

  • remove this line
  • do a reboot of the app

Issue solved
THANKS!

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.