Intel® Distribution for Python*
Engage in discussions with community peers related to Python* applications and core computational packages.

incomplete scikit distribution

Scott_F_
Beginner
1,229 Views

There are a number of methods in the skimage.measure package that are not included in intel python 2.7.

These are in the anaconda distribution directory. Is there a way to use anacondas version of  skimage.measure instead? 

A few missing methods that I've identified.

skimage.measure.*

grid_points_in_poly

label

points_in_poly

profile_line

 

I'm using a mac. 

0 Kudos
11 Replies
Todd_T_Intel
Employee
1,229 Views

Scott,

The scikit-image package was not included in Intel Distribution for Python (IDP) 2017 update 1. Look for scikit-image to be included in IDP in the very near future!

Until then, you should be able to obtain those methods by installing scikit-image from anaconda.org:

conda install scikit-image

Please let me know if you have any trouble installing scikit-image from anaconda.org.

Todd

0 Kudos
Scott_F_
Beginner
1,229 Views

Hi,

Thanks for your reply. I followed your advice:

I have installed scikit-image using the command you suggested. I already had it.

Note the output below where I show that I am using the intel python distribution.

I then the import  skimage.measure and attempt to call the 'label' method. 

I still get the error that this method is unavailable. 

Am I doing something wrong? 

Thanks, 

Scott

 

 

 

Using Anaconda API: https://api.anaconda.org

Fetching package metadata .........

Solving package specifications: ..........

 

# All requested packages already installed.

# packages in environment at /opt/intel/intelpython27:

#

scikit-image              0.9.3                np17py27_0  

 

 

[Mon Jan 30 14:07:56 ~/Dropbox/Lucidyne/LUCIDYNE/ActionJackson 501 21] $ which python

python is /opt/intel/intelpython27/bin/python

 

[Mon Jan 30 14:11:12 ~/Dropbox/Lucidyne/LUCIDYNE/ActionJackson 504 24] $ python

Python 2.7.12 |Intel Corporation| (default, Oct 19 2016, 16:39:13) 

[GCC 4.2.1 Compatible Apple LLVM 7.3.0 (clang-703.0.31)] on darwin

Type "help", "copyright", "credits" or "license" for more information.

Intel(R) Distribution for Python is brought to you by Intel Corporation.

Please check out: https://software.intel.com/en-us/python-distribution

>>> import skimage.measure

>>> skimage.measure.label

Traceback (most recent call last):

  File "<stdin>", line 1, in <module>

AttributeError: 'module' object has no attribute 'label'

>>> 

 

0 Kudos
Todd_T_Intel
Employee
1,229 Views

Scott,

skimage.measure.label is a method, so you need parentheses and the appropriate input parameters:

skimage.measure.label(input)

See http://scikit-image.org/docs/dev/api/skimage.measure.html for details on the API.

Hope that does the trick!

Todd

0 Kudos
Scott_F_
Beginner
1,229 Views

 

Sorry, I sent a bad example.

See the series of import statement below:

In [3]: from skimage.measure import block_reduce

 

In [4]: from skimage.measure import regionprops

 

In [5]: from skimage.measure import moments_hu

 

In [6]: from skimage.measure import label

---------------------------------------------------------------------------

ImportError                               Traceback (most recent call last)

<ipython-input-6-60e17ff02189> in <module>()

----> 1 from skimage.measure import label

 

ImportError: cannot import name label

0 Kudos
Todd_T_Intel
Employee
1,229 Views

Scott,

Okay, I think the problem is due to your scikit-image version, which is 0.9.3. I was able to install 0.12.3 and execute the imports fine. I do not see measure.label in the API specification for skimage 0.9.3. Try updating you scikit-image package as follows:

conda update scikit-image

Then try your imports again.

Todd

0 Kudos
Scott_F_
Beginner
1,229 Views

Conda update of scikit-image does not bring me up to version 0.13.

I'm told that all packages are already installed, and that version is 0.9.

Thanks for your attention! 

 

conda update scikit-image

 

 

Solving package specifications: ..........

 

