Visidata: AttributeError: '_curses.curses window' object has no attribute 'get_wch'

Created on 30 Sep 2018  ยท  16Comments  ยท  Source: saulpw/visidata

โฏ pip3 install --upgrade visidata                                                                                  
Looking in indexes: https://pypi.org/simple             
Collecting visidata                                                                                                    
  Downloading https://files.pythonhosted.org/packages/41/91/5c63791cbd2418834079508c46b43bd2e6568402c3238b5bd691f732a92d/visidata-1.4.tar.gz (122kB)
    100% |โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ| 122kB 1.5MB/s                                               
Requirement already satisfied, skipping upgrade: python-dateutil in ./Sites/pyenv/versions/3.6.0/lib/python3.6/site-packages (from visidata) (2.7.3)
Requirement already satisfied, skipping upgrade: six>=1.5 in ./Sites/pyenv/versions/3.6.0/lib/python3.6/site-packages (from python-dateutil->visidata) (1.11.0)
Installing collected packages: visidata                                                                                   
  Running setup.py install for visidata ... done                                                                          
Successfully installed visidata-1.4                                                                                

โฏ vd --version                                                                                                                                                                                
saul.pw/VisiData v1.4                                                                                                                                                                         

โฏ python -VV
Python 3.6.0 (default, Jul  3 2018, 16:30:25)
[GCC 7.3.0]

โฏ vd ~/Downloads/faa-wildlife-strikes.csv
Traceback (most recent call last):
  File "/home/kbingham/Sites/pyenv/versions/3.6.0/bin/vd", line 156, in <module>
    main()
  File "/home/kbingham/Sites/pyenv/versions/3.6.0/bin/vd", line 134, in main
    vdtui.run(*sources)
  File "/home/kbingham/Sites/pyenv/versions/3.6.0/lib/python3.6/site-packages/visidata/vdtui.py", line 2736, in run
    ret = wrapper(cursesMain, sheetlist)
  File "/home/kbingham/Sites/pyenv/versions/3.6.0/lib/python3.6/site-packages/visidata/vdtui.py", line 2726, in wrapper
    return curses.wrapper(setupcolors, f, *args)
  File "/home/kbingham/Sites/pyenv/versions/3.6.0/lib/python3.6/curses/__init__.py", line 94, in wrapper
    return func(stdscr, *args, **kwds)
  File "/home/kbingham/Sites/pyenv/versions/3.6.0/lib/python3.6/site-packages/visidata/vdtui.py", line 2723, in setupcolors
    return f(stdscr, *args)
  File "/home/kbingham/Sites/pyenv/versions/3.6.0/lib/python3.6/site-packages/visidata/vdtui.py", line 2749, in cursesMain
    return vd().run(_scr)
  File "/home/kbingham/Sites/pyenv/versions/3.6.0/lib/python3.6/site-packages/visidata/vdtui.py", line 845, in run
    keystroke = self.getkeystroke(scr, sheet)
  File "/home/kbingham/Sites/pyenv/versions/3.6.0/lib/python3.6/site-packages/visidata/vdtui.py", line 728, in getkeystroke
    k = scr.get_wch()
AttributeError: '_curses.curses window' object has no attribute 'get_wch'

Most helpful comment

@saulpw Yep, running 3.6.0 installed with pyenv on Ubuntu 18.04. It works after installing libncurses5 libncurses5-dev libncursesw5 libncursesw5-dev, and re-installing 3.6.0. Thanks also to @MichielVanderlee !

All 16 comments

Weird, this seems to be a duplicate of #178. We've been unable to repro this issue ourselves. It seems like it must be an environment error; maybe there's a conflict with some other installed package? I would love to figure this out so that it doesn't stymie anyone else. @qrkourier, are you running on Linux? How did you install python3.6 itself?

I'm having the same issue but with python3.7
Seems we both used pyenv to install python.

When I ran the following in the default python installation, it worked fine:

$ /usr/bin/python3.6
>>> import visidata
>>> vd = lambda obj: visidata.run(visidata.load_pyobj('foo', obj))

>>> data = [{'a':1, 'b':2, 'c':3}, {'a':4, 'b':5, 'c':6}]
>>> vd(data)

@qrkourier I just followed https://github.com/pyenv/pyenv/issues/240#issuecomment-113902567: with a few changes.

apt-get install libncurses5 libncurses5-dev libncursesw5 libncursesw5-dev
pyenv uninstall 3.7.0
pyenv install 3.7.0
pyenv local 3.7.0
pip install visidata
python -c "import visidata; vd = lambda obj: visidata.run(visidata.load_pyobj('foo', obj)); data = [{'a':1, 'b':2, 'c':3}, {'a':4, 'b':5, 'c':6}]; vd(data);"

Now it works.

Thank you, @MichielVanderlee! I'm glad you found a solution.

@saulpw Yep, running 3.6.0 installed with pyenv on Ubuntu 18.04. It works after installing libncurses5 libncurses5-dev libncursesw5 libncursesw5-dev, and re-installing 3.6.0. Thanks also to @MichielVanderlee !

mmm I have tried to use this way to solve this problem, with "apt-get install libncurses5 libncurses5-dev libncursesw5 libncursesw5-dev" but now I have

ImportError: libncurses.so.6: cannot open shared object file: No such file or directory

If I run sudo apt-get install libncurses6 libncursesw6, then I have

Traceback (most recent call last):
  File "/home/andybandy/miniconda3/bin/vd", line 156, in <module>
    main()
  File "/home/andybandy/miniconda3/bin/vd", line 134, in main
    vdtui.run(*sources)
  File "/home/andybandy/miniconda3/lib/python3.6/site-packages/visidata/vdtui.py", line 2736, in run
    ret = wrapper(cursesMain, sheetlist)
  File "/home/andybandy/miniconda3/lib/python3.6/site-packages/visidata/vdtui.py", line 2726, in wrapper
    return curses.wrapper(setupcolors, f, *args)
  File "/home/andybandy/miniconda3/lib/python3.6/curses/__init__.py", line 94, in wrapper
    return func(stdscr, *args, **kwds)
  File "/home/andybandy/miniconda3/lib/python3.6/site-packages/visidata/vdtui.py", line 2723, in setupcolors
    return f(stdscr, *args)
  File "/home/andybandy/miniconda3/lib/python3.6/site-packages/visidata/vdtui.py", line 2749, in cursesMain
    return vd().run(_scr)
  File "/home/andybandy/miniconda3/lib/python3.6/site-packages/visidata/vdtui.py", line 845, in run
    keystroke = self.getkeystroke(scr, sheet)
  File "/home/andybandy/miniconda3/lib/python3.6/site-packages/visidata/vdtui.py", line 728, in getkeystroke
    k = scr.get_wch()
AttributeError: '_curses.window' object has no attribute 'get_wch'

I'm sorry, I wish I knew what the problem was! Please post here if you figure it out or get any more clues.

Hi @saulpw thank you. What do you think of open again this issue?

Yesterday I have installed pdftk, that was installed with gcj-6-jre-lib libgcj-common libgcj17 libpython-stdlib libpython2.7-minimal libpython2.7-stdlib pdftk python python-minimal python2.7 python2.7-minimal.

Then I have read this and I thought it was some environment problem related to have both 2.7 and 3.6 python.

I have uninstalled pdftk with autoremove, but I have always AttributeError: '_curses.window' object has no attribute 'get_wch'

@saulpw I add to this that I'm using debian as windows linux subsystem.

And I have the same error both in debian and in ubuntu wlx.

@saulpw I have solved, but I do not understand why now it works.

I have uninstalled vd via conda, and I have verified I do not have any other vd version (installed via regular pip).
Then I have installed it via sudo apt-get install and now I have a 1.4 version that works

@saulpw another strange thing. I have tried an upgrade: apt gives me 1.2.1-1 version, but if I run vd --version I have 1.4

image

Same problem here, on Debian (buster/sid) and miniconda:

