chaiNNer-org/chaiNNer

v0.23.3 on Apple Silicon M2 using custom path to Python 3.12.2 stalls on start-up with "Error: Failed to fetch backend nodes."

Opened this issue · 6 comments

Information:

  • Chainner version: [e.g. 0.23.3]
  • OS: macOS 10.14.4 M2 ARM64

Description
I want to utilise MPS in PyTorch on my Mac and I use pyenv so set chaiNNer > Settings > Python> Use system Python [On] and provided a path to /Users/myuser/.pyenv/versions/3.12.2/bin/python saved and quit the app.

3.12.2 is my global system version of Python, so ran:

pip install --upgrade pip
pip install torch torchvision torchaudio
pip install setuptools

Then restarted chaiNNer. The loading screen commences and says it is downloading various packages (OpenCv, re2, scipy, Pillow etc) then on "Loading Nodes" throws error.

Critical Error
A critical error occurred while processing the node data returned by the backend.
Error: Failed to fetch backend nodes.

Quitting and clearing preferences allows me to open the app with default settings again. I have tried creating a virtual Python environment (3.12.2) and installing dependencies there with the same result.

Possibly related issues:
#2030
#2038
#2223

Logs
See attached.
logs.zip

it looks like the version of scipy we use doesn't have native python 3.12 wheels -- meaning that you would need to install a later version of that, as well as many other dependencies probably, in order to use 3.12. 3.12 has not been tested by us in depth as we use 3.11 for chaiNNer.

The reason it's failing is because its trying to compile scipy for 3.12, and failing. So, install the latest version and that should maybe fix it.

I had installed SciPy (1.11.2) into the venv with Pip but still got same error. Tried again with a venv set-up for 3.11.8 and all went smoothly thanks @joeyballentine!

What I'm not sure about though, is that the app is still requires me to install the older PyTorch dependencies despite Torch 3.2.0 being manually installed. If I don't install it, the PyTorch nodes aren't available. Are these libraries only required to enable UI features but otherwise ignored when using a System Python environment? That seems to be the case, as the execution speed of the workflow is significantly faster.

Most likely there's a breaking change with the later version causing the nodes to error, or something like that. Can't know for sure without your newer logs

What I mean is, the UI doesn't display the PyTorch nodes as available until I install the Torch dependency through the UI, even though the app is configured to use a different Python environment on the system where Torch 2.3 is already installed. It looks like the code determining visibility of nodes in the UI menu only checks for dependencies in the the bundled Python environment. Installing them enables the nodes, even though they are not used.

That's not entirely true. If there's an error on the nodes when it's importing them, then they won't show up. I could confirm this if you send your logs again