Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Can't import package
I'm trying to follow a tutorial for Image comparison.
But as soon as i try
from skimage.measure import structural_similarity as ssim
it throws an exception:
Quote:Traceback (most recent call last):
File "<pyshell#10>", line 1, in <module>
from skimage.measure import structural_similarity as ssim
ImportError: cannot import name 'structural_similarity' from 'skimage.measure' (C:\Users\Thomas\AppData\Local\Programs\Python\Python39\lib\site-packages\skimage\measure\

I have imported scikit-image with
Quote:pip install scikit-image
and it everything installed without problems.
I think it propably has to do with the different versions but I don't know how to fix it.
I hope someone can help me.
quick search shows that in ver 0.12 it was depreciated and renamed
Quote:measure.structural_similarity has been renamed measure.compare_ssim

further they were moved to different module, under different names

Quote:The following functions are deprecated and will be removed in 0.18: skimage.measure.compare_mse, skimage.measure.compare_nrmse, skimage.measure.compare_pnsr, skimage.measure.compare_ssim Their functionality still exists, but under the new skimage.metrics submodule under different names.

so, it should be this:

Not familiar and not sure if it will work, but you can try to

from skimage.metrics import structural_similarity as ssim
hubenhau likes this post
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs


Possibly Related Threads…
Thread Author Replies Views Last Post
  Unable to import sklearn after installing any package ilango 0 807 Oct-25-2021, 07:03 AM
Last Post: ilango
  import scalalib package doesn't work manu_brighter 2 2,212 Apr-17-2020, 06:36 PM
Last Post: snippsat
  Importing module from a package results in import error goghvv 2 1,734 Mar-27-2020, 07:13 PM
Last Post: goghvv
  Import all items from all modules from package DD169 3 1,467 Jan-25-2020, 12:33 PM
Last Post: buran
  package import issues groovydingo 4 2,730 Oct-03-2018, 11:26 AM
Last Post: groovydingo
  ValueError: Attempted relative import in non-package JoeB 1 9,960 Mar-08-2018, 11:01 AM
Last Post: Gribouillis
  I can't import own package of file from file. harun2525 4 3,131 Jun-07-2017, 06:03 PM
Last Post: nilamo
  PostgreSQL- import package elhetch 2 4,069 Jun-07-2017, 02:07 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020