hadim / read-roi

Read ROI files .zip or .roi generated with ImageJ.
BSD 3-Clause "New" or "Revised" License
51 stars 22 forks source link

read-roi doesn't work in python 3.6 #24

Closed kazemSafari closed 4 years ago

kazemSafari commented 4 years ago
from read_roi import read_roi_zip
ImportError: cannot import name 'read_roi_zip'
scottclowe commented 4 years ago

Our unit test suite automatically runs on Travis for several Python versions, 3.6 included, and has experienced no issues.

I suspect you may have pip installed the read_roi package into a different virtual environment (or python installation) than the one you are in when you are trying to import it. If this is the case, you'll see that import read_roi will also fail, and the problem can be resolved merely by installing read_roi with pip into your current virtual environment.

scottclowe commented 4 years ago

I'll close this and can re-open in the event of any follow up providing more details so the error can be reproduced. I expect my previous suggestion will be sufficient to resolve the issue.

kazemSafari commented 4 years ago

Thank you for your reply. I am using Ubuntu 16.04 and Python 3.6.10. I first unzipped the directory and then installed it via pip install read-roi in my virtualenv. pip freeze shows that read-roi version 1.6.0 has been successfully installed in my virtualenv. import read_roi does not raise any errors. However when I run the example code:

import read_roi
from read_roi import read_roi_file
from read_roi import read_roi_zip

roi = read_roi_file(roi_file_path)
# or
rois = read_roi_zip(roi_zip_path)

I get the following error:

Traceback (most recent call last):
  File ".../read_roi.py", line 1, in <module>
    import read_roi
  File ".../read_roi.py", line 2, in <module>
    from read_roi import read_roi_file
ImportError: cannot import name 'read_roi_file'

Process finished with exit code 1

Can you help with this issue.

kazemSafari commented 4 years ago

I change the master folder name to read_roi, its name in setup.py to read_roi, installed it via pip install read_roi, and now it does not raise the previous errors anymore. Thank you.