Peter554 / StainTools

Tools for tissue image stain normalisation and augmentation in Python 3
MIT License
321 stars 107 forks source link

ModuleNotFoundError after installation #23

Closed ntomita closed 6 years ago

ntomita commented 6 years ago

Hi Peter,

I got a ModuleNotFoundError when importing staintools. Here's the traceback:

Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
  File "/lib/python3.6/site-packages/staintools/__init__.py", line 1, in <module>
    from .stain_extractors.macenko_stain_extractor import MacenkoStainExtractor
ModuleNotFoundError: No module named 'staintools.stain_extractors'

I installed staintools via pip on Ubuntu16.04 with python 3.6. I installed the required library as well. Do you have any idea why this happens and how to make it work properly?

ghost commented 6 years ago

Same here, on ubuntu 16.04, python 3.5.

  1. After installing staintools from pip, I could not find the stain_extractors directory in the package directory. Terminal screen for demonstration:

    scorbie@scorbie-laptop /usr/local/lib/python3.5/dist-packages/staintools
    $ ls
    __init__.py  reinhard_color_normalizer.py  stain_normalizer.py
    __pycache__  stain_augmentor.py            utils
  2. On setup.py, line 14 setuptools.find_packages() is used.

  3. Browsing the setuptools documentation, it seems like find_packages() only recognizes packages that contain __init__.py, which only stain_extractors does not have.

Thus, I think a simple fix of adding __init__.py to the stain_extractors directory may solve the issue. I'll test it and send you a pull request if it works.

Edit: That worked. Am writing a pull request right now. Until the change gets on its way, one can manually apply the change by manually copying the missing folders and files from Github.

ntomita commented 6 years ago

Awesome, thanks! @Scorbie

Peter554 commented 6 years ago

Yes sorry not sure how I missed that init file