Re: Using virtualenv to bypass sudoer issues

Discussion in 'Python' started by Glenn Hutchings, Feb 8, 2014.

  1. On 06/02/14 17:32, Jean-Michel Pichavant wrote:

    > Assuming I have a debian workstation for which I don't have any sudo
    > rights, in order to be able to install / remove python packages, should
    > I be using virtualenv ? Is it a suited solution ?


    It depends on whether you need to share the installation with anyone
    else. If not, you could also install packages using:

    python setup.py install --user

    This will install in your home directory, in the '.local' subdirectory.
    And to run any scripts that get installed, add ~/.local/bin to your PATH.

    Glenn
     
    Glenn Hutchings, Feb 8, 2014
    #1
    1. Advertising

  2. Glenn Hutchings writes:

    > On 06/02/14 17:32, Jean-Michel Pichavant wrote:
    >
    > > Assuming I have a debian workstation for which I don't have any
    > > sudo rights, in order to be able to install / remove python
    > > packages, should I be using virtualenv ? Is it a suited solution
    > > ?

    >
    > It depends on whether you need to share the installation with anyone
    > else. If not, you could also install packages using:
    >
    > python setup.py install --user
    >
    > This will install in your home directory, in the '.local'
    > subdirectory. And to run any scripts that get installed, add
    > ~/.local/bin to your PATH.


    I've used this recently. There's a catch: setup.py requires
    setuptools, which also is not in the standard library and cannot be
    installed this way unless it has already been installed. There's a
    solution: there's a special ez_setup.py for installing setuptools.

    With --user, both `python setup.py install' and `python ez_setup.py'
    install in site.USER_BASE, which is ~/.local for me; site is in
    standard library; the python interpreter determines the version of
    python for which the installation is done, so I actually ran these:

    $ python3 ez_setup.py --user
    $ cd openpyxl-1.8.1
    $ python3 setup.py install --user

    These installed "eggs" in ~/.local/lib/python3.2/site-packages/, and
    in ~/.local/bin a couple of scripts called easy_install, which I
    consider poor names to have on my PATH, assuming they are specific to
    Python (so I don't ~/.local/bin on my PATH).

    Try to import setuptools to see if you have setuptools already. (On
    one system, my 2.7 had them, but 3 didn't.)

    The nice thing about --user is that the python3 interpreter knows to
    add eggs from this location to its sys.path without any further
    hassle. There are other options (--home, --prefix) for greater
    control.

    I chased the links from <http://docs.python.org/3/install/index.html>
    and <http://pypi.python.org> to learn all this and find the tools.
     
    Jussi Piitulainen, Feb 8, 2014
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. batok
    Replies:
    0
    Views:
    532
    batok
    Jul 23, 2010
  2. Gelonida N
    Replies:
    4
    Views:
    981
    Gelonida N
    Aug 11, 2011
  3. Cameron Simpson

    Re: Using virtualenv to bypass sudoer issues

    Cameron Simpson, Feb 8, 2014, in forum: Python
    Replies:
    3
    Views:
    69
    Asaf Las
    Feb 8, 2014
  4. Pete Forman
    Replies:
    1
    Views:
    68
    Asaf Las
    Feb 10, 2014
  5. Jean-Michel Pichavant

    Re: Using virtualenv to bypass sudoer issues

    Jean-Michel Pichavant, Feb 10, 2014, in forum: Python
    Replies:
    0
    Views:
    65
    Jean-Michel Pichavant
    Feb 10, 2014
Loading...

Share This Page