PermissionError: This app has encountered an error

app link: https://adityajadhavab-model-app-vs34k9.streamlit.app
github link: GitHub - adityajadhavab/model

PermissionError: This app has encountered an error.

PermissionError: [Errno 13] Permission denied: '/var/folders'

[20:04:22] :arrows_counterclockwise: Updated app!
2023-06-15 20:04:27.376 Uncaught app exception
Traceback (most recent call last):
File β€œ/home/appuser/venv/lib/python3.9/site-packages/joblib/memory.py”, line 702, in _check_previous_func_code
self.store_backend.get_cached_func_code([func_id]))
File β€œ/home/appuser/venv/lib/python3.9/site-packages/joblib/_store_backends.py”, line 266, in get_cached_func_code
with self._open_item(filename, β€˜rb’) as f:
FileNotFoundError: [Errno 2] No such file or directory: β€˜/var/folders/h9/b9hqt5sd69gc_yd08sw3y6tr0000gn/T/joblib/pycaret/internal/pipeline/_full_transform/func_code.py’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File β€œ/home/appuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py”, line 565, in _run_script
exec(code, module.dict)
File β€œ/app/model/app.py”, line 88, in
run()
File β€œ/app/model/app.py”, line 62, in run
output = predict(model=model, input_df=input_df)
File β€œ/app/model/app.py”, line 12, in predict
predictions_df = predict_model(model, data=input_df)
File β€œ/home/appuser/venv/lib/python3.9/site-packages/pycaret/clustering/functional.py”, line 861, in predict_model
return experiment.predict_model(
File β€œ/home/appuser/venv/lib/python3.9/site-packages/pycaret/clustering/oop.py”, line 98, in predict_model
return super().predict_model(estimator, data, ml_usecase)
File β€œ/home/appuser/venv/lib/python3.9/site-packages/pycaret/internal/pycaret_experiment/unsupervised_experiment.py”, line 893, in predict_model
pred = estimator.predict(data)
File β€œ/home/appuser/venv/lib/python3.9/site-packages/sklearn/utils/metaestimators.py”, line 113, in
out = lambda *args, **kwargs: self.fn(obj, *args, **kwargs) # noqa
File β€œ/home/appuser/venv/lib/python3.9/site-packages/pycaret/internal/pipeline.py”, line 310, in predict
X, _ = self._memory_full_transform(self, X, None, with_final=False)
File β€œ/home/appuser/venv/lib/python3.9/site-packages/joblib/memory.py”, line 594, in call
return self._cached_call(args, kwargs)[0]
File β€œ/home/appuser/venv/lib/python3.9/site-packages/pycaret/internal/memory.py”, line 350, in _cached_call
self._check_previous_func_code(stacklevel=4)
File β€œ/home/appuser/venv/lib/python3.9/site-packages/joblib/memory.py”, line 704, in _check_previous_func_code
self._write_func_code(func_code, first_line)
File β€œ/home/appuser/venv/lib/python3.9/site-packages/joblib/memory.py”, line 656, in _write_func_code
self.store_backend.store_cached_func_code([func_id], func_code)
File β€œ/home/appuser/venv/lib/python3.9/site-packages/joblib/_store_backends.py”, line 254, in store_cached_func_code
self.create_location(func_path)
File β€œ/home/appuser/venv/lib/python3.9/site-packages/joblib/_store_backends.py”, line 351, in create_location
mkdirp(location)
File β€œ/home/appuser/venv/lib/python3.9/site-packages/joblib/disk.py”, line 61, in mkdirp
os.makedirs(d)
File β€œ/usr/local/lib/python3.9/os.py”, line 215, in makedirs
makedirs(head, exist_ok=exist_ok)
File β€œ/usr/local/lib/python3.9/os.py”, line 215, in makedirs
makedirs(head, exist_ok=exist_ok)
File β€œ/usr/local/lib/python3.9/os.py”, line 215, in makedirs
makedirs(head, exist_ok=exist_ok)
[Previous line repeated 5 more times]
File β€œ/usr/local/lib/python3.9/os.py”, line 225, in makedirs
mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: β€˜/var/folders’

please help

Hi @Aditya_Jadhav

The code for the app seems fine, it may be due to the pickle file of the saved model. Could you share a Jupyter notebook of how you built the model along with the data used to train the model which would help us to reproduce the model and error.

Normally, when I build and deploy an ML model, I would make sure that the library version used to build the model and the version used for deployed apps, should be the same.

Best regards,
Chanin