MCPcopy Index your code
hub / github.com/modelscope/modelscope / install_requirements_by_names

Function install_requirements_by_names

modelscope/utils/plugins.py:417–438  ·  view source on GitHub ↗

install the requirements by names Args: plugins: name of plugins (pai-easyscv, transformers) No returns, raise error if failed

(plugins: List[str])

Source from the content-addressed store, hash-verified

415
416
417def install_requirements_by_names(plugins: List[str]):
418 """ install the requirements by names
419
420 Args:
421 plugins: name of plugins (pai-easyscv, transformers)
422
423 No returns, raise error if failed
424
425 """
426 plugins_manager = PluginsManager()
427 uninstalled_plugins = []
428 for plugin in plugins:
429 plugin_installed, version = plugins_manager.check_plugin_installed(
430 plugin)
431 if not plugin_installed:
432 uninstalled_plugins.append(plugin)
433 status, _ = plugins_manager.install_plugins(uninstalled_plugins)
434 if status != 0:
435 raise EnvironmentError(
436 f'The required packages {",".join(uninstalled_plugins)} are not installed.',
437 f'Please run the command `modelscope plugin install {" ".join(uninstalled_plugins)}` to install them.'
438 )
439
440
441def install_requirements_by_files(requirements: List[str]):

Callers 1

register_plugins_repoFunction · 0.85

Calls 4

install_pluginsMethod · 0.95
PluginsManagerClass · 0.85
appendMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…