Closed kyomic closed 1 month ago
Hello @kyomic! I'm here to assist you with any bugs, questions, or contributions. Let's work together to resolve any issues you encounter.
The segmentation fault you're encountering when running the Dify API on MacOS 10.15.7 with an Intel CPU seems to be related to the pyarrow
library. This is a known issue with pyarrow
on certain MacOS versions and hardware configurations.
Here are a few steps you can try to resolve this issue:
Update pyarrow
and Dependencies:
Ensure that you have the latest version of pyarrow
and its dependencies. You can update pyarrow
using poetry
:
poetry add pyarrow --upgrade
Reinstall pyarrow
:
Sometimes, simply reinstalling the library can resolve the issue:
poetry remove pyarrow
poetry add pyarrow
Use a Different Python Version: There might be compatibility issues with the specific Python version you are using. Try using a different Python version (e.g., Python 3.9):
poetry env use 3.9
poetry install
Check for MacOS Updates: Ensure that your MacOS is up to date. Sometimes, system updates can resolve compatibility issues.
Use a Virtual Environment: If you are not already using a virtual environment, consider setting one up to isolate dependencies:
python -m venv venv
source venv/bin/activate
poetry install
Run with Docker: If the issue persists, consider running the Dify API within a Docker container to avoid host system compatibility issues. The Dify documentation provides steps to start the Docker stack:
cd ../docker
cp middleware.env.example middleware.env
docker compose -f docker-compose.middleware.yaml --profile weaviate -p dify up -d
cd ../api
poetry run python -m flask run --host 0.0.0.0 --port=5001 --debug
If none of these steps resolve the issue, you might need to look into more specific compatibility problems between pyarrow
and MacOS 10.15.7 with an Intel CPU, or consider reaching out to the pyarrow
community for further assistance.
To continue talking to Dosu, mention @dosu.
This is not related to the dify itself. If you choose to use the source code to start the application, we assume you have the basic knowledge of how to install dependancies.
On my Mac, when I start the API service, I get the following error:
Segmentation fault: 11
Then I added some debugging code in app.py, and the above error was raised.
import faulthandler
faulthandler.enable()
Report the above error.It seems like a circular import in Python or a Python version issue error.
Current thread 0x000000010c487dc0 (most recent call first):
File "<frozen importlib._bootstrap>", line 241 in _call_with_frames_removed
File "<frozen importlib._bootstrap_external>", line 1176 in create_module
File "<frozen importlib._bootstrap>", line 571 in module_from_spec
File "<frozen importlib._bootstrap>", line 674 in _load_unlocked
File "<frozen importlib._bootstrap>", line 1006 in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 1027 in _find_and_load
File "/opt/miniconda3/envs/py310/lib/python3.10/site-packages/pyarrow/__init__.py", line 65 in <module>
File "<frozen importlib._bootstrap>", line 241 in _call_with_frames_removed
...
I believe I know how to install package dependencies correctly. I compiled the Dockerfile and was able to start the API service, as shown below:
None of PyTorch, TensorFlow >= 2.0, or Flax have been found. Models won't be available and only tokenizers, configuration, and file/data utilities can be used.
sagemaker.config INFO - Not applying SDK defaults from location: /etc/xdg/sagemaker/config.yaml
sagemaker.config INFO - Not applying SDK defaults from location: /root/.config/sagemaker/config.yaml
2024-09-27 06:19:43,804.804 WARNING [MainThread] [ext_mail.py:51] - MAIL_TYPE is not set
[2024-09-27 06:19:45 +0000] [1] [INFO] Starting gunicorn 22.0.0
[2024-09-27 06:19:45 +0000] [1] [INFO] Listening at: http://0.0.0.0:5001 (1)
[2024-09-27 06:19:45 +0000] [1] [INFO] Using worker: gevent
[2024-09-27 06:19:45 +0000] [22] [INFO] Booting worker with pid: 22
[2024-09-27 06:22:02 +0000] [1] [INFO] Handling signal: term
[2024-09-27 06:22:03 +0000] [22] [INFO] Worker exiting (pid: 22)
[2024-09-27 06:22:06 +0000] [1] [ERROR] Worker (pid:21) exited with code 1
[2024-09-27 06:22:06 +0000] [1] [ERROR] Worker (pid:21) exited with code 1.
[2024-09-27 06:22:06 +0000] [1] [INFO] Shutting down: Master
Has anyone else successfully run this project on an older Mac with version 10.15?
Let me know if any part needs to be further modified!
Thank you, Google! I have found the solution: downgrading pyarrow to version 15.0.2 should work, as the current version 17.0.0 has unknown compatibility issues. You can do this by running:
pip uninstall pyarrow
pip install pyarrow==15.0.2
Self Checks
Dify version
0.8.3
Cloud or Self Hosted
Self Hosted (Source)
Steps to reproduce
ENV:
Darwin 192.168.1.7 19.6.0 Darwin Kernel Version 19.6.0: Tue Jun 21 21:18:39 PDT 2022; root:xnu-6153.141.66~1/RELEASE_X86_64 x86_64
MacOS 10.15.7, intel cpu
✔️ Expected Behavior
The Docker-related containers are running normally.
❌ Actual Behavior
some LLM error!