I have easy_install
and pip
.
I had many errors on my Linux Mint 12, I just re-installed it and I want to install everything from scratch again.
This is one of the errors that I had. I received an interesting answer there:
Stop using su and sudo to run virtualenv.
You need to run virtualenv as your normal user.
You have created the virtualenv with sudo which is why you are getting these errors.
So how to install virtualenv
without using sudo
? Can i use pip
or easy_install
without using sudo
? Or is there another way?
I've created a "portable" version of virtualenv.
It downloads
virtualenv.py
script with dependencies into.locally
subdir and executes it from there. Once that's done, the script with .locally/ subdir can be copied anywhere.This solution is suitable in cases where no
virtualenv
is available system wide and you can not become root to installvirtualenv
. When I set up a debian for python development or deployment I alwaysapt-get install python-virtualenv
. It is more convenient to have it around than to do the bootstrap pointed out below. But without root power it may be the the way to go:There is a bootstrap mechanism that should get you going.
Read: http://peak.telecommunity.com/DevCenter/EasyInstall#creating-a-virtual-python
In essence you would do this in your home directory in a unix environment:
Given your python is version 2.6
There may be room for optimization. I don't like the
local
path. Justbin
andlib
would be nice. But it does its job.http://opensourcehacker.com/2012/09/16/recommended-way-for-sudo-free-installation-of-python-software-with-virtualenv/ suggests the following:
It seems to work well. It lets me install https://github.com/miohtama/vvv with
pip
.If you get:
Try
--extra-search-dir
after downloading the tarballs at https://github.com/pypa/virtualenv/tree/develop/virtualenv_supportYou can also use the command below, it worked for me without
sudo
access. You may also need to modify yourPYTHONPATH
environment variable usingexport
, see this SO answer for more details.pip install --user virtualenv
You might want to consider using Anaconda. It's a full-fledged Python distribution, that lives in a folder in e.g. your home directory. No
sudo
is necessary at any point and you get most of the popular packages.The easiest way I have seen so far is to install Anaconda. It may be an overkill for you. For me the centOS running on the remote server had only python2.6 installed. Anaconda by default installs everything locally + it is python2.7
Then
Boom. You have all the packages like numpy and pip installed. Then if you want virtualenv, just type