Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

251
Visualizações
Node.js, Child_process running a python script pandas import error

Can someone please explain why this is the case and how this issue can be fixed?

If i boot my Node.js server via docker using docker compose up -d

I'm sending data to my server via a vue form and receiving it via this.

app.post('/', upload.single('file'),(req, res) =>{

    
    converter.json2csv(req.body, (err, csv) => {
        if (err) {
            throw err;
        }
    
        // print CSV string
        console.log(csv);
        fs.writeFileSync('./uploads/file.csv', csv)
    });
    var spawn = require('child_process').spawn;
    var process = spawn('python', ['./uploads/classify.py']);
    
    process.stderr.on('data', function (data) {
        console.log(data.toString())
    });

})

The error i get is

Traceback (most recent call last):

File "./uploads/classify.py", line 52, in <module>



import pandas as pd



ImportError: No module named pandas

Note: if I change stderr to stdout nothing happens (to be expected)

However if I boot via Node index.js i dont run into this error and everything is fine however my website doesn't work properly.

Is there a way that I can still boot my server via docker compose up -d and not get pandas as pd is missing instead of booting via node index.js

I have also tried using the npm package python-shell and I get pandas as pd module is missing as well

Are there any other packages or methods to help port a python script to node?

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda