No module named "pandas"

I am using PythonShell in my MERN application to execute a python script.
My node.js code:
`
const predictForm = async (req, res) => {
try {
const dataToPredict = req.body;
const name = dataToPredict.Name;
delete dataToPredict.Name;

    const modelPrediction = async (data) => {
        const options = {
            mode: "text",
            scriptPath: "./ML_model",
            args: JSON.stringify(data),
        };
        return new Promise((resolve, reject) => {
            PythonShell.run("deployment_g63.py", options).then((results) => {
                try {
                    const prediction = JSON.parse(results[0].replace(/'/g, '"'));
                    resolve(prediction);
                } catch (error) {
                    console.log("Error in parsing the data", error);
                    reject(error);
                }
            }).catch((err) => {
                console.log("Error in executing the Python script: ", err);
                res.json({ error: `Error in executing the Python script ${err}` });
                reject(err);
            });
        });
    };

    const prediction = await modelPrediction(dataToPredict);
    const dbData = dataToPredict;
    dbData["Name"]=name;
    dbData["result"]=prediction[0];
    await pred_model.create(dbData);
    res.json({prediction });

} catch (error) {
    console.log("Error:",error);
    res.json({ error});
    return;
}

};
`
I am getting an error saying “No module named “pandas”.”. But I have installed them using requirements.txt i build command.
Please help me in resolving this issue.

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