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


Groups > comp.lang.python > #108746

Re: How to create development Python environment on Linux.

Path csiph.com!feeder.erje.net!1.eu.feeder.erje.net!newsfeed.kamp.net!newsfeed.kamp.net!fu-berlin.de!uni-berlin.de!not-for-mail
From Zachary Ware <zachary.ware+pylist@gmail.com>
Newsgroups comp.lang.python
Subject Re: How to create development Python environment on Linux.
Date Tue, 17 May 2016 10:32:35 -0500
Lines 50
Sender zachary.ware@gmail.com
Message-ID <mailman.64.1463499178.19823.python-list@python.org> (permalink)
References <815aa265-45c4-40a4-860d-beb89cd9a78e@googlegroups.com> <29b59dce-2036-43f6-8166-7e3ad15e8e4c@googlegroups.com> <CAKJDb-OMEwTYsHUxoZh+5MDKk0Q7zcHv4zJdegBfEtvzLo+7Uw@mail.gmail.com>
Reply-To python-list@python.org
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding quoted-printable
X-Trace news.uni-berlin.de 2jXJL83130fPPG5hEd83Qgvb6dQo1xifskczVDPKmBQQ==
Return-Path <zachary.ware@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; '16,': 0.03; 'subject:Python': 0.05; 'dev': 0.07; 'lines.': 0.07; 'skip:/ 10': 0.07; 'scripts': 0.09; 'subject:How': 0.09; '/usr/local': 0.09; 'skip:` 30': 0.09; 'subject:create': 0.09; 'bug': 0.10; 'received:209.85.218': 0.10; 'python': 0.10; '2.7': 0.13; "(i'm": 0.16; '2016': 0.16; 'plan.': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'stuff,': 0.16; 'tempted': 0.16; 'used:': 0.16; 'wrote:': 0.16; 'sender:addr:gmail.com': 0.18; 'skip:` 10': 0.18; 'version.': 0.18; 'creates': 0.18; 'versions': 0.20; 'to:name:python-list@python.org': 0.20; 'controlling': 0.22; 'environments': 0.22; 'uses.': 0.22; 'help.': 0.23; 'somewhere': 0.24; 'header:In-Reply-To:1': 0.24; 'mon,': 0.24; 'install': 0.25; 'least': 0.27; 'message-id:@mail.gmail.com': 0.27; 'specify': 0.27; "skip:' 10": 0.28; 'fine': 0.28; 'filed': 0.29; 'such.': 0.29; 'environment': 0.29; "i'm": 0.30; 'code': 0.30; 'probably': 0.31; 'entry': 0.31; 'post': 0.31; 'another': 0.32; 'run': 0.33; 'point': 0.33; 'source': 0.33; 'third': 0.33; 'michael': 0.33; 'usually': 0.33; 'environment,': 0.33; 'skip:/ 20': 0.33; 'open': 0.33; "i'll": 0.33; 'file': 0.34; 'received:google.com': 0.35; 'on,': 0.35; 'clear': 0.35; 'easiest': 0.35; 'path': 0.35; 'quite': 0.35; 'but': 0.36; 'should': 0.36; 'project': 0.36; 'there': 0.36; 'web,': 0.36; 'received:209.85': 0.36; 'guidance': 0.36; 'to:addr:python-list': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'two': 0.37; 'expect': 0.37; 'there,': 0.37; 'thanks': 0.37; 'environment.': 0.37; 'one,': 0.37; 'things': 0.38; 'virtual': 0.38; "won't": 0.38; 'version': 0.38; 'received:209': 0.38; 'means': 0.39; 'skip:- 20': 0.39; 'enough': 0.39; 'to:addr:python.org': 0.40; 'where': 0.40; 'some': 0.40; 'your': 0.60; 'hope': 0.61; 'programs': 0.62; '(that': 0.63; 'more': 0.63; 'information': 0.63; 'latest': 0.64; 'other.': 0.64; "they're": 0.66; 'here': 0.66; 'accounts': 0.66; 'header:Reply-To:1': 0.67; 'reply-to:no real name:2**0': 0.71; 'sounds': 0.76; 'apt-get': 0.84; 'pip': 0.84; 'reply-to:addr:python.org': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:sender:in-reply-to:references:from:date :message-id:subject:to:content-transfer-encoding; bh=uNZQXvuRft4L6hMVWOcd1Y9lTa3uiXsSxHlbnmsdFAk=; b=t29BEYkwLel9fJsuSMBynlea1/qrJwl1V3V3hJW9gEPtcbaA7H+rUwrCyZ49pvlY3o 8gHDY58/Jmbe61h9dENl/MrURppNeP1sOYzY09gol3INlT8zck0VvQx0SRVhQf9dMgPz FRfUD4xMPly4QZ8bMhFfh9BhJ4H+2HtgfI2guigErmz9GPdvZDf3cjgcSt7lSxSNqhIk y++4oLPCri5xpu2mNSXxXDkn3wq4olQ+9ojNo5eqZDIVxsgiDnwq5bmPQxqQ/Jfkg4kh 12/i0Hj5r6pRdv/V+Wn8cawQGE4EPo099RDHVDZpwc5EwnSTuhpw8o69fQBkywfm9KeS oH4Q==
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:reply-to:sender:in-reply-to :references:from:date:message-id:subject:to :content-transfer-encoding; bh=uNZQXvuRft4L6hMVWOcd1Y9lTa3uiXsSxHlbnmsdFAk=; b=G1a2w4cur0X9g3Of/dY1l5Jdt/pT0Lz6AEc8JdKoH0LSLEqvHbJhuGZwoU1UFetdRZ /AL6BSAFzHxczKpk1l5evbur2eseohAplh3agXRHzNMzP4fb9w+QA1JZ2iOjS3dh+LKC j55Zb4fr/aP2ShqkdHYuqamINvszYGpvIsnNcxNX8b+NYREtL9oYtbxGiDJfdg8aONG3 x6hJIYwemVEQ/i2uOnJJZdx7Dkuf7Wrj80z8fMFF8sXvR19Z5Do3lW3f+er3joQ3ZLSI ZmSO7XcpklHkg0g6280asm+u15i3M0dRv28Nl2TocMWQUVHQpR3eiyNzQ3j5Cie8cQsB siUw==
X-Gm-Message-State AOPr4FWewfqTPBM4tYKkfHnzBtGEqINLw93ERjcNHYFBdNH0uXIszl1KjB0Kfb5T/0GWWEGHNoTrcYc7yKMVfQ==
X-Received by 10.202.0.7 with SMTP id 7mr976721oia.54.1463499174841; Tue, 17 May 2016 08:32:54 -0700 (PDT)
In-Reply-To <29b59dce-2036-43f6-8166-7e3ad15e8e4c@googlegroups.com>
X-Google-Sender-Auth EbPImdAUN831yVtvf7V9xIF6QIo
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.22
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID <CAKJDb-OMEwTYsHUxoZh+5MDKk0Q7zcHv4zJdegBfEtvzLo+7Uw@mail.gmail.com>
X-Mailman-Original-References <815aa265-45c4-40a4-860d-beb89cd9a78e@googlegroups.com> <29b59dce-2036-43f6-8166-7e3ad15e8e4c@googlegroups.com>
Xref csiph.com comp.lang.python:108746

