I have seen a few posts (1, 2) regarding this question but none have hit the nail on the head for me. I am trying to install nvidia-ml-py
version 7.352.0 into my Anaconda Python 2.7 environment.
Based on Link2 above the only appropriate method I saw was simply python setup.py install
, the output of the setup.py
follows
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
copying pynvml.py -> build/lib.linux-x86_64-2.7
copying nvidia_smi.py -> build/lib.linux-x86_64-2.7
running install_lib
copying build/lib.linux-x86_64-2.7/nvidia_smi.py -> /usr/local/lib/python2.7/dist-packages
copying build/lib.linux-x86_64-2.7/pynvml.py -> /usr/local/lib/python2.7/dist-packages
byte-compiling /usr/local/lib/python2.7/dist-packages/nvidia_smi.py to nvidia_smi.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/pynvml.py to pynvml.pyc
running install_egg_info
Writing /usr/local/lib/python2.7/dist-packages/nvidia_ml_py-7.352.0.egg-info
From what I can tell, this did not install the module where Anaconda can see it. Though, oddly enough, if I open up the Python REPL from my py27
Anaconda source, I can import and use the library successfully.
Python 2.7.14 |Anaconda, Inc.| (default, Dec 7 2017, 17:05:42)
[GCC 7.2.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pynvml
>>> from pynvml import *
>>> nvmlInit()
>>> print "Driver Version:", nvmlSystemGetDriverVersion()
Driver Version: 384.98
>>> nvmlDeviceGetCount()
1L
Though when it comes to importing the library in a Python file, Anaconda/Python cannot locate the module.
Traceback (most recent call last):
File "PyNVML_Test0.py", line 4, in <module>
from pynvml import *
ImportError: No module named pynvml
How can I properly install this module so that my Anaconda Python 2.7 source can see it?
EDIT1: Ahh, The only reason I could use the library in the REPL is because I started the REPL from the library's directory..