facebook / sapling

A Scalable, User-Friendly Source Control System.

Home Page:https://sapling-scm.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error using `sl` command

alex-statsig opened this issue · comments

After installing yamllint (brew install yamllint), sapling stopped working, giving this error:

Traceback (most recent call last):
  File "/opt/homebrew/Cellar/python@3.11/3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/edenscm/__init__.py", line 103, in run
  File "/opt/homebrew/Cellar/python@3.11/3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/edenscm/dispatch.py", line 151, in run
ImportError: cannot import name 'mercurialshim' from 'edenscm' (/opt/homebrew/Cellar/python@3.11/3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/edenscm/__init__.py)

I'm not sure if this was due to a python version upgrade or what. I've tried uninstalling yamllint, and uninstall/reinstalling sapling, but the error has persisted.

From my debugging it seems like an issue with sapling and python 3.11.4 maybe (which was triggered by installing yamllint, since both yamllint and sapling depend on python@3.11).

The folder in the stack trace "/opt/homebrew/Cellar/python@3.11/3.11.3/" does not exist, but "/opt/homebrew/Cellar/python@3.11/3.11.4_1/" does. I tried manually downgrading but couldn't get that working either.

Actually was able to get it working again now by manually tapping 3.11.3 in brew and copying that into "python@3.11"'s folder:

brew tap-new $USER/local-python
brew extract --version=3.11.3 python@3.11 $USER/local-python
brew install python@3.11.3
cp -r /opt/homebrew/Cellar/python@3.11.3/3.11.3 /opt/homebrew/Cellar/python@3.11/3.11.3

Think this confirms it's an issue with python 3.11.4 support

I suspect that what happened here was that there was some Sapling daemon still running in the background that still wanted to use the older Python versions.

I've personally gone through several Python updates and at least on my machine it runs fine using 3.11.4:

$ sl dbsh -c 'print(sys.version)'
3.11.4 (main, Jun 27 2023, 21:05:48) [Clang 14.0.3 (clang-1403.0.22.14.1)]

@alex-statsig could you try running Sapling with the daemon disabled, or kill the existing one? You can disable the daemon by setting CHGDISABLE=1, and kill the daemon by running sl --kill-chg-daemon

Yup looks like running sl --kill-chg-daemon fixed it, thanks!

Worth noting I was able to have a teammate repro with the same steps, so seems consistent if the daemon is running maybe. Seemed like it wasn't a compat issue but rather just that it was still trying to use the old version, so that makes sense