Trouble using grokproject egg with Python2.5 on OS X Leopard and virtualenv

Bug #180410 reported by Noah Gift
4
Affects Status Importance Assigned to Milestone
grok
Fix Released
Low
Brandon Rhodes
1.0
Fix Released
Low
Brandon Rhodes

Bug Description

I was able to recreate the problem, once but then not again. It might be my limited understanding of virtualenv and buildout currently, as it is possible I did not remove the correct item to fully test this. I will report that on python2.4.4 it worked flawlessly, and I had never installed paste in python2.4.4. Clearly highlighting the version of python in the tutorial and possibly including information about using virtual env, could be useful. I forget if I noticed this or not in the tutorial.

I have another OS X machine that has a fresh Leopard install that I will test this on in the next couple of days, so I can be 100% sure, it isn't something about my environment. Again, here was the most recent traceback:

[ngift@Macintosh-6][H:10944][J:0]> virtualenv groknoahgift
New python executable in groknoahgift/bin/python
Installing setuptools............done.
[ngift@Macintosh-6][H:10945][J:0]> groknoahgift
[ngift@Macintosh-6][H:10946][J:0]> ll
total 0
drwxr-xr-x 7 ngift staff 238 Jan 3 09:46 bin
drwxr-xr-x 3 ngift staff 102 Jan 3 09:46 lib
[ngift@Macintosh-6][H:10947][J:0]> bin/easy_install grokproject
Searching for grokproject
Best match: grokproject 0.6
Processing grokproject-0.6-py2.5.egg
Adding grokproject 0.6 to easy-install.pth file
Installing grokproject script to /Users/ngift/src/groknoahgift/bin

Using /Library/Python/2.5/site-packages/grokproject-0.6-py2.5.egg
Processing dependencies for grokproject
Finished processing dependencies for grokproject
[ngift@Macintosh-6][H:10948][J:0]> pwd
/Users/ngift/src/groknoahgift
[ngift@Macintosh-6][H:10949][J:0]> ll
total 0
drwxr-xr-x 8 ngift staff 272 Jan 3 09:46 bin
drwxr-xr-x 3 ngift staff 102 Jan 3 09:46 lib
[ngift@Macintosh-6][H:10950][J:0]> bin/grokproject noahgift
Traceback (most recent call last):
 File "bin/grokproject", line 5, in <module>
   from pkg_resources import load_entry_point
 File "build/bdist.linux-i686/egg/pkg_resources.py", line 2561, in <module>
 File "build/bdist.linux-i686/egg/pkg_resources.py", line 626, in require
 File "build/bdist.linux-i686/egg/pkg_resources.py", line 524, in resolve
pkg_resources.DistributionNotFound: PasteScript>=1.3
[ngift@Macintosh-6][H:10951][J:0]>

On Leopard, did you use Python 2.5 with Grok? We don't officially support that combination yet, though I don't see how that could lead to this error.

Yes, I was using Python2.5. One thing to note for Leopard users, is that it is non-trivial to install Python 2.4.4, as Python 2.5.1 is the default. I believe I was most successful by using macports, as there were problems getting python2.4 to compile properly. Python2.4 gets installed here with macports:

/opt/local/bin/python2.4

So to summarize, I had no problems installing Grok using the supported version of Python2.4.4 via macports.

todd (todd-infrae)
Changed in grok:
assignee: nobody → brandon-rhodes
milestone: none → 1.0
Revision history for this message
Martijn Faassen (faassen) wrote :

Any results of more testing? It'd be good if Grok worked out of the box with Python 2.5 on Mac OS X.

Did you create the virtualenv using --no-site-packages? It's my understand this is required on the mac.

Revision history for this message
Noah Gift (noah-gift) wrote : Re: [Bug 180410] Re: Trouble using grokproject egg with Python2.5 on OS X Leopard and virtualenv
Download full text (4.1 KiB)

On Wed, Jan 14, 2009 at 5:50 AM, Martijn Faassen <email address hidden> wrote:
> Any results of more testing? It'd be good if Grok worked out of the box
> with Python 2.5 on Mac OS X.
>
> Did you create the virtualenv using --no-site-packages? It's my
> understand this is required on the mac.

It appears to install fine without virtualenv, although I get a couple
of errors:

Running RestrictedPython-3.4.3/setup.py -q bdist_egg --dist-dir
/tmp/easy_install-vk80Sm/RestrictedPython-3.4.3/egg-dist-tmp-MzoHS4
build/bdist.macosx-10.5-i386/egg/RestrictedPython/tests/before_and_after26.py:30:
Warning: 'with' will become a reserved keyword in Python 2.6
  File "build/bdist.macosx-10.5-i386/egg/RestrictedPython/tests/before_and_after26.py",
line 30
    with whatever as x:
                ^
SyntaxError: invalid syntax

build/bdist.macosx-10.5-i386/egg/RestrictedPython/tests/security_in_syntax26.py:6:
Warning: 'with' will become a reserved keyword in Python 2.6
  File "build/bdist.macosx-10.5-i386/egg/RestrictedPython/tests/security_in_syntax26.py",
line 6
    with x as _leading_underscore:
         ^
SyntaxError: invalid syntax

/Library/Python/2.5/site-packages/RestrictedPython-3.4.3-py2.5.egg/RestrictedPython/tests/before_and_after26.py:30:
Warning: 'with' will become a reserved keyword in Python 2.6
  File "/Library/Python/2.5/site-packages/RestrictedPython-3.4.3-py2.5.egg/RestrictedPython/tests/before_and_after26.py",
line 30
    with whatever as x:
                ^
SyntaxError: invalid syntax

/Library/Python/2.5/site-packages/RestrictedPython-3.4.3-py2.5.egg/RestrictedPython/tests/security_in_syntax26.py:6:
Warning: 'with' will become a reserved keyword in Python 2.6
  File "/Library/Python/2.5/site-packages/RestrictedPython-3.4.3-py2.5.egg/RestrictedPython/tests/security_in_syntax26.py",
line 6
    with x as _leading_underscore:
         ^
SyntaxError: invalid syntax

Adding RestrictedPython 3.4.3 to easy-install.pth file

Installed /Library/Python/2.5/site-packages/RestrictedPython-3.4.3-py2.5.egg
Searching for zope.app.file
Reading http://pypi.python.org/simple/zope.app.file/
Reading http://svn.zope.org/zope.app.file
Best match: zope.app.file 3.4.4
Downloading http://pypi.python.org/packages/source/z/zope.app.file/zope.app.file-3.4.4.tar.gz#md5=ef90637d3fd6699f2d2b17ed7440de9d
Processing zope.app.file-3.4.4.tar.gz
Running zope.app.file-3.4.4/setup.py -q bdist_egg --dist-dir
/tmp/easy_install-cF6tDT/zope.app.file-3.4.4/egg-dist-tmp-yLLN-Y
Adding zope.app.file 3.4.4 to easy-install.pth file

Installed /Library/Python/2.5/site-packages/zope.app.file-3.4.4-py2.5.egg
Finished processing dependencies for grok

I can also confirm it appears to work with virtualenv now:

dhcp-record-pc210% virtualenv --no-site-packages mygrokENV
New python executable in mygrokENV/bin/python
Installing setuptools.............done.
dhcp-record-pc210% cd mygrokENV
dhcp-record-pc210% ls
bin include lib
dhcp-record-pc210% source bin/activate
(mygrokENV)dhcp-record-pc210% easy_install grok
Searching for grok
Best match: grok 1.0a1
Processing grok-1.0a1-py2.5.egg
Adding grok 1.0a1 to easy-install.pth file

Using /Library/Python/2.5/site-packages/grok-1.0a1-py2.5.egg
Proce...

Read more...

Revision history for this message
Ben Dadsetan (bdadsetan) wrote :

My understanding is that we do support 2.5.

I can reproduce the problem using python 2.5.1 on the grokproject-1.0a4dev [trunk].

I do not understand why on linux and windows pastescript would automatically be downloaded and installed by easy_install but not on Mac. I do not know how to investigate this though.

Can someone direct me to pointers? I am very interested in getting this one resolved.

Revision history for this message
Ben Dadsetan (bdadsetan) wrote :

By the way, the simple workaround is to run easy_install PasteScript before running grokproject. So it is hard for me to imagine we can't get this fixed automatically. =

Revision history for this message
Ben Dadsetan (bdadsetan) wrote :

Ok.. I think I figured it out. It seems easy_install finds a version of PasteScript laying around in
/Library/Python/2.5/lib/site-packages and therefore decides not to install it.

But because we run easy_install within a virtualenv, we need it to install it within our virtual environment.

I will approach the PEAK team and see if they can correct this (and whether I can help them). I feel this is not a grok bug.

But, we need to be clear we do support 2.5 and we should be able to say we do support MacOS X 10.5.6's default Python 2.5.1. Don't you agree?

Revision history for this message
Tim Cook (timothywayne-cook) wrote :

Hi,

I am not a Mac user myself but one of my project members has created this FAQ for installing OSHIP (Grok based) on Mac 10.3/10.4

Maybe if some of this works we can generalize it for Grok?

https://answers.launchpad.net/oship/+faq/583

Cheers,
Tim

Revision history for this message
Martijn Faassen (faassen) wrote :

We believe this works now on Mac OS X.

Another comment, no --no-site-packages wasn't passed to virtualenv in the original description. This might lead to conflicts with system-installed packages.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.