3

An error when creating a virtualenv which uses a Python version different than the default Python of the machine, while Anaconda is installed on the machine. I created a new virtual environment:

virtualenv --no-site-packages ~/graphlabcreate
source ~/graphlabcreate/bin/activate

That created a directory with the machine default python2.6 while I need python2.7. Then, I read here and tried:

virtualenv -p /usr/local/anaconda/bin/python2.7 ~/graphlabcreate

And received the following error:

Running virtualenv with interpreter /usr/local/anaconda/bin/python2.7
New python executable in /home/nancy/graphlabcreate/bin/python2.7
Not overwriting existing python script /home/nancy/graphlabcreate/bin/python (you must use /home/nancy/graphlabcreate/bin/python2.7)
/home/nancy/graphlabcreate/bin/python2.7: error while loading shared libraries: libpython2.7.so.1.0: cannot open shared object file: No such file or directory
ERROR: The executable /home/nancy/graphlabcreate/bin/python2.7 is not functioning
ERROR: It thinks sys.prefix is u'/' (should be u'/home/nancy/graphlabcreate')
ERROR: virtualenv is not compatible with this system or executable

same happens when I run:

virtualenv -p  /usr/local/anaconda/bin/python2.7  --no-site-packages ~/graphlabcreate

EDIT:

$ ls -ltr /usr/bin/pyth*
-rwxr-xr-x. 1 root root 1418 2013-11-21 17:51 /usr/bin/python2.6-config*
-rwxr-xr-x. 3 root root 9032 2013-11-21 17:53 /usr/bin/python2.6*
-rwxr-xr-x. 3 root root 9032 2013-11-21 17:53 /usr/bin/python*
lrwxrwxrwx. 1 root root    6 2014-07-15 12:51 /usr/bin/python2 -> python*
lrwxrwxrwx. 1 root root   16 2014-07-15 12:56 /usr/bin/python-config -> python2.6-config*

 $ ls -ltr /usr/local/anaconda/bin/pyth*
    -rwxr-xr-x. 3 root root  9032 2013-11-21 17:53 /usr/local/anaconda/bin/python*
    -rwxr-xr-x. 1 root root 10222 2014-06-02 20:35 /usr/local/anaconda/bin/python2.7*
    -rwxrwxr-x. 1 root root  1602 2014-07-16 17:21 /usr/local/anaconda/bin/python-argcomplete-check-easy-install-script*
    lrwxrwxrwx. 1 root root     9 2014-07-16 17:21 /usr/local/anaconda/bin/python2 -> python2.7*
    -rwxr-xr-x. 1 root root  1680 2014-07-16 17:21 /usr/local/anaconda/bin/python-config*
Community
  • 1
  • 1
Serendipity
  • 2,216
  • 23
  • 33

2 Answers2

1

If you are using Anaconda, you can use conda to create environments rather than virtualenv, using the conda create command.

asmeurer
  • 86,894
  • 26
  • 169
  • 240
-1

Can you brief, how you installed this version of python. And in which OS you are trying to install.

If python2.6 is default for your Os. then you need to make alt install for the other newer version of python(So it ll not clash with your OS), and create symbolic link to python

Something like below

tar -zxvf Python-2.7.6.tgz

cd Python-2.7.6

./configure --prefix=/usr/local --with-threads --enable-shared

make && make altinstall

ln -s /usr/local/bin/python /usr/bin/python2.7

echo '/usr/local/lib' >> /etc/ld.so.conf.d/usr-python2.7.conf

ldconfig

After that you try installing your virtual env libraries and then try what you are doing now.

Hope you got some Idea. :)

vijay
  • 679
  • 2
  • 7
  • 15
  • OS: centus6. I don't remember how I installed the python version, But the anaconda contain python2.7. – Serendipity Dec 24 '14 at 08:13
  • it seems that I already have a link: $ ~/graphlabcreate/bin$ ll total 12 lrwxrwxrwx. 1 nancy nancy 9 2014-12-24 08:43 python -> python2.7* lrwxrwxrwx. 1 nancy nancy 9 2014-12-24 08:43 python2 -> python2.7* -rwxr-xr-x. 1 nancy nancy 10222 2014-12-24 08:43 python2.7* – Serendipity Dec 24 '14 at 08:44
  • https://github.com/h2oai/h2o/wiki/Installing-python-2.7-on-centos-6.3.-Follow-this-sequence-exactly-for-centos-machine-only Verify the above link. may b useful. – vijay Dec 24 '14 at 08:53
  • Thanks, but this is not relevant since I already have python 2.7 on the machine which works perfectly. it seems that I already have a link - I edited my question please see above. Thanks! – Serendipity Dec 24 '14 at 13:28