conda-forge / pillow-feedstock

A conda-smithy repository for pillow.
BSD 3-Clause "New" or "Revised" License
2 stars 29 forks source link

ImportError: DLL load failed: The specified module could not be found. #45

Closed amueller closed 6 years ago

amueller commented 6 years ago

Some of my users have reported an error trying to import PIL: https://github.com/amueller/word_cloud/issues/356

They are using this version:

    pillow:          5.1.0-py36_0      conda-forge

This seems related: https://github.com/python-pillow/Pillow/issues/2945

almarklein commented 6 years ago

For reference, this seems to be the (somewhat sad) workaround:

$ conda remove pillow
$ pip install pillow
ocefpaf commented 6 years ago

Please ask your users to post the issue here with more details.

amueller commented 6 years ago

@ocefpaf there's some more detail in the two issues I linked to. What do you need to know?

steremma commented 6 years ago

While the workaround works, it is suboptimal in cases where pillow is a requirement of another project being conda install'ed. In that case, even if I temporarily fix the issue using the proposed solution, the next installation will override the pip install'ed version of pillow.

Could we somehow force an installation of the depended package (wordcloud in this case) to NOT install its dependencies but use the existing one's instead?

Sorry for not providing details but i am not on Windows atm, if its needed I can provide them tomorrow.

ocefpaf commented 6 years ago

@ocefpaf there's some more detail in the two issues I linked to.

OK. So it seems that the issue happens on Windows. That s the hardest for us to debug b/c most of us do not use Windows.

What do you need to know?

Can you try a fresh env? It usually helps to debug things,

conda create --name TEST --channel conda-forge pillow wordcloud
conda activate TEST
python -c 'import  wordcloud; print(wordcloud.__version__)'

If that fails please paste the results of conda info --all and conda list for that env.

amueller commented 6 years ago

You can also just import PIL to get the error, I think.

hugovk commented 6 years ago

Pillow has a public Python interface, and a private C core.

When the Python layer tries to use the C layer, it does a version check to ensure they're both the same version.

The error in https://github.com/amueller/word_cloud/issues/356 is when they have different versions.

What must be happening is there's one version of pip installed Pillow and another version of conda installed Pillow.

Then whichever Python part of Pillow is being run is trying to access the C part from the other version.

ocefpaf commented 6 years ago

Pillow has a public Python interface, and a private C core.

That is why we need the fresh env test in https://github.com/conda-forge/pillow-feedstock/issues/45#issuecomment-383955861

ocefpaf commented 6 years ago

Closing this as stale. If someone is still experiencing this please open a new issue with more details so we can investigate.

amueller commented 6 years ago

I keep getting issues on that, I'll try to direct them here.

ocefpaf commented 6 years ago

I keep getting issues on that, I'll try to direct them here.

Please do. Unfortunately we could not reproduce that error and without communication with the people reporting it things get hard to reproduce. Thanks!

carlodri commented 6 years ago

@ocefpaf I just stumbled into this (at least, it looks like the same issue to me) in an AppVeyor CI for a feedstock: https://ci.appveyor.com/project/conda-forge/pycroscopy-feedstock/build/1.0.17/job/7e4a3cl9i0f9wvxv CI triggered from https://github.com/conda-forge/pycroscopy-feedstock/pull/4

ocefpaf commented 6 years ago

Recently this may be related to https://github.com/conda/conda/issues/7626

carlodri commented 6 years ago

@ocefpaf thanks, although I'm honestly not deep enough into conda to fully understand what's going on there. Do you have any practical suggestion to get out of the rabbit hole in our specific case of https://github.com/conda-forge/pycroscopy-feedstock/pull/4?

carlodri commented 6 years ago

@ocefpaf in fact, in the failing CI, pillow is taken from the defaults channel (https://ci.appveyor.com/project/conda-forge/pycroscopy-feedstock/build/1.0.18/job/d751rvrngowts87c#L952), whereas just one commit before, it was taken from conda-forge (https://ci.appveyor.com/project/conda-forge/pycroscopy-feedstock/build/1.0.16/job/tpkbh7pcq9u3m5uf#L952)

do you have any suggestions?

ocefpaf commented 6 years ago

do you have any suggestions?

Make noise here https://github.com/conda/conda/issues/7626

There is nothing we can do, it is a bun in conda.

carlodri commented 6 years ago

but does pillow use features?

ocefpaf commented 6 years ago

Most pillow dependencies do.

absognety commented 6 years ago

I solved by using subprocess, remove all improper installations of pillow and wordcloud left overs using conda remove pillow,conda remove wordcloud and manually remove the cache and folders manually from former installations and use subprocess.check_call(["python", '-m', 'pip', 'install', 'pillow'] and subprocess.check_call(["python", '-m', 'pip', 'install', 'wordcloud'] for later versions of pip ( from 10.0.0) which has no main function as a method within the class, if you want to use pip from within Ipython or python console/interpreter.

carlodri commented 6 years ago

This issue is still blocking this PR https://github.com/conda-forge/pycroscopy-feedstock/pull/4

carlodri commented 6 years ago

Most pillow dependencies do.

really? I can't see a single one using the features or track_features keywords... probably I'm missing something...

carlodri commented 6 years ago

solved with a hack from https://github.com/conda-forge/hyperspy-feedstock/pull/24, simply adding this version constraint in the recipe: pillow >5.2

⚠️ I haven't the slightest idea of why this works.... ⚠️

hadim commented 5 years ago

Can you reopen here, please? The issue still happens: https://github.com/maartenbreddels/ipyvolume/issues/208#issuecomment-442877181

hadim commented 5 years ago

Or maybe pillow >5.2 is the only way to easily get around this.