Skip to content

Commit

Permalink
Make py3nvml optional
Browse files Browse the repository at this point in the history
  • Loading branch information
bnavigator committed Jul 1, 2023
1 parent b9b51dd commit 5fe85f2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
1 change: 0 additions & 1 deletion requirements.txt
@@ -1,3 +1,2 @@
ipython >= 6.0
importlib-metadata >= 1.4
py3nvml >= 0.2
1 change: 1 addition & 0 deletions setup.py
Expand Up @@ -32,6 +32,7 @@
url="https://github.com/rasbt/watermark",
packages=find_packages(exclude=[]),
install_requires=install_reqs,
extras_require={'gpu': ['py3nvml>=0.2']},
long_description=dedent(
"""\
An IPython magic extension for printing date and time stamps, version
Expand Down
8 changes: 6 additions & 2 deletions watermark/watermark.py
Expand Up @@ -19,7 +19,11 @@
from multiprocessing import cpu_count
from socket import gethostname
import platform
from py3nvml import py3nvml

try:
from py3nvml import py3nvml
except ImportError:
py3nvml = None

try:
import importlib.metadata as importlib_metadata
Expand Down Expand Up @@ -350,4 +354,4 @@ def _get_gpu_info():
"to be installed on this machine."}
except:
return {"GPU Info": "GPU information is not "
"available for this machine."}
"available for this machine."}

0 comments on commit 5fe85f2

Please sign in to comment.