question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ImportError: No module named _curses

See original GitHub issue
pkgin install py27-pip-1.5.6

pip install --upgrade pip setuptools
Downloading/unpacking pip from https://pypi.python.org/packages/py2.py3/p/pip/pip-7.1.0-py2.py3-none-any.whl#md5=b108384a762825ec20345bb9b5b7209f
  Downloading pip-7.1.0-py2.py3-none-any.whl (1.1MB): 1.1MB downloaded
Downloading/unpacking setuptools from https://pypi.python.org/packages/3.4/s/setuptools/setuptools-18.0.1-py2.py3-none-any.whl#md5=19c0c145c3d2a615b0a33f0aeddd1c02
  Downloading setuptools-18.0.1-py2.py3-none-any.whl (461kB): 461kB downloaded
Installing collected packages: pip, setuptools
  Found existing installation: pip 1.5.6
    Uninstalling pip:
      Successfully uninstalled pip
  Found existing installation: setuptools 14.2
    Uninstalling setuptools:
      Successfully uninstalled setuptools
Successfully installed pip setuptools
Cleaning up...

pip install --upgrade httpie
Collecting httpie
  Downloading httpie-0.9.2-py2.py3-none-any.whl (66kB)
    100% |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 69kB 646kB/s
Collecting requests>=2.3.0 (from httpie)
  Downloading requests-2.7.0-py2.py3-none-any.whl (470kB)
    100% |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 471kB 831kB/s
Collecting Pygments>=1.5 (from httpie)
  Downloading Pygments-2.0.2-py2-none-any.whl (672kB)
    100% |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 675kB 661kB/s
Installing collected packages: requests, Pygments, httpie
Successfully installed Pygments-2.0.2 httpie-0.9.2 requests-2.7.0

http google.com
Traceback (most recent call last):
  File "/usr/pkg/bin/http", line 7, in <module>
    from httpie.__main__ import main
  File "/usr/pkg/lib/python2.7/site-packages/httpie/__main__.py", line 6, in <module>
    from .core import main
  File "/usr/pkg/lib/python2.7/site-packages/httpie/core.py", line 23, in <module>
    from httpie.downloads import Download
  File "/usr/pkg/lib/python2.7/site-packages/httpie/downloads.py", line 15, in <module>
    from httpie.output.streams import RawStream
  File "/usr/pkg/lib/python2.7/site-packages/httpie/output/streams.py", line 5, in <module>
    from httpie.context import Environment
  File "/usr/pkg/lib/python2.7/site-packages/httpie/context.py", line 7, in <module>
    class Environment(object):
  File "/usr/pkg/lib/python2.7/site-packages/httpie/context.py", line 29, in Environment
    import curses
  File "/usr/pkg/lib/python2.7/curses/__init__.py", line 15, in <module>
    from _curses import *
ImportError: No module named _curses

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
rghvcommented, Aug 18, 2015

EDIT_2: https://github.com/yyuu/pyenv/issues/240 mentions this and that thread seems to have the solution as well. An apt-get install libncurses5 libncurses5-dev libncursesw5 followed by a reinstallation of pyenv solved the problem.

@bixu - try installing the curses devel libs.

EDIT:This is only when used with pyenv. Guess I would have to log an issue with pyenv.

Seconded.

10:59:55 ~ 
 $ pyenv global 
2.7.6
11:00:41 ~ 
 $ type pip
pip is /edge/tools/pyenv/root/shims/pip
11:00:45 ~ 
 $ pip install httpie --upgrade
Collecting httpie
/edge/tools/pyenv/root/versions/2.7.6/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
  Downloading httpie-0.9.2-py2.py3-none-any.whl (66kB)
    100% |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 69kB 155kB/s 
Collecting requests>=2.3.0 (from httpie)
  Downloading requests-2.7.0-py2.py3-none-any.whl (470kB)
    100% |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 471kB 967kB/s 
Collecting Pygments>=1.5 (from httpie)
  Downloading Pygments-2.0.2-py2-none-any.whl (672kB)
    100% |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 675kB 474kB/s 
Installing collected packages: requests, Pygments, httpie
Successfully installed Pygments-2.0.2 httpie-0.9.2 requests-2.7.0
11:01:02 ~ 
 $ http GET github.com
Traceback (most recent call last):
  File "/edge/tools/pyenv/root/versions/2.7.6/bin/http", line 7, in <module>
    from httpie.__main__ import main
  File "/edge/tools/pyenv/root/versions/2.7.6/lib/python2.7/site-packages/httpie/__main__.py", line 6, in <module>
    from .core import main
  File "/edge/tools/pyenv/root/versions/2.7.6/lib/python2.7/site-packages/httpie/core.py", line 23, in <module>
    from httpie.downloads import Download
  File "/edge/tools/pyenv/root/versions/2.7.6/lib/python2.7/site-packages/httpie/downloads.py", line 15, in <module>
    from httpie.output.streams import RawStream
  File "/edge/tools/pyenv/root/versions/2.7.6/lib/python2.7/site-packages/httpie/output/streams.py", line 5, in <module>
    from httpie.context import Environment
  File "/edge/tools/pyenv/root/versions/2.7.6/lib/python2.7/site-packages/httpie/context.py", line 7, in <module>
    class Environment(object):
  File "/edge/tools/pyenv/root/versions/2.7.6/lib/python2.7/site-packages/httpie/context.py", line 29, in Environment
    import curses
  File "/edge/tools/pyenv/root/versions/2.7.6/lib/python2.7/curses/__init__.py", line 15, in <module>
    from _curses import *
ImportError: No module named _curses
11:01:11 ~ 

A search points to this SO thread about UniCurses. But pip doesn’t seem to locate/get unicurses. Unicurses doesn’t look like a python module, if that’s indeed the true source. (Though it is mentioned on pypi)

Any other python module that once could use to get the curses functionality? pip search curses shows pyCDK but pip fails to install pyCDK as well.

0reactions
jamshidcommented, Feb 3, 2016

In my case httpie was reporting ImportError: No module named _curses because I was trying to run it with a custom python2.7 install on a CentOS6 machine. I had to pip uninstall httpie then pip2.6 install httpie to get it working.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ImportError: No module named '_curses' when trying to import ...
Try this curses implementation for Windows. Β· I have the same exact problem on Windows 7 and am looking for a workaround.
Read more >
No module named '_curses' Β· Issue #31 Β· wustho/epr - GitHub
I was trying to install it on SailfishOS using pip but I got an error during installation related to _curses module missing. I...
Read more >
ImportError: No module named _curses ?
The curses module is not available on Windows, as you found out when you tried to import it. The documentation should probably make...
Read more >
[Example code]-No module named '_curses'
Coding example for the question No module named '_curses' ... line 13, in <module> from _curses import * ModuleNotFoundError: No module named '_curses'....
Read more >
Error Calling Import curses : r/learnpython - Reddit
ModuleNotFoundError : No module named '_curses'. >>> Any idea what I'm doing wrong?? ... r/learnpython - Python import error.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found