pythonlaravelpyodbclaravel-8symfony-process

Laravel running Python script return error libraries not found


I am running a Python script in Laravel using the new process and process->run() method.

$process = new Process(['python3', 'public/python/ARIMA/' . $scriptName]);
$process->setTimeout(180);
$process->run();

The problem is that the process->run it throwing the following error.

python3: can't open file 'public/python/ARIMA/KarlStorzARIMA.py': [Errno 2] 

No such file or directory when I change the path and use the absolute path will return the following error.

Traceback (most recent call last): File
"/home/myfolder/PhpstormProjects/case-medical/public/python/ARIMA/KarlStorzARIMA.py",
line 2, in import pyodbc ModuleNotFoundError: No module named 'pyodbc'

The code to run the process is placed inside of the HomeController.php. I have another Python script running in a different controller without any problem, and it uses PyODBC too. I'm not sure what the problem could be, I did change the chmod of the folder already, and if I do pip install PyODBC, it says that it is already installed. I have Anaconda installed on my PC. Could that be the issue?


Solution

  • It was a problem with corrupted python paths / presence of conda on the pc, removing all the python distro installed, cleaning up all the folders associated with python and reloading it fixed the issue.