Manually run python file with command it runs fine but when i'm using for process its gives error.(composer require symfony/process)

Question:

"The command "’python3′ ‘/var/www/html/vino_python/rembg-main/app.py’" failed.nnExit Code: 1(General error)nnWorking directory: /var/www/html/vino_pythonnnOutput:n================nnnError Output:n================nTraceback (most recent call last):n File "/var/www/html/vino_python/rembg-main/app.py", line 1, in n from rembg.bg import removen File "/var/www/html/vino_python/rembg-main/rembg/bg.py", line 7, in n from pymatting.alpha.estimate_alpha_cf import estimate_alpha_cfn File "/usr/local/lib/python3.7/dist-packages/pymatting/init.py", line 2, in n from pymatting.util import *n File "/usr/local/lib/python3.7/dist-packages/pymatting/util/init.py", line 2, in n from pymatting.util.kdtree import KDTree, knnn File "/usr/local/lib/python3.7/dist-packages/pymatting/util/kdtree.py", line 7, in n @njit("i8(i8[:], i8[:], i8[:], i8[:], i8[:], f4[:, :, :], f4[:], f4[:, :], i8[:], i8)", cache=True, nogil=True)n File "/usr/local/lib/python3.7/dist-packages/numba/core/decorators.py", line 212, in wrappern disp.enable_caching()n File "/usr/local/lib/python3.7/dist-packages/numba/core/dispatcher.py", line 863, in enable_cachingn self._cache = FunctionCache(self.py_func)n File "/usr/local/lib/python3.7/dist-packages/numba/core/caching.py", line 613, in initn self._impl = self._impl_class(py_func)n File "/usr/local/lib/python3.7/dist-packages/numba/core/caching.py", line 351, in initn "for file %r" % (qualname, source_path))nRuntimeError: cannot cache function ‘_make_tree’: no locator available for file ‘/usr/local/lib/python3.7/dist-packages/pymatting/util/kdtree.py’n",

I’m Using Python Version 3.7 and also Host Project in AWS Ubuntu 18.04

Asked By: Mayur Panchal

||

Answers:

I have the same problem occurring in one of my Laravel + Python project where in the Laravel API I executed a python file via Symfony process and solve this type of error by doing the steps:

This is the problem is mainly occurs when you have different version of libraries inside pip install in python dependency.

For solution you must need to follow specific version of pip and python for installing dependecies.

In your case I think you need to delete the lib folder from project root if you are using virtual environment.

After that you can again fresh installing via pip install -r requirements.txt

I think you will solve your problem by doing this simple steps.

Answered By: NIKUNJ KOTHIYA
Categories: questions Tags: , , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.