install the requirements by names Args: plugins: name of plugins (pai-easyscv, transformers) No returns, raise error if failed
(plugins: List[str])
| 415 | |
| 416 | |
| 417 | def 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 | |
| 441 | def install_requirements_by_files(requirements: List[str]): |
no test coverage detected
searching dependent graphs…