In theory, running something like this from the Macro Panel should work:
import pip
from pathlib import Path
install_dir = Path.home() / "Library" / "Application Support" / "Glyphs 3" / "Scripts"
args = ["install", "-t", install_dir, "-U", "numpy"]
pip.main(args)
But it doesn’t, because pip doesn’t like to be called from inside a script:
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
Traceback (most recent call last):
File "<macro panel>", line 5
File "__init__.py", line 13, in main
return _wrapper(args)
^^^^^^^^^^^^^^
File "entrypoints.py", line 43, in _wrapper
return main(args)
^^^^^^^^^^
File "main.py", line 77, in main
command = create_command(cmd_name, isolated=("--isolated" in cmd_args))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "__init__.py", line 114, in create_command
module = importlib.import_module(module_path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 940, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "install.py", line 15
from pip._internal.cli.req_command import (
File "req_command.py", line 21
from pip._internal.index.package_finder import PackageFinder
File "package_finder.py", line 30
from pip._internal.req import InstallRequirement
File "__init__.py", line 8
from .req_install import InstallRequirement
File "req_install.py", line 36
from pip._internal.operations.build.metadata_legacy import (
File "metadata_legacy.py", line 14
from pip._internal.utils.setuptools_build import make_setuptools_egg_info_args
ModuleNotFoundError: No module named 'pip._internal.utils.setuptools_build'