Search code examples
pythoninstallationsetuptools

Cant run sloth annotation tool


Im trying to use annotation tool Sloth. how do i get the program to run?

JMAIR-3:sloth user$ which python
/usr/local/bin/python
JMAIR-3:sloth user$ python --version
Python 2.7.10
JMAIR-3:sloth user$ brew install PyQt
Warning: pyqt-4.11.4 already installed
JMAIR-3:sloth user$ ls
COPYING     LICENSE     README.md   build       doc     examples    scripts     setup.py    sloth       tests
JMAIR-3:sloth user$ sloth
-bash: sloth: command not found
JMAIR-3:sloth user$ sudo python setup.py install 
Password:
running install
running build
running build_py
running build_scripts
running install_lib
running install_scripts
changing mode of /usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/bin/sloth to 755
running install_data
running install_egg_info
Removing /usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/sloth-1.0-py2.7.egg-info
Writing /usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/sloth-1.0-py2.7.egg-info
JMAIR-3:sloth user$ sloth
-bash: sloth: command not found
JMAIR-3:sloth user$ sloth examples/example1_labels.json
-bash: sloth: command not found


 python sloth
/usr/local/opt/python/bin/python2.7: can't find 'main' module in 'sloth'

Solution

  • Sloth is an executable Python script . So, to run it you can call it from terminal:

    PATH_PREFIX_TO_YOUR_PYTHON/Python27/Lib/site-packages/sloth/bin/sloth
    

    You might add sloth script directory to your PATH , by editing yout .bashrc file:

    export PATH=$PATH:PUT_PATH_TO_SLOTH_HERE
    

    And then run source .bashrc in order for changes to take effect. After that, typing sloth in a terminal window should open the GUI.

    In Windows, I managed to run it using Git Bash (Git installation for Windows provides a Bash emulator by default) . In a Git Bash terminal Window, use the following (you may need to chage if your Python installation directory is different):

    /c/Python27/Lib/site-packages/sloth/bin/sloth