Show key headers only | View raw


On Mon, May 16, 2016 at 4:28 PM,  <redirect.null@gmail.com> wrote:
> Thanks Zach, that's a big help. The only reason I want to get a Python 2.7 environment working first is because I'll be working on third party code and that's the platform it uses. For any new projects I would use Python 3.

Fair enough :)

> After considering your guidance I think what I will do is install virtualenv using apt-get and then use that to create a dev environment. Is it ok to run get-pip.py in a virtual environment?

Sounds like a plan.  get-pip.py should work fine in a venv, but first
check to see if pip is already there, as Michael mentioned.

> I won't worry about using the latest version of 2.7 for now, since it's only one or two third party open source projects I'll use 2.7 for and they don't need a more recent version.
>
> There are a couple of other things I'm not quite clear on, such as where it would be best to create my new virtual environment (I'm tempted to put it in /usr/local if that means it can be used by all user accounts on my machine), and how I can can control which Python environment is used by the various system and user programs that depend on them, but I expect I can find that information on the web, though I'll make another post here if I do get stuck.

The thing about virtual environments is that you can create as many as
you want wherever you want, and they're all independent of each other.
All you need to do is have a way to consistently recreate the same
environment, which is usually easiest to do with a 'requirements.txt'
file with all of your dependencies' versions pinned.  Then recreating
the venv is as simple as `virtualenv --python=some_python
/path/to/venv && /path/to/venv/bin/pip install -r
/path/to/requirements.txt`.  Then you can do your development wherever
you want and install into somewhere in `/usr/local` when you deploy.
For example, one project I work on creates a venv in
`/usr/local/lib/project_name/`, then creates links to the entry point
scripts (that actually live in `/usr/local/lib/project_name/bin/`) in
`/usr/local/bin/`.

As for controlling which environment is used: all system scripts/apps
should specify some version-specific flavor of /usr/bin/python in
their shebang--if they don't it's an OS bug and should be filed as
such.  For your stuff, the path of least headache is probably to
create a venv for each one, and specify the path to the venv's python
in shebang lines.

Hope this helps,
-- 
Zach

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

How to create development Python environment on Linux. redirect.null@gmail.com - 2016-05-16 04:22 -0700
  Re: How to create development Python environment on Linux. redirect.null@gmail.com - 2016-05-16 04:29 -0700
  Re: How to create development Python environment on Linux. Zachary Ware <zachary.ware+pylist@gmail.com> - 2016-05-16 11:25 -0500
    Re: How to create development Python environment on Linux. Lawrence D’Oliveiro <lawrencedo99@gmail.com> - 2016-06-01 17:17 -0700
      Re: How to create development Python environment on Linux. Marc Brooks <marcwbrooks@gmail.com> - 2016-06-01 20:30 -0400
  Re: How to create development Python environment on Linux. redirect.null@gmail.com - 2016-05-16 14:28 -0700
    Re: How to create development Python environment on Linux. Michael Selik <michael.selik@gmail.com> - 2016-05-16 21:56 +0000
    Re: How to create development Python environment on Linux. Zachary Ware <zachary.ware+pylist@gmail.com> - 2016-05-17 10:32 -0500

csiph-web