losonczylab / roibuddy

SIMA ROI Editing and Registration Tool
GNU General Public License v2.0
9 stars 12 forks source link

ROIBuddy do not Launch #24

Open Ron89 opened 8 years ago

Ron89 commented 8 years ago

After successfully installed ROIBuddy with

pip2 install roibuddy --user
mv ~/.local/bin/roibuddy ~/.local/bin/roibuddy2
pip3 install roibuddy --user
mv ~/.local/bin/roibuddy ~/.local/bin/roibuddy3

If I use Python 2 version of ROIBuddy, roibuddy2, following error occurs

home/chong/.local/lib/python2.7/site-packages/skimage/filter/__init__.py:6: skimage_deprecation: The `skimage.filter` module has been renamed to `skimage.filters`.  This placeholder module will be removed in v0.13.
  warn(skimage_deprecation('The `skimage.filter` module has been renamed '
Traceback (most recent call last):
  File "/home/chong/.local/bin/roibuddy2", line 7, in <module>
    from roibuddy.roi_buddy import main
  File "/home/chong/.local/lib/python2.7/site-packages/roibuddy/roi_buddy.py", line 32, in <module>
    from guidata import qthelpers
  File "/home/chong/.local/lib/python2.7/site-packages/guidata/__init__.py", line 541, in <module>
    import guidata.config
  File "/home/chong/.local/lib/python2.7/site-packages/guidata/config.py", line 15, in <module>
    from guidata.configtools import add_image_module_path, get_translation
  File "/home/chong/.local/lib/python2.7/site-packages/guidata/configtools.py", line 22, in <module>
    from guidata.qt.QtGui import (QFont, QLabel, QPixmap, QIcon, QHBoxLayout,
  File "/home/chong/.local/lib/python2.7/site-packages/guidata/qt/__init__.py", line 25, in <module>
    sip.setapi('QString', 2)
ValueError: API 'QString' has already been set to version 1

And if I use Python 3 version of ROIBuddy, roibuddy3, following error occurs

Traceback (most recent call last):
  File "/home/chong/.local/bin/roibuddy3", line 9, in <module>
    load_entry_point('roibuddy==1.0.0', 'gui_scripts', 'roibuddy')()
  File "/usr/lib/python3.5/site-packages/pkg_resources/__init__.py", line 542, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2569, in load_entry_point
    return ep.load()
  File "/usr/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2229, in load
    return self.resolve()
  File "/usr/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2235, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/home/chong/.local/lib/python3.5/site-packages/roibuddy/__init__.py", line 1, in <module>
    from roiBuddyUI import *
ImportError: No module named 'roiBuddyUI'

Eventually nothing works...

I am using Arch Linux with the latest pyqt for both Python2 and Python3. What could be the issue? Is there any way to fix it?

nbdanielson commented 8 years ago

@Ron89 @pkaifosh did you guys try this with Python 2? I'm pulled this change and am now getting this error:

nathan@losonczy-server:~/code-checkouts/roibuddy/roibuddy$ python roi_buddy.py Traceback (most recent call last): File "roi_buddy.py", line 24, in <module> from . import guiqwt_patch ValueError: Attempted relative import in non-package

Should this import be python version dependent?

Ron89 commented 8 years ago

No, direct running roi_buddy.py will end up with that error. Because on line 24 it did tried to import from a folder(current folder) it doesn't know is a a package. This is not version dependent.

Python recognize package by finding __init__.py in the folder. But when you call the script directly, the package identification step has not been done yet, hence the error.

To run the script. You need to import the package first, for example:

$ cd ~/code-checkouts/roibuddy
$ python2

>>> import roibuddy.roi_buddy
jzaremba commented 8 years ago

Hi Ron. I've just pushed a series of commits that should address your issue. I'm going to update the docs as well, but now if you run: python setup.py install you should be able to launch ROIBuddy with either: python -m roibuddy or just roibuddy

This should work in both Python 2 and 3, let us know if you are stilling having issues.