Installation failed on macOS

2022-04-06 12:35:26 WARNING (MainThread) [homeassistant.bootstrap] Unable to set up core integrations. Activating safe mode
2022-04-06 12:35:29 ERROR (MainThread) [homeassistant.setup] Setup failed for analytics: Unable to import component: No module named 'sqlalchemy'
2022-04-06 12:35:30 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of onboarding. Setup failed for dependencies: analytics
2022-04-06 12:35:30 ERROR (MainThread) [homeassistant.setup] Setup failed for onboarding: (DependencyError(...), 'Could not setup dependencies: analytics')
2022-04-06 12:35:30 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of frontend. Setup failed for dependencies: onboarding
2022-04-06 12:35:30 ERROR (MainThread) [homeassistant.setup] Setup failed for frontend: (DependencyError(...), 'Could not setup dependencies: onboarding')
2022-04-06 12:35:36 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of safe_mode. Setup failed for dependencies: frontend
2022-04-06 12:35:36 ERROR (MainThread) [homeassistant.setup] Setup failed for safe_mode: (DependencyError(...), 'Could not setup dependencies: frontend')

What does HA need to install? I think I am missing something.

Node.JS installed
Python 3.9.12 installed

It has worked before by using:
pip3 install homeassistant

Any help is appreciated.

Wow, I found it:

sudo npm cache clean -f
sudo npm install -g n
sudo n stable

Don’t know why, but it worked after that.