flrs / blend_modes

Python package that implements image blend modes
MIT License
140 stars 29 forks source link

Can't import #10

Closed ThePromenader closed 5 years ago

ThePromenader commented 5 years ago

Hello,

I installed using pip, but I can't seem to import the module, even using importlib. It is present in the proper directory, and all the other modules therein are functioning perfectly (so it is not a $PATH issue).

Thank you.

PS: running Python 3 on Mac OSX 10.12.6 Sierra. PPS: I even tried installing from source, same issue.

PPPS: after installing from source (setup.py), I managed to resolve the issue by moving the egg-info manually to my python package directory, creating a 'blend_modes' directory there as well, and moving blend_modes.py into that.

flrs commented 5 years ago

Interesting. I just tried reproducing your problem but on my system everything installed (and tested) fine via pip. I tested on Python 3.7.2 on Mac OSX 10.14.4 Mojave. What do you mean by "can't seem to import the module"? Did you try to run any particular piece of code?

ThePromenader commented 5 years ago

Thanks for your reply (and for your module!)

By 'can't import' I mean that even 'import blend_modes' in a python script results in a 'module not found'.

In both the methods I indicated earlier, in the python packages directory, the package info files (an .egg file for the 'from source' method, the module-info directory using pip) are installed, but the 'blend_modes.py' (and the directory that should contain it) file is not.

flrs commented 5 years ago

Are you using pip in any specific framework such as Conda?

ThePromenader commented 5 years ago

No, the only concurrant element I have would be homebrew.

Other pip installations (before and after) work well. I'll try something else today just to be sure, though.

I'm also doing a system-wide search (as we speak) to see whether it was inadvertantly installed somewhere else.

(update): No, unfortunately. For the record, I made a few more pip installs today, and they are all functioning.

ThePromenader commented 5 years ago

I've looked at pretty well everything here: no $PATH issues, and no naming conflicts as the package is the only thing on my system (or anywhere) with the name 'blend_modes'.

To resume: Installing through pip (tried also with --no-cache-dir) results in the creation of a 'blend_modes-2.0.1-py3.7.egg-info' folder, and that's it: no accompanying directory (that should contain the "blend_modes.py" file). An attempt to import (into a script) results in a 'ModuleNotFoundError: No module named 'blend_modes'" error.

Installing from source (from here): results in the creation of a 'blend_modes-2.0.1-py3.7.egg' file (when unzipped containing the same files as the above 'egg-info' folder), and no 'blend_modes.py' file, anywhere.

Moving manually the 'blend_modes.py' file to the Python packages directory into a 'blend_modes' directory therein) results in no import error, but when I try to print('blend_modes') (which should return the file path), I get '(namespace)' instead.

Only manually moving the blend_modes.py file to the Packages directory root (without an enclosing 'blend_modes' folder) worked.

This sure is odd, and I do hope it has nothing to do with my setup here, but I tested all I could to remove that hypothesis.

marianabianca commented 5 years ago

I've just had the same problem when trying to import the module and I installed it using pip as well. I got the message: ImportError: No module named blend_modes.

dominikandreas commented 5 years ago

Same here. Ubuntu 18, python 3.6.7, pip 19.0.3

flrs commented 5 years ago

Thanks @dominikandreas for fixing this. I have tested your fixes, bumped up the version, and distributed it on pypi.

@ThePromenader and @marianabianca, would you kindly confirm if @dominikandreas' modifications fix the issues on your sides, too? Thanks!

For folks reading this thread, please update your blend_modes version to v2.0.2. If you are using pip, this is the command you are looking for: pip install blend_modes --upgrade

marianabianca commented 5 years ago

Now it's working! Thank you @dominikandreas!!

flrs commented 5 years ago

Glad to hear the release fixed the problem. Issue resolved!