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?