Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to install curses in pyenv? #240

Closed
TylerTemp opened this issue Sep 21, 2014 · 6 comments
Closed

How to install curses in pyenv? #240

TylerTemp opened this issue Sep 21, 2014 · 6 comments

Comments

@TylerTemp
Copy link

Is there a way that I can install curses module for pyenv?

For it's not installed by default:

$ pyenv version
3.4.1 (set by /home/xxx/Documents/docarg/.python-version)
$ python
Python 3.4.1 ...
>>> import curses
Traceback (most recent call last):
    ...
File "/home/xxx/.pyenv/versions/3.4.1/lib/python3.4/curses/__init__.py", line 13, in <module>
    from _curses import *
ImportError: No module named '_curses'
>>> quit()
$ /usr/bin/python3.4
Python 3.4.0 ...
>>> import curses
>>>

So I tried to copy relative files from system's python3 lib to pyenv lib:

$ cp -rf /usr/lib/python3.4/lib-dynload/ ~/.pyenv/versions/3.4.1/lib/python3.4/lib-dynload/
$ cp -rf /usr/lib/python3.4/curses/ ~/.pyenv/versions/3.4.1/lib/python3.4/curses
$ sudo chmod -R777 ~/.pyenv/versions/3.4.1/lib/python3.4/lib-dynload
$ sudo chmod -R 777 ~/.pyenv/versions/3.4.1/lib/python3.4/curses

Still gives error ImportError: No module named '_curses'.
And pip install curses not work either...

Any help? Thx a lot
Ubuntu 14.04 & pyenv 20140825

@yyuu
Copy link
Contributor

yyuu commented Sep 22, 2014

The C modules of Python is not a script file and it must not work even if you just copy it. You must rebuild the Python and modules against system's curses library.

The lack of library or development headers of curses (e.g. libncursesw5-dev) might causes those issues. Please confirm if you have enough package for the module.

@JGroselle
Copy link

Hi, I have the same issue.
I'm trying to use Glances in pyenv. Install is OK but when I run it :

$ glances
CRITICAL: Curses module not found. Glances cannot start in standalone mode.

$ pyenv local
3.4.3

$ pip list
bottle (0.12.8)
Glances (2.3)
pip (6.1.1)
psutil (2.2.1)
setuptools (12.0.5)

$ python
Python 3.4.3 (default, Apr 13 2015, 16:30:57)
[GCC 4.9.1] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import curses
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/xxx/.pyenv/versions/3.4.3/lib/python3.4/curses/__init__.py", line 13, in <module>
    from _curses import *
ImportError: No module named '_curses'

You said :

You must rebuild the Python and modules against system's curses library.

How can I rebuild this module in my pyenv please ?

@alibitek
Copy link

@JGroselle
You need to install the development headers for the ncurses library and build the Python version you want again.

Try this:

sudo apt-get install libncurses5 libncurses5-dev libncursesw5
pyenv uninstall 3.4.3
pyenv install 3.4.3
pyenv local 3.4.3
pip install glances

@rghv
Copy link

rghv commented Aug 18, 2015

An apt-get install libncurses5 libncurses5-dev libncursesw5 followed by a reinstallation of pyenv solved the problem.

@pintiliea
Copy link

I tried this and it doesn't work on Debian Jessie :/

@mvanderlee
Copy link

Commenting here since it was the first place I tried for a solution.

If you're using LinuxBrew, try this solution: #1479 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants