homebrew python not working with web2py

107 views
Skip to first unread message

lyn2py

unread,
Dec 30, 2016, 12:29:08 AM12/30/16
to web2py-users
I am not sure if this is the right place to ask this, but it only happens with web2py (for now).

Due to a need to use pip, I used homebrew to install python. 
Sidenote: Homebrew used to require additional configuration to work as "the python" on the system, but now it does everything automatically. So when I type

$ which python

...I get the one that homebrew installed.

Onward...
I tried 

$ python web2py.py

...which is the homebrew installed one, and ran into this error:

Traceback (most recent call last):


  File "/Users/web2py/web2py.py", line 21, in <module>


    import gluon.widget


  File "/Users/web2py/gluon/__init__.py", line 31, in <module>


    "You can also download a complete copy from http://www.web2py.com."


RuntimeError: web2py depends on pydal, which apparently you have not installed.


Probably you cloned the repository using git without '--recursive'


To fix this, please run (from inside your web2py folder):




     git submodule update --init --recursive




You can also download a complete copy from http://www.web2py.com.



But when I run this command, which uses the system's python, it works!

$ /usr/bin/python web2py.py

I could always add "/usr/bin/" as a habit when starting web2py, but why doesn't homebrew's installed python work? Are they not the same?

When I run python in command line, HOMEBREW:

$ python


Python 2.7.13 (default, Dec 17 2016, 23:03:43)


[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin


Type "help", "copyright", "credits" or "license" for more information.


>>> exit()


...and, SYSTEM:

$ /usr/bin/python


Python 2.7.10 (default, Oct 23 2015, 19:19:21)


[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.5)] on darwin


Type "help", "copyright", "credits" or "license" for more information.


>>> exit()


Thank you for reading!

Mark Graves

unread,
Dec 30, 2016, 4:06:07 PM12/30/16
to web2py-users
How did you install web2py?  as a zip? via git? 

Did you ever pip install gluon? 

Did you install web2py / python at different times?

Can you try under each python version to do:

import gluon.widget

lyn2py

unread,
Jan 1, 2017, 10:02:09 AM1/1/17
to web...@googlegroups.com
HAPPY NEW YEAR!


On Saturday, December 31, 2016 at 5:06:07 AM UTC+8, Mark Graves wrote:
How did you install web2py?  as a zip? via git? 

git clone


Did you ever pip install gluon? 

nope 


Did you install web2py / python at different times?

I've been using web2py for years using the system python, and I only installed python via homebrew recently for other purposes, and homebrew automatically replaced the system python as the default one to use (no complaints, since it's a higher version), which was why I discovered that it won't work with web2py. The only thing, I presume, is different, is the version of python. If you see the code in my first post, the respective versions for SYSTEM vs HOMEBREW are 2.7.10 and 2.7.13.
 

Can you try under each python version to do:

import gluon.widget

Oh good suggestion. I tried with both, and they both imported it fine. So it works in command-line python, but not with web2py (I dunno the right word for this... app / desktop app / gui)? I'll be happy to run any tests to figure out why... but do you think there might be something wrong with the version installed by homebrew??

Mark Graves

unread,
Jan 1, 2017, 8:51:55 PM1/1/17
to web...@googlegroups.com
potential quick fix before giving it thought:

did you:

     git submodule update --init --recursive

You can easily try this by creating a new web2py installation in a different folder so you don't mess up exising apps.

Also, is it broken with the downloaded version via zip?

On Sun, Jan 1, 2017 at 9:02 AM, lyn2py <lyn...@gmail.com> wrote:


On Saturday, December 31, 2016 at 5:06:07 AM UTC+8, Mark Graves wrote:
How did you install web2py?  as a zip? via git? 

git clone


Did you ever pip install gluon? 

nope 


Did you install web2py / python at different times?

I've been using web2py for years using the system python, and I only installed python via homebrew recently for other purposes, and homebrew automatically replaced the system python as the default one to use (no complaints, since it's a higher version), which was why I discovered that it won't work with web2py. The only thing, I presume, is different, is the version of python. If you see the code in my first post, the respective versions for SYSTEM vs HOMEBREW are 2.7.10 and 2.7.13.
 

Can you try under each python version to do:

import gluon.widget

Oh good suggestion. I tried with both, and they both imported it fine. So it works in command-line python, but not with web2py (I dunno the right word for this... app / desktop app / guy)? I'll be happy to run any tests to figure out why... but do you think there might be something wrong with the version installed by homebrew??

--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/XN8DgrUdn0A/unsubscribe.
To unsubscribe from this group and all its topics, send an email to web2py+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

lyn2py

unread,
Jan 1, 2017, 9:37:00 PM1/1/17
to web2py-users
First, it is a working folder that I've been using. It breaks the moment when I use homebrew's version of python to start web2py. It works when I use the system's python. Both commands are on the same directory.
Secondly, I have tried git clone recursive in a brand new folder, but it's still the same result.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.

Mark Graves

unread,
Jan 1, 2017, 9:55:59 PM1/1/17
to web...@googlegroups.com
Is it in a virtual environment?

-Mark

To unsubscribe from this group and all its topics, send an email to web2py+unsubscribe@googlegroups.com.

lyn2py

unread,
Jan 2, 2017, 10:01:20 AM1/2/17
to web2py-users
Nope :)

Mark Graves

unread,
Jan 3, 2017, 4:43:41 AM1/3/17
to web...@googlegroups.com
did you try the downloaded via zip version?

To unsubscribe from this group and all its topics, send an email to web2py+unsubscribe@googlegroups.com.

Mark Graves

unread,
Jan 3, 2017, 4:58:10 AM1/3/17
to web...@googlegroups.com
Wait wait, whats the output of 

which python

Mark Graves

unread,
Jan 3, 2017, 5:00:53 AM1/3/17
to web...@googlegroups.com
Also, under each please list the output of:

import os
print os.environ['PYTHONPATH']

import sys
print sys.path

lyn2py

unread,
Jan 3, 2017, 9:54:35 AM1/3/17
to web2py-users
No, did not try the zip. It doesn't have to do with the release, rather it is the version of python that was installed by homebrew. I read somewhere that it is unstable, I don't know why that would be the case. While we are on the topic, did you try the python installation by homebrew? Is web2py running with the python 2 installed by homebrew for you?

which python was included in my first post, here it is again:

$ which python


/usr/local/bin/python





HOMEBREW

$ python


Python 2.7.13 (default, Dec 17 2016, 23:03:43)


[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin


Type "help", "copyright", "credits" or "license" for more information.


>>> import os


>>> print os.environ['PYTHONPATH']


Traceback (most recent call last):


  File "<stdin>", line 1, in <module>


  File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/UserDict.py", line 40, in __getitem__


    raise KeyError(key)


KeyError: 'PYTHONPATH'


>>> import sys


>>> print sys.path


['', '/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', '/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7', '/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', '/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old', '/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/site-packages']



SYSTEM

$ /usr/bin/python


Python 2.7.10 (default, Oct 23 2015, 19:19:21)


[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.5)] on darwin


Type "help", "copyright", "credits" or "license" for more information.


>>> import os


>>> print os.environ['PYTHONPATH']


Traceback (most recent call last):


  File "<stdin>", line 1, in <module>


  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/UserDict.py", line 23, in __getitem__


    raise KeyError(key)


KeyError: 'PYTHONPATH'


>>> import sys


>>> print sys.path


['', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload', '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC', '/Library/Python/2.7/site-packages']



lyn2py

unread,
Jan 3, 2017, 10:11:31 AM1/3/17
to web2py-users
It is working now. O.O Sorry for the noise and thank you for your time Mark.

I blew a fuse in the house and then it worked. Prior to that I restarted the computer and it still didn't work. This is crazy and not reproducible... YMMV...

    import<spa

Mark Graves

unread,
Jan 3, 2017, 4:21:07 PM1/3/17
to web2py-users
Those are the best kinds of bugs =)

Happy New Year
Reply all
Reply to author
Forward
0 new messages