Traceback (most recent call last):
  File "/home/user/miniconda3/bin/vd", line 158, in 
    main()
  File "/home/user/miniconda3/bin/vd", line 136, in main
    vdtui.run(*sources)
  File "/home/user/miniconda3/lib/python3.7/site-packages/visidata/vdtui.py", line 2797, in run
    ret = wrapper(cursesMain, sheetlist)
  File "/home/user/miniconda3/lib/python3.7/site-packages/visidata/vdtui.py", line 2787, in wrapper
    return curses.wrapper(setupcolors, f, *args)
  File "/home/user/miniconda3/lib/python3.7/curses/__init__.py", line 94, in wrapper
    return func(stdscr, *args, **kwds)
  File "/home/user/miniconda3/lib/python3.7/site-packages/visidata/vdtui.py", line 2784, in setupcolors
    return f(stdscr, *args)
  File "/home/user/miniconda3/lib/python3.7/site-packages/visidata/vdtui.py", line 2810, in cursesMain
    return vd().run(_scr)
  File "/home/user/miniconda3/lib/python3.7/site-packages/visidata/vdtui.py", line 861, in run
    keystroke = self.getkeystroke(scr, sheet)
  File "/home/user/miniconda3/lib/python3.7/site-packages/visidata/vdtui.py", line 734, in getkeystroke
    k = scr.get_wch()
AttributeError: '_curses.window' object has no attribute 'get_wch'
$ vd --version
saul.pw/VisiData v1.5
python -VV
Python 3.7.1 | packaged by conda-forge | (default, Nov 13 2018, 18:15:35) 
[GCC 4.8.2 20140120 (Red Hat 4.8.2-15)]

I have both libncurses5 and libncurses6 packages installed.

If there's any other test I can try to help fix the problem, I'd be very happy to.

@saulpw maybe it's better to keep this issue open. It's seems not strictly related to VD, but it seems a barrier on which it is worth collecting useful elements to bypass it.

Hi @aborruso!

Fixing it is not really actionable on our end (as far as I can tell, it seems to be due to an unfortunate mess of differences of the conda python distribution wrt libncurses packages).

Since folks still seem to be able to locate the issue, I would prefer we keep it closed.

I think what we should probably do is collect the information from here into a FAQ or support page of some sort...

Can confirm that I'm hitting this issue with conda on an Azure VM but then it works fine on my Mac:

$ vd faa-wildlife-strikes.csv
Traceback (most recent call last):
  File "/home/XXX/.conda/envs/default/bin/vd", line 152, in <module>
    main()
  File "/home/XXX/.conda/envs/default/bin/vd", line 130, in main
    vdtui.run(*sources)
  File "/home/XXX/.conda/envs/default/lib/python3.6/site-packages/visidata/vdtui.py", line 2841, in run
    ret = wrapper(cursesMain, sheetlist)
  File "/home/XXX/.conda/envs/default/lib/python3.6/site-packages/visidata/vdtui.py", line 2831, in wrapper
    return curses.wrapper(setupcolors, f, *args)
  File "/home/XXX/.conda/envs/default/lib/python3.6/curses/__init__.py", line 94, in wrapper
    return func(stdscr, *args, **kwds)
  File "/home/XXX/.conda/envs/default/lib/python3.6/site-packages/visidata/vdtui.py", line 2828, in setupcolors
    return f(stdscr, *args)
  File "/home/XXX/.conda/envs/default/lib/python3.6/site-packages/visidata/vdtui.py", line 2854, in cursesMain
    return vd().run(_scr)
  File "/home/XXX/.conda/envs/default/lib/python3.6/site-packages/visidata/vdtui.py", line 866, in run
    keystroke = self.getkeystroke(scr, sheet)
  File "/home/XXX/.conda/envs/default/lib/python3.6/site-packages/visidata/vdtui.py", line 734, in getkeystroke
    k = scr.get_wch()
AttributeError: '_curses.window' object has no attribute 'get_wch'

XXX@azXXX [c5; h1005]

Not sure how to figure this one out but am happy to help debug the issue.

I'm not able to reproduce the original issue.

โฏ pip install --quiet visidata    

โฏ vd --version                              
saul.pw/VisiData v1.5.2

โฏ python -VV      
Python 3.7.2 (default, Feb 13 2019, 13:48:26) 
[GCC 7.3.0]
Was this page helpful?
0 / 5 - 0 ratings