Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems with some modules #5225

Closed
joselivera opened this issue Feb 6, 2021 · 9 comments
Closed

Problems with some modules #5225

joselivera opened this issue Feb 6, 2021 · 9 comments

Comments

@joselivera
Copy link

When i try to run this code:

import cv2 as cv
import skimage
import matplotlib as plt
from skimage.feature import local_binary_pattern

This error appears:

ImportError Traceback (most recent call last)
in
2 import skimage
3 import matplotlib as plt
----> 4 from skimage.feature import local_binary_pattern

C:\Program Files\Python39\lib\site-packages\skimage\feature_init_.py in
1 from .._shared.utils import deprecated
2
----> 3 from ._canny import canny
4 from ._cascade import Cascade
5 from ._daisy import daisy

C:\Program Files\Python39\lib\site-packages\skimage\feature_canny.py in
16 import scipy.ndimage as ndi
17 from scipy.ndimage import generate_binary_structure, binary_erosion, label
---> 18 from ..filters import gaussian
19 from .. import dtype_limits, img_as_float
20 from .._shared.utils import check_nD

C:\Program Files\Python39\lib\site-packages\skimage\filters_init_.py in
2 from ._gaussian import (gaussian, _guess_spatial_dimensions,
3 difference_of_gaussians)
----> 4 from .edges import (sobel, sobel_h, sobel_v,
5 scharr, scharr_h, scharr_v,
6 prewitt, prewitt_h, prewitt_v,

C:\Program Files\Python39\lib\site-packages\skimage\filters\edges.py in
16 from scipy.ndimage import convolve, binary_erosion
17
---> 18 from ..restoration.uft import laplacian
19
20 # n-dimensional filter weights

C:\Program Files\Python39\lib\site-packages\skimage\restoration_init_.py in
11 from .inpaint import inpaint_biharmonic
12 from .j_invariant import calibrate_denoiser
---> 13 from .rolling_ball import rolling_ball, ball_kernel, ellipsoid_kernel
14
15

C:\Program Files\Python39\lib\site-packages\skimage\restoration\rolling_ball.py in
1 import numpy as np
2
----> 3 from ._rolling_ball_cy import apply_kernel, apply_kernel_nan
4
5

ImportError: DLL load failed while importing _rolling_ball_cy: Não foi possível encontrar o módulo especificado.

When i go to the directory, this is the file names:
Captura de Tela (3)
I already reinstaled scikit-image.

@joselivera
Copy link
Author

I solved my problem using conda instead of python + pip. For some reason, python + pip works on linux but not in windows.

@hmaarrfk
Copy link
Member

hmaarrfk commented Feb 7, 2021

I think this is similar to an issue with windows system dlls not being installed.

conda ships manyof the system dlls required.

@grlee77
Copy link
Contributor

grlee77 commented Feb 9, 2021

@joselivera I will go ahead close this for now, but if you can provide a minimal reproducible example for creating a new environment with the issue, please reopen the issue and we can take a look.

e.g. something like

conda create -n skimage_test python=3.8
conda activate skimage_test
pip install scikit-image
python -c "import skimage"

@hmaarrfk: Is there something we need to add or improve in our Windows install instructions regarding system dlls when installing from pip?

@DavidStirling
Copy link

@grlee77 I've been encountering this issue as well. Things seem to run fine on Windows 10, but on Windows Server 2019 (AWS machine) installing Skimage 0.18.1 with pip results in an installation which can't import several packages. For example import skimage.restoration will produce the error ImportError: DLL load failed while importing _rolling_ball_cy: The specified module could not be found..

Oddly enough everything works fine with 0.16.2.

Here's a pip freeze:

decorator==4.4.2
imageio==2.9.0
kiwisolver==1.3.1
matplotlib==3.3.4
networkx==2.5
numpy==1.20.0
pandas==1.2.1
Pillow==8.1.0
pyparsing==2.4.7
python-dateutil==2.8.1
pytz==2021.1
PyWavelets==1.1.1
scikit-image==0.18.1
scipy==1.6.0
six==1.15.0
tifffile==2021.2.1

@DavidStirling
Copy link

An update - turns out installing the C++ Redistributable for Visual Studio 2019, mentioned here, gets it working.

@jni
Copy link
Member

jni commented Feb 18, 2021

Thanks @DavidStirling for weighing in. I'm still not sure what the best way to fix this is from our end. Clearly many users are faced with this issue. I'm hoping to release 0.18.2 soon so it would be great to have a consensus on how to move forward. @scikit-image/core any ideas? (See also #4780 for more context.) The two leading contenders for me are:

@DavidStirling
Copy link

Thanks for the info @jni - in hindsight it follows that our virtual machines, being a blank Windows install, would be lacking the framework dlls. I'm curious why 0.16 didn't have this problem - did the compiling language change, or did you have another solution in older versions (or something else entirely)?

As for a fix, packing the files into the wheel sounds like a reasonable approach, but if multiple other packages do the same that results in a fair amount of duplication. On the other hand, if msvc-runtime is a reliable package that may be a decent solution for the wider community. If there's a reason that matplotlib and pandas avoided this then fair enough, but if they were simply unaware of it then it might be worth consideration as a more effective solution for everyone.

@jni
Copy link
Member

jni commented Feb 18, 2021

I'm curious why 0.16 didn't have this problem

I think we didn't have any code that used the C++ stdlib, or if we did, it was not part of the "default" imports that skimage triggers at a package level.

As to msvc-runtime, if you look at the discussion in #4780, it does not seem to be officially supported or particularly well-maintained...

@DavidStirling
Copy link

I did see that, but I figured that once you have the runtimes installed there shouldn't be much need to update or modify them further in most cases.

I totally understand about it not being officially supported, I was more wondering if it should be. Something being new and not widely used doesn't necessarily make it a bad solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants