5

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

cd ~
mkvirtualenv mysite70

Output:

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?

1
  • try running the mk command with sudo. lets make sure it is not a permission error like often is in linux. Commented Feb 10, 2014 at 22:31

3 Answers 3

1

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.

Sign up to request clarification or add additional context in comments.

4 Comments

I did this and get:~$ sudo mkvirtualenv mysite70 sudo: mkvirtualenv: command not found
sudo can changed you $PATH variable on ubuntu. Check your $PATH variable after sudo. If it is not what you expect, follow the post below: stackoverflow.com/questions/257616/sudo-changes-path-why
...I do not know what to expect...just know that it gives "mkvirtualenv: command not found"... When I follow your link, I do and get: ~$ echo 'echo $PATH' | sh /usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games and: ~$ echo 'echo $PATH' | sudo sh /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin This path seems ok to me!? Any idea why the command is not found? Did I install Python 'outside su domain' or something; how do I 'repair'? Thanks!
The noelusion.com link is broken ("Hmm. We’re having trouble finding that site. We can’t connect to the server at noelusion.com.").
1

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

1 Comment

OK, but it would also probably work if you purged and reinstalled the relevant packages (python-virtualenv virtualenvwrapper), deleted the old .virtualenvs folder and created the virtualenv from scratch.
-1

Make sure your username has accents or special characters. If yes, change directory creating environments creating an environment variable WORKON_HOME with value equal to the new path. Ex .: C:\Envs

2 Comments

Don't you mean "...does not have accents or special characters"?
OK, the OP has left the building: "Last seen more than 10 years ago"

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.