DIPlib / diplib

Quantitative Image Analysis in C++, MATLAB and Python
https://diplib.org
Apache License 2.0
228 stars 50 forks source link

PyDIP not importing #41

Closed shbrainard closed 5 years ago

shbrainard commented 5 years ago

After running all of the cmake commands on Mac OS (10.14) without any errors, I am attempting to import the library into Python (3.6), and receive the following error:

ModuleNotFoundError: No module named 'PyDIP'

Has anyone else had this issue / have suggestions for figuring out what’s causing it?

Thanks!

creimers commented 5 years ago

Funny enough, I'm experiencing the same problem also today.

Went through INSTALL_MacOS.md no problem, but then can't import.

Even tried this trick, but no success.

I am also on macOS 10.14.

creimers commented 5 years ago

Oki doki, now I got it up and running by explicitly calling make PyDIP followed by make install. Still not sure why that is.

crisluengo commented 5 years ago

@shbrainard Could you please attach the output of the cmake command and the make install command? (Copy-paste the text into an editor, attach the text file; don't upload screen shots.)

@creimers You should not need to explicitly make PyDIP, make by itself (or make install) should make PyDIP if it's configured. Though I'm glad you got it to work. :)

shbrainard commented 5 years ago

Hi @crisluengo,

@creimers trick got it running for me as well. However, I'm running through some of the example code, and none of the visualization features seem to be working. For example:

boat$ python3.6 Python 3.6.5 (default, Jun 17 2018, 12:13:06) [GCC 4.2.1 Compatible Apple LLVM 9.1.0 (clang-902.0.39.2)] on darwin Type "help", "copyright", "credits" or "license" for more information.

import PyDIP as dip a = dip.Image((512, 512)) dip.DrawEllipsoid(a, (200, 200), (256, 256)) dip.DrawEllipsoid(a, (50, 50), (350, 350)) gv = dip.Gradient(a) gm = dip.Norm(gv) bin = dip.IsodataThreshold(gm) dip.viewer.Show(bin, "Input") Traceback (most recent call last): File "", line 1, in AttributeError: module 'PyDIP' has no attribute 'viewer'

Not sure what the issue is here, though I do have matplotlib installed:

matplotlib.version '3.1.1'

crisluengo commented 5 years ago

@shbrainard dip.viewer.Show requires that you build the DIPviewer module. Use dip.Show if you don't. dip.Show uses matplotlib. See here for details.