# All requested packages already installed.

# packages in environment at /opt/intel/intelpython27:

#

scikit-image              0.9.3                np17py27_0 

 

 

In [5]: skimage.__version__

Out[5]: '0.9.3'

0 Kudos
Todd_T_Intel
Employee
1,229 Views

Scott, I would guess there is a package conflict with the newer version that conda cannot resolve. Try telling conda expressly to install the newer version:

conda install scikit-image=0.12.3

It probably won't work, but it should give you a conflict report that tells you why it can't upgrade. Let me know what happens when you try that.

Todd

0 Kudos
Scott_F_
Beginner
1,229 Views

 

Below is the result!

 

The following specifications were found to be in conflict:

  - scikit-image 0.12.3*

  - scikits-image -> numpy 1.5*|1.6*|1.7*

  - scikits-image -> python 2.6*

 

My numpy version is 1.7.1

My python version is 2.7.1,

so I'm a bit confused about the conflict message. 

 

Thanks again for your attention!

Scott

0 Kudos
Todd_T_Intel
Employee
1,229 Views

Scott,

Yes, that report is confusing. First of all "scikits-image" with the extra "s" is not even what you were trying to install!

But I think the real reason is your numpy version is too low. Looking at the results of "conda info scikit-image=0.12.3" shows all the builds and their dependencies. The lowest numpy version is 1.10. Can you upgrade your numpy? 1.7 is pretty old. The oldest we shipped was 1.11.

If you want to try our performance enhancements, you might want to start by creating a fresh environment with our latest release, which will include numpy 0.11.2, and add scikit-image to that (0.12.3 is compatible).

conda create -n intelpy2017u1 python=2 intelpython2_full

But it looks like you will need to update multiple packages to get skimage.measure.label.  Another option is to look through the scikit-image docs I linked you to earlier and find the version that first introduced that method. Perhaps an older version will give you the methods you want without needing to update too much (though you will need to update something because 0.9.3 is the newest that is compatible with your other packages).

I would recommend upgrading broadly, though. You will get security and performance enhancements.

Todd

0 Kudos
Scott_F_
Beginner
1,229 Views

I downloaded the intel python environment yesterday so all the modules included are from that release. 

I uninstalled scikits-image (note the extras 's' on scikit) .

I also uninstalled opencv because it conflicted with later versions of scikit-image. 

Once I uninstalled opencv, skimage and numpy updated! 

                                           Total:        20.7 MB

 

The following NEW packages will be INSTALLED:

 

    jbig:         2.1-0                  

    jpeg:         9b-0                   

    libtiff:      4.0.6-3                

    networkx:     1.11-py27_0            

    pillow:       4.0.0-py27_0           

    xz:           5.2.2-intel_14    intel [intel]

 

The following packages will be REMOVED:

 

    opencv:       2.4.8-np17py27_2       

 

The following packages will be UPDATED:

 

    numexpr:      2.3.0-np17py27_0        --> 2.6.1-np111py27_intel_5  intel [intel]

    numpy:        1.7.1-py27_2            --> 1.11.2-py27_intel_2      intel [intel]

    scikit-image: 0.9.3-np17py27_0        --> 0.12.3-np111py27_1            

    scipy:        0.13.2-np17py27_1       --> 0.18.1-np111py27_intel_1 intel [intel]

So it looks like opencv was gating my ability to update numpy and scikit-image.

Is there a way of using opencv without reverting back to earlier versions of the other packages? 

Thanks again. 

 

0 Kudos
Todd_T_Intel
Employee
1,229 Views

Scott,

Glad you were able to upgrade!

opencv was definitely the problem. Continuum has only one version available in the defaults channel, and that version requires numpy=1.7*.

Your options for getting a newer version:

  1. Build it yourself (I found some guides using Google)
  2. Install from conda-forge (community-built conda packages)
    1. conda install opencv -c conda-forge
  3. Wait for an Intel build of the package, which we are hoping to have a trial version of in the near future

Let me know if options 1 or 2 work for you.

Todd

0 Kudos
Reply