From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id 4AD35E00CEC; Wed, 8 Jun 2016 05:56:26 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on yocto-www.yoctoproject.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-HAM-Report: * -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low * trust * [74.125.82.52 listed in list.dnswl.org] * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] * 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily * valid * -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Received: from mail-wm0-f52.google.com (mail-wm0-f52.google.com [74.125.82.52]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id 7197EE00CE5 for ; Wed, 8 Jun 2016 05:56:25 -0700 (PDT) Received: by mail-wm0-f52.google.com with SMTP id n184so180463414wmn.1 for ; Wed, 08 Jun 2016 05:56:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding; bh=L+/CovsMxBYKj4VwtslUV0R6xzfoHaMm76QYJ/YXhC4=; b=RbE987jf79QlvR2CBTfyBaDEQYBv2ySWKdLO1XaC6adfsd+Z8x3LzJ/WnVvMZFAy+Y 6xVjtNwBQzqsGNcYrCWnuYTRf0N/xm69sV4lLfn5qLM+k/tsARtdRxC+YMKaZieTv4kT lQkeDbqmG6ku6y56Xu/dttW42u0wFo4SBuZYjdNKPlbQ7qscxv6N3ZTan6MPGawKWf3j dAYck8+6vtiNl+EzVFwIKOMp7ymrtgAj0CZUGcwd1n773TlJWE0/i4sUcrd5v3SLpIK1 BYxydm6rZMMLsWZ2hO30ZFZBsG73RBcsm4uPdxsQ3sTJ2KoMxrVgVC5p+4Brl828pEYh nUSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=L+/CovsMxBYKj4VwtslUV0R6xzfoHaMm76QYJ/YXhC4=; b=NwclgMPSJxoF2aPFCdY0m0yyiDbMwAktYYk+j17hh0/+a4n1FmnvCFGGz73p4jabaI ym3MYhc81p8+ty8oaQAyPqP/fYSq2kzYJN6rQYkjVKLzlxoZAH/HiLNsLxeGcCm1Ta5O s9s2xP0VmuCjeEBf+KdqzyRSvmzWruT8R1jR96YaDldV1gNJtEJ7kvECrwH6+KaBYK0G kMCEY/pbKEHoQyUIYePWkdvk1i+bQ3hyPXjykm7tzFa0lgY4OOeunAsEWAZS9Wu9Cek1 Ol+IccgrA8ysFtfbagyuXGloRT6Gsrl1N05btnkUtQT38rz8U8b0nXnh1smFPCjNto1z GVyg== X-Gm-Message-State: ALyK8tIUx+liQFYCGxsmsmqNH4N+aiiQmx0jAWd+QmE/e1yGFd5NZHzx5v06ZRXC3XhC/UW5 X-Received: by 10.28.27.8 with SMTP id b8mr7978034wmb.78.1465390583978; Wed, 08 Jun 2016 05:56:23 -0700 (PDT) Received: from [192.168.2.143] ([83.217.123.106]) by smtp.googlemail.com with ESMTPSA id t3sm24684260wmf.20.2016.06.08.05.56.22 for (version=TLSv1/SSLv3 cipher=OTHER); Wed, 08 Jun 2016 05:56:22 -0700 (PDT) To: toaster@yoctoproject.org References: <1464691547.19134.127.camel@linuxfoundation.org> <20160601092736.GA6648@linux.intel.com> <20160601201235.GA3350@linux.intel.com> From: Michael Wood Message-ID: <575815F6.4070903@intel.com> Date: Wed, 8 Jun 2016 13:56:22 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0 MIME-Version: 1.0 In-Reply-To: <20160601201235.GA3350@linux.intel.com> Subject: Re: virtualenv for toaster and python 3 X-BeenThere: toaster@yoctoproject.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Web based interface for BitBake List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Jun 2016 12:56:26 -0000 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit On 01/06/16 21:12, Ed Bartosh wrote: > On Wed, Jun 01, 2016 at 10:24:52AM -0700, Christopher Larson wrote: >> On Wed, Jun 1, 2016 at 2:27 AM, Ed Bartosh >> wrote: >> >>> On Tue, May 31, 2016 at 11:48:01AM -0700, Christopher Larson wrote: >>>> On Tue, May 31, 2016 at 11:47 AM, Brian Avery >>> wrote: >>>>> One possible solution is to use RP's suggestion to leverage the --user >>>>> argument (which stores packges in >>>>> $HOME/.local/lib/python3.4/site-packages. >>>>> >>>>>> pip3 install --user -r poky/bitbake/toaster-requirements.txt >>>>> * works except wsgiref is not python3 compatible yet >>>>>> pip3 list installed --local >>>>> argparse (1.2.1) >>>>> beautifulsoup4 (4.4.1) >>>>> Django (1.8.13) >>>>> >>>>> * works to show what is a --user install vs a global site install. >>>>>> pip3 uninstall/install --user --upgrade/.... works as expected... >>>> Cluttering up my ~/.local with app/project specific requirements is not >>>> appropriate. As someone who uses --user quite a bit, I'd be quite annoyed >>>> by this. >>> So far pip3 --user looks like the only working approach to me. It's not >>> ideal, but it's not that bad either. It should be used for its direct >>> purpose >>> - to install dependencies for 'one user' mode. >>> >>> For production Toaster instances I'd suggest to install runtime >>> dependencies on the host system. >>> >>> BTW, Toaster has only one runtime requirement: Django. argparse and >>> wsgiref is a legacy and beautifulsoup4 is not a runtime dependency. It's >>> used only >>> in tests. >> >> --user is intended for use by the user, not your scripts. > True. I'm not saying that toaster should do that. User will run pip3 > install --user 'Django>1.8<1.9' or install Django 1.8 any other suitable > way. > >> I choose what I put there for good reason. Your use case is what virtual environments are >> for. If toaster can't handle that, it should be fixed to do so. > Toaster can't be fixed to setup an environment where python is python2 > and python3 is python3. Neither virtualenv or venv support this. > >> From the python documentation: >> >> This scheme is designed to be the most convenient solution for users that >> don’t have write permission to the global site-packages directory or don’t >> want to install into it. > Yes, and this is exactly what I'm proposing. Sorry for not being clear. > > -- > Regards, > Ed Did anyone test this, it works for me: $ virtualenv -p python3 bothpython $ virtualenv -p python2 bothpython $ source ./bothpython/bin/activate $ pip3 install -r ./bitbake/toaster-requirements.txt $ source toaster start The only change needed is to fix the toaster script to use python3 to detect if the dependencies are installed or not. diff --git a/bitbake/bin/toaster b/bitbake/bin/toaster index be1bb9c..e3a0dae 100755 --- a/bitbake/bin/toaster +++ b/bitbake/bin/toaster @@ -115,7 +115,7 @@ verify_prereq() { exp='s/Django\([><=]\+\)\([^,]\+\),\([><=]\+\)\(.\+\)/' exp=$exp'import sys,django;version=django.get_version().split(".");' exp=$exp'sys.exit(not (version \1 "\2".split(".") and version \3 "\4".split - if ! sed -n "$exp" $reqfile | python - ; then + if ! sed -n "$exp" $reqfile | python3 - ; then req=`grep ^Django $reqfile` echo "This program needs $req" echo "Please install with pip install -r $reqfile" Michael