Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #65546 > unrolled thread

Using virtualenv to bypass sudoer issues

Started byJean-Michel Pichavant <jeanmichel@sequans.com>
First post2014-02-06 18:32 +0100
Last post2014-02-08 16:29 +0200
Articles 3 — 3 participants

Back to article view | Back to comp.lang.python


Contents

  Using virtualenv to bypass sudoer issues Jean-Michel Pichavant <jeanmichel@sequans.com> - 2014-02-06 18:32 +0100
    Re: Using virtualenv to bypass sudoer issues Glenn Hutchings <zondo42@gmail.com> - 2014-02-08 10:23 +0000
      Re: Using virtualenv to bypass sudoer issues Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2014-02-08 16:29 +0200

#65546 — Using virtualenv to bypass sudoer issues

FromJean-Michel Pichavant <jeanmichel@sequans.com>
Date2014-02-06 18:32 +0100
SubjectUsing virtualenv to bypass sudoer issues
Message-ID<mailman.6450.1391709846.18130.python-list@python.org>

[Multipart message — attachments visible in raw view] — view raw

Greetings, 


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


JM 







-- IMPORTANT NOTICE: 

The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

[toc] | [next] | [standalone]


#65664

FromGlenn Hutchings <zondo42@gmail.com>
Date2014-02-08 10:23 +0000
Message-ID<ld50j2$gr2$1@speranza.aioe.org>
In reply to#65546
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

[toc] | [prev] | [next] | [standalone]


#65683

FromJussi Piitulainen <jpiitula@ling.helsinki.fi>
Date2014-02-08 16:29 +0200
Message-ID<qotsirtznhn.fsf@ruuvi.it.helsinki.fi>
In reply to#65664
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.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web