Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

virtualenv is not compatible with this system or executable

I am rather new to Linux (Ubuntu) and installing (Python) packages. I'm having trouble with mkvirtualenv and can not solve it:

~$ mkvirtualenv mysite70
New python executable in mysite70/bin/python
Traceback (most recent call last):
  File "/usr/lib/python2.7/site.py", line 562, in <module>
    main()
  File "/usr/lib/python2.7/site.py", line 544, in main
    known_paths = addusersitepackages(known_paths)
  File "/usr/lib/python2.7/site.py", line 271, in addusersitepackages
    user_site = getusersitepackages()
  File "/usr/lib/python2.7/site.py", line 246, in getusersitepackages
    user_base = getuserbase() # this will also set USER_BASE
  File "/usr/lib/python2.7/site.py", line 236, in getuserbase
    USER_BASE = get_config_var('userbase')
  File "/usr/lib/python2.7/sysconfig.py", line 577, in get_config_var
    return get_config_vars().get(name)
  File "/usr/lib/python2.7/sysconfig.py", line 476, in get_config_vars
    _init_posix(_CONFIG_VARS)
  File "/usr/lib/python2.7/sysconfig.py", line 355, in _init_posix
    raise IOError(msg)
IOError: invalid Python installation: unable to open /home/sietse/.virtualenvs/mysite70/local/include/python2.7/pyconfig.h (No such file or directory)
ERROR: The executable mysite70/bin/python is not functioning
ERROR: It thinks sys.prefix is u'/home/usr/.virtualenvs' (should be u'/home/usr/.virtualenvs/mysite70')
ERROR: virtualenv is not compatible with this system or executable

Did I install something wrong?

like image 430
musicformellons Avatar asked Nov 11 '22 13:11

musicformellons


2 Answers

This is likely a permissions error with your current logged in user on the Linux machine.

Try

sudo mkvirtualenv mysite70

This will often prompt for the password of the root user.

If that does not work, you may want to look at the article below:

http://noelusion.com/2013/Fixing-the-mysterious-virtualenv-error-IOError-invalid-Python-installation/

But note, that the article is a hack on a fairly specific instance.

like image 162
DanGar Avatar answered Nov 15 '22 11:11

DanGar


I think I messed up the installation. I reinstalled Ubuntu, virtualenv etc. It works fine now.

like image 21
musicformellons Avatar answered Nov 15 '22 10:11

musicformellons