0

I am trying to install tf-explain .So after installing anaconda and tensorflow now I am trying to install tf-explain So in order I have used :

pip install tf-explain
and 
pip3 install tf-explain

it's result:

Alt@mx:~
$ pip install tf-explain
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: tf-explain in ./.local/lib/python3.7/site-packages (0.3.0)
Alt@mx:~
$ pip3 install tf-explain
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: tf-explain in ./.local/lib/python3.7/site-packages (0.3.0)
Alt@mx:~

But when in spyder when I am trying to import this:

from tf_explain.callbacks.activations_visualization import ActivationsVisualizationCallback

I got this error:

ModuleNotFoundError: No module named 'tf_explain'

I am using conda base environment.

enter image description here

Innat
  • 16,113
  • 6
  • 53
  • 101
Cyrus the Great
  • 5,145
  • 5
  • 68
  • 149

1 Answers1

1

I tested on Windows and Linux (colab) os and it works.

!pip install opencv-python
!pip install tensorflow

import cv2                  
import tensorflow as tf 

tf.__version__, cv2.__version__
('2.4.1', '4.1.2')

!pip install tf-explain
Collecting tf-explain
Downloading 
Installing collected packages: tf-explain
Successfully installed tf-explain-0.3.0

from tf_explain.utils.display import filter_display
from tf_explain.callbacks.activations_visualization import ActivationsVisualizationCallback

Your issue probably involves a spyder environment setup.

Innat
  • 16,113
  • 6
  • 53
  • 101
  • If you have a virtual environment, you need to ensure that you are in the right environment. – Innat Apr 20 '21 at 10:08
  • As your question more about `tf_explain`, I would suggest using `jupyter-lab/notebook` or `vscode` like stuff and avoid spyder, here is [one cause.](https://stackoverflow.com/q/50555566/9215780) – Innat Apr 20 '21 at 10:14
  • When I install `!pip install tf-explain` it is installing in this path `Requirement already satisfied: tf-explain in ./.local/lib/python3.7/site-packages (0.3.0) Collecting install` mean `/python3.7/` but spyder environment is `python 3.8.3 @M.Innat – Cyrus the Great Apr 20 '21 at 10:25
  • So, you have a different version of python. Do you have a different conda environment with a different python versions? or you for some reason install a different versions of python in one environment? – Innat Apr 20 '21 at 10:29
  • 1
    I created environment with python 3.7 and after installing tf and cv2 in new environment finally `tf_explain` imported successfully. The keyword was creating environment with `python3.7` @M.Innat – Cyrus the Great Apr 20 '21 at 14:41