0

I am trying to import the image saliency package in a simple Jupyter notebook and am getting this error:

ImportError                               Traceback (most recent call last)
<ipython-input-2-352cee026b71> in <module>()
----> 1 import pyimgsaliency
      2 
      3 for img in images:
      4     imgplot = plt.imshow(img,cmap='gray')
      5     plt.show()

~\Anaconda3\envs\tracx\lib\site-packages\pyimgsaliency\__init__.py in <module>()
----> 1 from saliency import *
      2 from binarise import *
      3 from saliency_mbd import *
      4 from evaluate import *

ImportError: No module named 'saliency'

This is after I installed the package properly (I think...) using the following command:

pip install git+https://github.com/yhenon/pyimgsaliency.git

Now, the init.py file (whose full path is c:\Users\USER\Anaconda3\envs\tracx\Lib\site-packages\pyimgsaliency__init__.py) has the following content:

from saliency import *
from binarise import *
from saliency_mbd import *
from evaluate import *  

It all seems legit, so what, oh what, am I doing wrong?

P.S. I am running the Jupyter notebook from within the 'tracx' environment in the Anaconda Prompt so it is probably not that sort of problem).

Felix Goldberg
  • 401
  • 4
  • 18
  • Did you check that you installed your package for the same Python version that you are running? – volcano Nov 22 '17 at 17:33
  • @volcano I don't think that the package has different versions - perhaps I missed something? How does one check? Anyway, I made sure to perform all operations within the same conda environment so probably the answer is yes. – Felix Goldberg Nov 22 '17 at 18:59
  • If you have both 2 and 3 on your machine, _pip_ may be related to Python2 and _pip3_ - to Python3. You did not specify which Python version you use. I failed to install the package with _pip3_. – volcano Nov 22 '17 at 22:04
  • The package is definitely Python2 - _iteritems_ does not exist in 3 – volcano Nov 22 '17 at 22:12
  • It's too bad that the pyimgsaliency package on github didn't include either installation instructions or a requirements file so you could [follow instructions like this](https://stackoverflow.com/questions/10333814/tell-pip-to-install-the-dependencies-of-packages-listed-in-a-requirement-file), to get everything up and running... – Projski Nov 23 '17 at 01:09

0 Answers0