interpret
interpret copied to clipboard
Odd path in installing interpret with mamba
I am building a docker image and one of the commands lists interpret like this
RUN mamba install -c interpretml interpret -y
I take it this context is equivalent to installing interpret
in local machine with a conda command.
To my surprise, I could not import interpret at first, resulting in a ModuleNotFoundError
. So as to solve this, I tried to find where interpret could have been installed.
bernardo@42c160b2fb35:/opt/conda$ find . -type d -name '*interpret*'
./share/jupyter/lab/staging/node_modules/interpret
./Lib/site-packages/interpret-0.2.4.dist-info
./Lib/site-packages/interpret_core-0.2.4.dist-info
./Lib/site-packages/interpret # this is where it is installed
interpret
is the only package present in that path, which feels odd... So python looks for packages in the paths specified in sys.path
['/home/bernardo',
'/opt/conda/lib/python39.zip',
'/opt/conda/lib/python3.9',
'/opt/conda/lib/python3.9/lib-dynload',
'',
'/opt/conda/lib/python3.9/site-packages'
]
The path /opt/conda/Lib/site-packages
, where interpret
is installed, is not listed.
I solved the problem by sys.path.append( '/opt/conda/Lib/site-packages')
, but this is obviously a hack.
I can confirm the same happens with 'pure conda'. Also, the version is older by quite a bit compared to an installation with pip.
A very lazy workaround to use as much conda as possible (for the dependencies) could be pip
. You could install it like this:
$ conda create -n interpretml
$ conda activate interpretml
(interpretml) $ conda install -c conda-forge -c interpretml interpret
(interpretml) $ pip install interpret
(interpretml) $ python -c 'import interpret; print(interpret.__version__)'
0.2.7
This installs interpret twice in two different versions!
$ find .conda/envs/interpretml -type d -name 'interpret*'
.conda/envs/interpretml
.conda/envs/interpretml/lib/python3.10/site-packages/interpret
.conda/envs/interpretml/lib/python3.10/site-packages/interpret_core-0.2.7.dist-info
.conda/envs/interpretml/lib/python3.10/site-packages/interpret-0.2.7.dist-info
.conda/envs/interpretml/Lib/site-packages/interpret
.conda/envs/interpretml/Lib/site-packages/interpret_core-0.2.4.dist-info
.conda/envs/interpretml/Lib/site-packages/interpret-0.2.4.dist-info
Not perfect, but functional.
Thanks @bgalvao and @MarcelPa -- We now have a conda-forge package (https://anaconda.org/conda-forge/interpret). Install with:
conda install -c conda-forge interpret