forked from ag2ai/ag2
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request ag2ai#362 from ag2ai/353-bug-modulenotfounderror-j…
…upyter-kernel-gateway Fix Jupyter Kernel Gateway not found at import
- Loading branch information
Showing
6 changed files
with
39 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Copyright (c) 2023 - 2024, Owners of https://github.com/ag2ai | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
import subprocess | ||
from logging import getLogger | ||
|
||
logger = getLogger(__name__) | ||
|
||
__all__ = ["is_jupyter_kernel_gateway_installed"] | ||
|
||
|
||
def is_jupyter_kernel_gateway_installed() -> bool: | ||
try: | ||
subprocess.run( | ||
["jupyter", "kernelgateway", "--version"], | ||
stdout=subprocess.PIPE, | ||
stderr=subprocess.PIPE, | ||
check=True, | ||
) | ||
return True | ||
except (subprocess.CalledProcessError, FileNotFoundError): | ||
logger.warning( | ||
"jupyter-kernel-gateway is required for JupyterCodeExecutor, please install it with `pip install ag2[jupyter-executor]`" | ||
) | ||
return False |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters