From owner-freebsd-python@FreeBSD.ORG Sat May 31 19:15:42 2014 Return-Path: Delivered-To: python@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3995BF70 for ; Sat, 31 May 2014 19:15:42 +0000 (UTC) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.freebsd.org (Postfix) with ESMTP id 26E66251E for ; Sat, 31 May 2014 19:15:41 +0000 (UTC) Received: from Alfreds-MacBook-Pro-9.local (c-76-21-10-192.hsd1.ca.comcast.net [76.21.10.192]) by elvis.mu.org (Postfix) with ESMTPSA id BD8111A3C49 for ; Sat, 31 May 2014 12:15:40 -0700 (PDT) Message-ID: <538A2A5F.2000601@freebsd.org> Date: Sat, 31 May 2014 12:15:43 -0700 From: Alfred Perlstein User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 To: python@freebsd.org Subject: Question on virtualenv (python) and FreeBSD Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.18 X-BeenThere: freebsd-python@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: FreeBSD-specific Python issues List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 May 2014 19:15:42 -0000 Hey folks, First off, thank you all very much for all the work being put into the Python ports infrastructure. We are using it extensively in our project and it's been a huge boon to us. I do have a question about how Python is setup on FreeBSD by default and it has to do with "virtualenv". http://docs.python-guide.org/en/latest/dev/virtualenvs/ Virtualenv allows you to make almost a python "chroot" to keep all your dependencies together so that tracking your deps is very easy. It's very much like Ruby's rvm. From the site: > A Virtual Environment, put simply, is an isolated working copy of Python which allows you to work on a specific project without worry of affecting other projects. > > For example, you can work on a project which requires Django 1.3 while also maintaining a project which requires Django 1.0. It's very cool and useful for allowing multiple apps to exist on a box with different deps. The problem I came across is that it seems "broken" if you are coming from OS X or Linux. Specifically it seems like FreeBSD is shipping a relatively stripped down version of Python that makes using virtualenv not work. > ~/gitbridge/app % python db_repo/manage.py version_control sqlite:///db.db db_repo > Traceback (most recent call last): > File "db_repo/manage.py", line 5, in > main(debug='False') > File "/home/alfred/gitbridge/lib/python2.7/site-packages/migrate/versioning/shell.py", line 207, in main > ret = command_func(**kwargs) > File "", line 2, in version_control > File "/home/alfred/gitbridge/lib/python2.7/site-packages/migrate/versioning/util/__init__.py", line 155, in with_engine > engine = construct_engine(url, **kw) > File "/home/alfred/gitbridge/lib/python2.7/site-packages/migrate/versioning/util/__init__.py", line 140, in construct_engine > return create_engine(engine, **kwargs) > File "/home/alfred/gitbridge/lib/python2.7/site-packages/sqlalchemy/engine/__init__.py", line 344, in create_engine > return strategy.create(*args, **kwargs) > File "/home/alfred/gitbridge/lib/python2.7/site-packages/sqlalchemy/engine/strategies.py", line 73, in create > dbapi =dialect_cls.dbapi(**dbapi_args) > File "/home/alfred/gitbridge/lib/python2.7/site-packages/sqlalchemy/dialects/sqlite/pysqlite.py", line 297, in dbapi > raise e > ImportError: No module named pysqlite2 > I have details and a workaround on my blog here (less messy than pasting the entire 200+ lines of info into this message): http://splbio.wordpress.com/2014/04/19/using-djangosqlalchemy-and-virtualenv-on-freebsd/ Basically it seems that because we don't by default ship sqlite with Python we wind up with this odd situation where the virtualenv'd Python can't be used for the apps that I tend to use. I'm wondering can something be done to make virtualenv work better out of the box for people? -Alfred