Dvc: ModuleNotFoundError: No module named '_curses'

Created on 11 Oct 2018  路  10Comments  路  Source: iterative/dvc

Using latest version (0.19.9) will install asciimatics instead of asciicanvas (which seems intended), but running dvc repro ... will result in:

Traceback (most recent call last):
  File "/home/villasv/.local/share/virtualenvs/red-education-RQhbWawp/bin/dvc", line 7, in <module>
    from dvc.main import main
  File "/home/villasv/.local/share/virtualenvs/red-education-RQhbWawp/lib/python3.6/site-packages/dvc/main.py", line 2, in <module>
    from dvc.cli import parse_args
  File "/home/villasv/.local/share/virtualenvs/red-education-RQhbWawp/lib/python3.6/site-packages/dvc/cli.py", line 27, in <module>
    from dvc.command.pipeline import CmdPipelineShow
  File "/home/villasv/.local/share/virtualenvs/red-education-RQhbWawp/lib/python3.6/site-packages/dvc/command/pipeline.py", line 5, in <module>
    from dvc.dagascii import Dagascii
  File "/home/villasv/.local/share/virtualenvs/red-education-RQhbWawp/lib/python3.6/site-packages/dvc/dagascii.py", line 5, in <module>
    from asciimatics.screen import Screen
  File "/home/villasv/.local/share/virtualenvs/red-education-RQhbWawp/lib/python3.6/site-packages/asciimatics/screen.py", line 1927, in <module>
    import curses
  File "/home/villasv/.pyenv/versions/3.6.5/lib/python3.6/curses/__init__.py", line 13, in <module>
    from _curses import *
ModuleNotFoundError: No module named '_curses'

All 10 comments

Hi @villasv !

Long time no see! :)

You are running Linux here, right? Could you please show output of ldd $(which python)?

Thanks,
Ruslan

Ah, wait, nevermind. Python loads ncurses dynamically, so ldd shouldn't show it either way.

What I'm guessing here is that there is no libncurses in your environment for some reason. Do you run pyenv or something? If so, could you try running import curses in your system's python just to see if that will work?

Thanks,
Ruslan

Exactly, curses is not in my virtualenv. The thing is... should it be? It seems so.
I'll take a look in the discussion in https://github.com/pyenv/pyenv/issues/240

On *nix curses is considered to be a part of standard library for python, but with pyenv it is not included if you don't have libncurses dev package(e.g. headers) installed, since Python is being built on your machine. The solution in the link you've provided should work.

Created a patch https://github.com/iterative/dvc/pull/1211 that dynamically loads asciimatics only when needed, so absence of curses will no longer be affecting commands that don't use it. Please let me know If you don't need dvc pipeline show --ascii and don't want to bother with libncurses, so I could release 0.19.10 ASAP.

No need to rush, I was able to reinstall the pyenv distribution with the required dependencies. Just confirmed, it solves the issue. ;) Thanks!

PS if I'm showing up here less and less, it's because dvc is so much smoother ;)

Glad it worked for you :) Thank you for all your feedback!

0.19.10 is out. Feel free to upgrade(pip install --upgrade dvc).

Traceback (most recent call last):
File "D:/practice/project/snake.py", line 3, in
import curses
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38libcurses__init__.py", line 13, in
from _curses import *
ModuleNotFoundError: No module named '_curses'

Hi @Akshay050592 ! Are you using dvc? Where does that traceback come from?

Was this page helpful?
0 / 5 - 0 ratings