MIC-DKFZ / niicat

This is a tool to quickly preview nifti images on the terminal
GNU General Public License v2.0
51 stars 10 forks source link

name 'libsixel' is not defined #2

Closed TheChymera closed 4 years ago

TheChymera commented 4 years ago

I have started work on making your software automatically accessible on Gentoo Linux. However there seems to be an issue with the installation:

chymera@darkhost ~ $ niicat /usr/share/mouse-brain-atlases/dsurqec_200micron.nii 
Traceback (most recent call last):
  File "/usr/lib/python-exec/python3.6/niicat", line 34, in <module>
    main()
  File "/usr/lib/python-exec/python3.6/niicat", line 30, in main
    plot_preview(args.nifti_file)
  File "/usr/lib64/python3.6/site-packages/niicat/niipre.py", line 222, in plot_preview
    plot_sixel(fig)
  File "/usr/lib64/python3.6/site-packages/niicat/niipre.py", line 26, in plot_sixel
    if not libsixel:
NameError: name 'libsixel' is not defined

This is surprising, because the libsixel package is installed, providing the following files:

darkhost ~ # equery f media-libs/libsixel
 * Searching for libsixel in media-libs ...
 * Contents of media-libs/libsixel-1.8.2:
/usr
/usr/bin
/usr/bin/img2sixel
/usr/bin/libsixel-config
/usr/bin/sixel2png
/usr/include
/usr/include/sixel.h
/usr/lib64
/usr/lib64/libsixel.so -> libsixel.so.1.0.6
/usr/lib64/libsixel.so.1 -> libsixel.so.1.0.6
/usr/lib64/libsixel.so.1.0.6
/usr/lib64/pkgconfig
/usr/lib64/pkgconfig/libsixel.pc
/usr/share
/usr/share/bash-completion
/usr/share/bash-completion/completions
/usr/share/bash-completion/completions/img2sixel
/usr/share/doc
/usr/share/doc/libsixel-1.8.2
/usr/share/doc/libsixel-1.8.2/ChangeLog.bz2
/usr/share/doc/libsixel-1.8.2/NEWS.bz2
/usr/share/doc/libsixel-1.8.2/README.md.bz2
/usr/share/doc/libsixel-1.8.2/images
/usr/share/doc/libsixel-1.8.2/images/egret.jpg
/usr/share/doc/libsixel-1.8.2/images/map16.png
/usr/share/doc/libsixel-1.8.2/images/map8.png
/usr/share/doc/libsixel-1.8.2/images/snake.jpg
/usr/share/doc/libsixel-1.8.2/images/vimperator3.png
/usr/share/man
/usr/share/man/man1
/usr/share/man/man1/img2sixel.1.bz2
/usr/share/man/man1/sixel2png.1.bz2
/usr/share/man/man5
/usr/share/man/man5/sixel.5.bz2
/usr/share/zsh
/usr/share/zsh/site-functions
/usr/share/zsh/site-functions/_img2sixel

Any idea what's going wrong?

wasserth commented 4 years ago

This is referring to libsixel-python. You have to do pip install libsixel-python to avoid this. In the newest version of niicat this is part of the requirements.txt file and the install_requires of setup.py so it should actually be installed automatically.

wasserth commented 4 years ago

I adapted the code so it will not result in an error but give a meaningful message to the user if libsixel-python is missing.