mojo
mojo copied to clipboard
[Modular CLI]: wrong config path when installing mojo
Issue description
On macOS, after performing the initial install of the homebrew tap and adding the mut_xxxx token, my modular.cfg
file is created in $XDG_CONFIG_HOME/modular/modular.cfg
, as expected. Kudos for being good citizens and separating config from $XDG_DATA_HOME
.
However, when running modular install mojo
, I consistently have the following error
[notice] A new release of pip is available: 23.3.1 -> 24.0
[notice] To update, run: pip install --upgrade pip
Traceback (most recent call last):
File "/Users/graelo/.local/share/modular/pkg/packages.modular.com_mojo/scripts/post-install/self-test.py", line 501, in <module>
main()
File "/Users/graelo/.local/share/modular/pkg/packages.modular.com_mojo/scripts/post-install/self-test.py", line 491, in main
tester = Tester(
^^^^^^^
File "/Users/graelo/.local/share/modular/pkg/packages.modular.com_mojo/scripts/post-install/self-test.py", line 87, in __init__
mojo_python_library = config.get("mojo", "python_lib").rstrip(";")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/[email protected]/3.11.7_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/configparser.py", line 797, in get
d = self._unify_values(section, vars)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/[email protected]/3.11.7_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/configparser.py", line 1168, in _unify_values
raise NoSectionError(section) from None
configparser.NoSectionError: No section: 'mojo'
modular: error: failed to run script
==========================
Failure Information:
- Script: `PATH=/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:/Users/graelo/gopath/bin:/Users/graelo/.cargo/bin:/Library/TeX/texbin:/opt/homebrew/opt/openjdk/bin PYTHONPATH=/Users/graelo/.local/share/modular/pkg/packages.modular.com_mojo/venv/lib/Users/graelo/.local/share/modular/pkg/packages.modular.com_mojo/venv/bin/python /Users/graelo/.local/share/modular/pkg/packages.modular.com_mojo/scripts/post-install/self-test.py --modular-home /Users/graelo/.local/share/modular --package-path /Users/graelo/.local/share/modular/pkg/packages.modular.com_mojo`
` - Result: 1
- Stderr:
Traceback (most recent call last):
File "/Users/graelo/.local/share/modular/pkg/packages.modular.com_mojo/scripts/post-install/self-test.py", line 501, in <module>
main()
File "/Users/graelo/.local/share/modular/pkg/packages.modular.com_mojo/scripts/post-install/self-test.py", line 491, in main
tester = Tester(
^^^^^^^
File "/Users/graelo/.local/share/modular/pkg/packages.modular.com_mojo/scripts/post-install/self-test.py", line 87, in __init__
mojo_python_library = config.get("mojo", "python_lib").rstrip(";")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/[email protected]/3.11.7_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/configparser.py", line 797, in get
d = self._unify_values(section, vars)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/[email protected]/3.11.7_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/configparser.py", line 1168, in _unify_values
raise NoSectionError(section) from None
configparser.NoSectionError: No section: 'mojo'
Looking at the command launching self-test.py
reveals the issue:
the
$XDG_CONFIG_HOME
should be used for--modular-home
, but it is not:
self-test.py \
--modular-home /Users/graelo/.local/share/modular \
--package-path /Users/graelo/.local/share/modular/pkg/packages.modular.com_mojo
You can see that self-test.py
is launched with the wrong path for --modular-home
: it should be $XDG_CONFIG_HOME
, meaning ~/.config/modular
.
2 short-term workarounds:
-
one ugly workaround: define the
MODULAR_HOME
env variable as~/.config/modular
. Installation then proceeds, but all the installation goes into the $XDG_CONFIG_HOME (~/.config
), instead of$XDG_DATA_HOME
. For those wondering, typically$XDG_CONFIG_HOME
is config that can be tracked in git. -
one nicer workaround: create a symlink from
$XDG_DATA_HOME/modular.cfg
to$XDG_CONFIG_HOME/modular.cfg
so that the install is performed in$XDG_DATA_HOME
Thanks in advance for fixing this in the next release!
Steps to reproduce
- Include relevant code snippet that did not work as expected.
- If applicable, add screenshots to help explain the problem.
- Include anything else that might help us debug the issue.
Version Info
- Provide Modular CLI version by pasting the output of `modular -v`
modular 0.4.1 (2d8afe15)
- What OS did you install modular CLI on ?
Host Information
================
Target Triple: aarch64-unknown-macosx
CPU: apple-m1
CPU Features: aes, crc, dotprod, fp-armv8, fp16fml, fullfp16, lse, neon, ras, rcpc, rdm, sha2, sha3