Trouble installing curse


Hello everybody, I’m really sorry if it isn’t the right sub-forum to ask this question, but couldn’t find a better.

I’m creating an application that requires cruses, but when I tried to import it on my python file, I kept getting the error message ModuleNotFoundError: No module named '_curses' After a bit of research, I found out it was a common error on windows, and that I needed to re-install it. I downloaded the WHL file and installed it via pip. But even doing so, the error keep occuring. no module named '_curses'

Now I really don’t know what i’m doing wrong, I downloaded the file from This Website which was given on several forums. And even when checking with pip, I’m told that curses is correctly installed. I really don’t know what i’m doing wrong, any help is appreciated. :confused:


Is it curses or _curses?


I’m trying to install curses, but I get an error message that tells me that _curses cannot be loaded.

I assmued that _curses is a sub-library in curses that is called in the init of curses but maybe i’m mistaken ?


There I cannot say since this is not something I am familiar with. With any luck an advanced Python user with experience in this module will pipe in. Barring that, you may need to do some more web searching.


You haven’t shown what you did

Which version of curses did you download, and what does python print when you start it in interactive mode?
How did you install it, and what was the output?
Did you install it in the same python installation that you’re using to run your program? How are you determining that?

I suggest opening some form of terminal, and using the command python (with no arguments) to display the version, exit, and download the corresponding file, and then do
python -m pip install nameofthefileyoudownloaded.whl
followed by running python again
And attempting to import

>>> import curses

Note that these all use the same python installation, they all use the same python executable (avoiding pip’s executable because it could be something else, better to invoke the module, at least since I have nothing to tell me they’re the same)

If you used --force or --forced or -f or whatever pip likes to call it, then you shouldn’t expect it to work. That’s in no vague terms saying it did not fit.


I used CMD to install the file “curses-2.2+utf8-cp36-cp36m-win_amd64.whl” since i’m on a windows 64 bits and I use python 3.6. The ouput was

Processing d:\nouveau dossier\curses-2.2+utf8-cp36-cp36m-win_amd64.whl
Installing collected packages: curses
Successfully installed curses-2.2+utf8

when I try to reinstall it whilst it’s already installed, I get this output :

Requirement already satisfied: curses==2.2+utf8 from file:///D:/Nouveau%20dossier/curses-2.2%2Butf8-cp36-cp36m-win_amd64.whl in c:\users\gaufre a\appdata\local\programs\python\python36\lib\site-packages (2.2+utf8)

I double checked and the folder it’s installed in is in the paths of my python interpreter (I used pycharm to code) and I think that the error might come to pycharm rather than in the installation of curses :

>>> import curses
>>> import inspect
>>> lines = inspect.getsource(curses.initscr)
>>> print(lines)
def initscr():
    import _curses, curses
    # we call setupterm() here because it raises an error
    # instead of calling exit() in error cases.
    setupterm(term=_os.environ.get("TERM", "unknown"),
    stdscr = _curses.initscr()
    for key, value in _curses.__dict__.items():
        if key[0:4] == 'ACS_' or key in ('LINES', 'COLS'):
            setattr(curses, key, value)

    return stdscr

>>> import _curses
>>> print(_curses)
<module '_curses' from 'C:\\Users\\Gaufre A\\AppData\\Local\\Programs\\Python\\Python36\\lib\\site-packages\\_curses.cp36-win_amd64.pyd'>

^ this is what I get when trying to use curses in CMD, but I get the error message where _curses isn’t installed when using pycharm.

However It looks like both the modules curses and _curses are installed alright. It bugs solely on pycharm, but the modules are installed in C:\users[…]\Python36\lib\site-packages and this path is in my pycharm interpreter, at least file://C:/Users/Gaufre A/AppData/Local/Programs/Python/Python36/Lib is.
I’m still a beginner in python, but cannot figure out why the pycharm interpreter cannot find _curses ?


Your os may be 64-bit but your python installation could be 32-bit and I imagine they need to match. But since pip did not complain it probably either matches or doesn’t matter.

So you have multiple python installations/environments then.


I guess that’s it. When I try to get the path using CMD I get

C:\Users\Gaufre A\AppData\Local\Programs\Python\Python36\python.exe

whereas I get C:\Users\Gaufre A\PycharmProjects\Myproject\venv\Scripts\python.exe when trying with pycharm. Do you know if there is a way to either tell pycharm to use the same version of python as my CMD or to install curses on the other version ? Sorry if i’m beeing a bit needy, I’m really struggling with those python installers.


I know nothing pycharm-specific, shouldn’t you be looking in menus and/or googling for that?
(I don’t know what IDE’s are good for except maybe handling very large pieces of code but that’s a problem of itself. That and providing tools on windows, but again, that’s a problem of itself)


Update : Apparently It came from a path problem in pycharm, I uninstalled curses, reinstalled it and made sure the path in pycharm to the module was correctly set. Now it’s working fine, sorry for the bother


Reinstalling shouldn’t have done anything should it?
And if your project has its own venv, then isn’t that where the module should be installed, rather than adding part of another installation to your python path, kind of a frankenstein kind of thing to do… I won’t argue it doesn’t do what you want though.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.