sapling
sapling copied to clipboard
Cannot run any of the `sl` commands on MacOs
Hi,
Thank you for the amazing project.
I am facing a problem with getting started with using the command.
I am using MacOs, and when I run sl
, I get this error:
Traceback (most recent call last):
File "/opt/homebrew/Cellar/[email protected]/3.10.9/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/edenscm/__init__.py", line 86, in run
dispatch.runchgserver(args[2:])
File "/opt/homebrew/Cellar/[email protected]/3.10.9/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/edenscm/dispatch.py", line 368, in runchgserver
_preimportmodules()
File "/opt/homebrew/Cellar/[email protected]/3.10.9/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/edenscm/dispatch.py", line 348, in _preimportmodules
extensions.preimport(extname)
File "/opt/homebrew/Cellar/[email protected]/3.10.9/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/edenscm/extensions.py", line 208, in preimport
mod = getattr(__import__("edenscm.ext.%s" % name).ext, name)
File "/opt/homebrew/Cellar/[email protected]/3.10.9/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/edenscm/ext/copytrace.py", line 71, in <module>
gdbm.open
AttributeError: module 'gdbm' has no attribute 'open'
I tried installed gdbm using homebrew and macports, but I think the problem is that python 3.10 is what is causing the issue.
If the issue is indeed with python version, how can I specify which one to use? I tried with a new virtual environment and I tried setting the PATH to point to [email protected] first, but the sl
still goes to this python3.10.9
I have not seen this. Is this an Intel mac or an M1?
@bolinfest M1
@minaashraf146 sorry about the issue, I can reproduce. We use Python 3.11 for the bottles on our release page, and 3.10 on the one in homebrew-core, which seems to be causing the issue.
As a workaround, you can install a bottle from our releases page, which works on M1 macs.
@sggutier Thank you so much for the quick reply. I am currently on ventura, would it cause any issues if I installed the monterey bottle?
@minaashraf146 not at all, the monterey bottle should work fine
I managed to install the bottle, but apple refuses to run it. The app can't be opened because apple can’t be opened because Apple cannot check it for malicious software. This software needs to be updated. Contact the developer for more information.
"parsers.cpython-311-darwin.so” can’t be opened because Apple cannot check it for malicious software.
Apple checks for malicious software for stuff downloaded with a web browser. Could you try uninstalling the sapling bottle, then running
xattr -r -d com.apple.quarantine ~/Downloads/sapling_0.1.20221213-150011-h9b0acf12.arm64_monterey.bottle.tar.gz
and then reinstalling the bottle?
You could also use curl as an alternative: https://sapling-scm.com/docs/introduction/installation/#apple-silicon-arm64
Unfortunately, this results in the original issue again.
➜ Downloads xattr -r -d com.apple.quarantine ~/Downloads/sapling_0.1.20221213-150011-h9b0acf12.arm64_monterey.bottle.tar.gz
➜ Downloads brew install --force-bottle sapling_0.1.20221213-150011-h9b0acf12.arm64_monterey.bottle.tar.gz
==> Fetching sapling
==> Pouring sapling_0.1.20221213-150011-h9b0acf12.arm64_monterey.bottle.tar.gz
🍺 /opt/homebrew/Cellar/sapling/0.1.20221213-150011-h9b0acf12: 521 files, 74.8MB
==> Running brew cleanup sapling
...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see man brew
).
➜ Downloads sl
Traceback (most recent call last):
File "/opt/homebrew/Cellar/[email protected]/3.11.0/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/edenscm/init.py", line 86, in run
dispatch.runchgserver(args[2:])
File "/opt/homebrew/Cellar/[email protected]/3.11.0/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/edenscm/dispatch.py", line 368, in runchgserver
_preimportmodules()
File "/opt/homebrew/Cellar/[email protected]/3.11.0/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/edenscm/dispatch.py", line 348, in _preimportmodules
extensions.preimport(extname)
File "/opt/homebrew/Cellar/[email protected]/3.11.0/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/edenscm/extensions.py", line 208, in preimport
mod = getattr(import("edenscm.ext.%s" % name).ext, name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/[email protected]/3.11.0/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/edenscm/ext/copytrace.py", line 71, in
just to confirm, the new error is from [email protected] comapred to 3.10 in the original issue.
I also can confirm that I have gdbm installed
➜ brew install [email protected] Warning: [email protected] 3.11.0 is already installed and up-to-date. To reinstall 3.11.0, run: brew reinstall [email protected]
I actually have a different kind of issue, but the first few lines are actually the same and I mistook them for yours:
Traceback (most recent call last):
File "/Users/sggutier/homebrew/Cellar/[email protected]/3.10.9/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/edenscm/__init__.py", line 86, in run
dispatch.runchgserver(args[2:])
File "/Users/sggutier/homebrew/Cellar/[email protected]/3.10.9/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/edenscm/dispatch.py", line 368, in runchgserver
_preimportmodules()
File "/Users/sggutier/homebrew/Cellar/[email protected]/3.10.9/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/edenscm/dispatch.py", line 348, in _preimportmodules
extensions.preimport(extname)
File "/Users/sggutier/homebrew/Cellar/[email protected]/3.10.9/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/edenscm/extensions.py", line 208, in preimport
mod = getattr(__import__("edenscm.ext.%s" % name).ext, name)
File "/Users/sggutier/homebrew/Cellar/[email protected]/3.10.9/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/edenscm/ext/ghstack/__init__.py", line 12, in <module>
from edenscm.ext.github.github_repo_util import check_github_repo
File "/Users/sggutier/homebrew/Cellar/[email protected]/3.10.9/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/edenscm/ext/github/__init__.py", line 14, in <module>
from . import follow, github_repo_util, link, pr_status, submit, templates
File "/Users/sggutier/homebrew/Cellar/[email protected]/3.10.9/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/edenscm/ext/github/follow.py", line 8, in <module>
from .pullrequeststore import PullRequestStore
File "/Users/sggutier/homebrew/Cellar/[email protected]/3.10.9/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/edenscm/ext/github/pullrequeststore.py", line 15, in <module>
from .pullrequest import PullRequestId, PullRequestIdDict
File "/Users/sggutier/homebrew/Cellar/[email protected]/3.10.9/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/edenscm/ext/github/pullrequest.py", line 9, in <module>
from ghstack.github_cli_endpoint import GitHubCLIEndpoint
ModuleNotFoundError: No module named 'ghstack.github_cli_endpoint'
I'll keep poking around and try to see where your issue came from:
@minaashraf146 Looking at [email protected]
's formula, it seems to install the dbm.gnu
module instead of the gdbm
module. Perhaps your Sapling installation is picking the gdbm
module from somewhere else?
I could add an additional exception for your gdbm
version, but first I'd like to see what
CHGDISABLE=1 sl dbsh -c "import gdbm; print(gdbm.__file__)"
and
python3.10 -c "import gdbm; print(gdbm.__file__)"
get you
Hi @sggutier This is my second GitHub account, I will use it for the rest of the discussion as I don't have access to the second one right now.
Both commands return None.
CHGDISABLE=1 sl dbsh -c "import gdbm; print(gdbm.__file__)"
None
➜ ~ python3.10 -c "import gdbm; print(gdbm.__file__)"
None
I tried with python3.8, 3.10, and 3.11
here is more investigations regarding gdbm on python3.11
➜ ~ python3.11
Python 3.11.0 (main, Oct 26 2022, 19:06:18) [Clang 14.0.0 (clang-1400.0.29.202)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import gdbm
>>> dir(gdbm)
['__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__']
>>> print(gdbm.__path__)
_NamespacePath(['/opt/homebrew/opt/gdbm'])
>>> print(gdbm.__spec__)
ModuleSpec(name='gdbm', loader=<_frozen_importlib_external.NamespaceLoader object at 0x104688cd0>, submodule_search_locations=_NamespacePath(['/opt/homebrew/opt/gdbm']))
Please let me know if you need to run other commands. Thank you for your help, really appreciated.
@minaashraf146 I sent out a commit for fixing your issue. I'm still trying to reproduce your issue, but I'm unable to.
$ python3.11 -c "import gdbm"
Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'gdbm'
I've also tried installing Python 3.10 and 3.11 from macports, but I'm still unable to import that module from them. What is the output of which python3.11
? Do you remember where python3.11
comes from on your machine?
@minaashraf146 I ended up removing the dependency altogether in cfbb6a256b94c6e755db02658ef1a4312303bee6. You can either wait for a new release, or install the latest head with brew install sapling --HEAD
Hey @sggutier Just wanted to let you know that everything is working perfectly now. I rebuilt the code on my machine as you suggested, and it worked. Thank you so much