[MacPorts] #21970: scons with Python 2.6.3 on Snow Leopard can't find Packages path
#21970: scons with Python 2.6.3 on Snow Leopard can't find Packages path ---------------------------------+------------------------------------------ Reporter: tcwan@… | Owner: macports-tickets@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 1.8.1 Keywords: python 2.6.3, scons | Port: 1.8.1 ---------------------------------+------------------------------------------ My problem shows up when trying to invoke Python Imaging (PIL) from a python script depending on PIL via scons. It can't locate the PIL libraries, which were installed in: /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/... The normal location /opt/local/lib/python2.6/site-packages/ does not contain any file related to PIL (only 1 python script ktoblzcheck.py was present) If the script were invoked from the command line, it'll find the PIL libraries without any problem. Python 2.5 seems to install the libraries in both the /opt/local/Library/Frameworks/ as well as the /opt/local/lib/python2.5 /site-packages/ directories, so it does not encounter this problem. -- Ticket URL: <http://trac.macports.org/ticket/21970> MacPorts <http://www.macports.org/> Ports system for Mac OS
#21970: scons with Python 2.6.3 on Snow Leopard can't find Packages path -----------------------------+---------------------------------------------- Reporter: tcwan@… | Owner: landonf@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 1.8.1 Keywords: | Port: scons -----------------------------+---------------------------------------------- Changes (by macsforever2000@…): * cc: blb@… (added) * keywords: python 2.6.3, scons => * port: 1.8.1 => scons * owner: macports-tickets@… => landonf@… -- Ticket URL: <http://trac.macports.org/ticket/21970#comment:1> MacPorts <http://www.macports.org/> Ports system for Mac OS
#21970: scons with Python 2.6.3 on Snow Leopard can't find Packages path -----------------------------+---------------------------------------------- Reporter: tcwan@… | Owner: landonf@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 1.8.1 Keywords: | Port: scons -----------------------------+---------------------------------------------- Comment(by blb@…): Replying to [ticket:21970 tcwan@…]:
My problem shows up when trying to invoke Python Imaging (PIL) from a python script depending on PIL via scons. It can't locate the PIL libraries, which were installed in:
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/... Do you have a way to reproduce this?
The normal location /opt/local/lib/python2.6/site-packages/ does not
contain any file related to PIL (only 1 python script ktoblzcheck.py was present) Nothing at all should be there, the ktoblzcheck port may be doing things wrong (that location is not in sys.path). -- Ticket URL: <http://trac.macports.org/ticket/21970#comment:2> MacPorts <http://www.macports.org/> Ports system for Mac OS
#21970: scons with Python 2.6.3 on Snow Leopard can't find Packages path -----------------------------+---------------------------------------------- Reporter: tcwan@… | Owner: landonf@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 1.8.1 Keywords: | Port: scons -----------------------------+---------------------------------------------- Comment(by tcwan@…): Replying to [comment:2 blb@…]:
Do you have a way to reproduce this?
I'm using scons with the nxos project -- git://github.com/danderson/nxos.git I'm not familiar with scons, just that I have two build environments, one on Leopard (Python 2.5.x) and the other on Snow Leopard (Python 2.6.x). On Leopard (python 2.5.4) it runs fine, scons would setup and execute the script to completion (via a hack to include /opt/local/lib/python2.5/site- packages in the search path). On Snow Leopard (python 2.6.3), it complains about being unable to find PIL when executed using scons but works fine when executed from the command line. The only difference I see is that under python 2.5.x there are hardlinks to /opt/local/lib/python2.5/site- packages/PIL/* whereas in 2.6.x, /opt/local/lib/python2.6/ does not contain anything (or mostly empty, anyway). (The generate_fonts.py script searches for PIL in /opt/local/lib/python2.5 /site-packages/ as a workaround for scons on MacOSX -- I'm not keen on hacking that further since it's not maintainable, including /opt/local/Library/... is too Mac centric and prone to error due to the lengthy path) I've attached the relevant scripts if it makes any difference. Here is the console output (on Snow Leopard): TCMBA-Mac:nxos tcmac$ scons appkernels=tests scons: Reading SConscript files ... Checking for arm-elf-gcc...(cached) ok Checking for arm-elf-ar...(cached) ok Checking for arm-elf-objcopy...(cached) ok Checking for arm-elf-ld...(cached) ok Locating a cross-compiled libgcc...(cached) ok - /Cross- ARM/yagarto-4.4.1/lib/gcc/arm-elf/4.4.1/interwork/libgcc.a Looking for Doxygen...(cached) not found scons: done reading SConscript files. scons: Building targets ... ./scripts/generate_fonts.py base/font.8x5.png base/_font.h.base base/_font.h ERROR: Python Imaging Library required for font generation. scons: *** [base/_font.h] Error 2 scons: building terminated because of errors. TCMBA-Mac:nxos tcmac$ ./scripts/generate_fonts.py base/font.8x5.png base/_font.h.base base/_font.h TCMBA-Mac:nxos tcmac$ << NO ERRORS >> TCMBA-Mac:base tcmac$ python Python 2.6.3 (r263:75183, Oct 9 2009, 21:45:39) [GCC 4.2.1 (Apple Inc. build 5646)] on darwin Type "help", "copyright", "credits" or "license" for more information.
import PIL
-- Ticket URL: <http://trac.macports.org/ticket/21970#comment:3> MacPorts <http://www.macports.org/> Ports system for Mac OS
#21970: scons with Python 2.6.3 on Snow Leopard can't find Packages path -----------------------------+---------------------------------------------- Reporter: tcwan@… | Owner: landonf@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 1.8.1 Keywords: | Port: scons -----------------------------+---------------------------------------------- Comment(by tcwan@…): Replying to [comment:3 tcwan@…]: Sorry, I mangled the Console output. I've attached the relevant scripts if it makes any difference. Here is the console output (on Snow Leopard): {{{ TCMBA-Mac:nxos tcmac$ scons appkernels=tests scons: Reading SConscript files ... Checking for arm-elf-gcc...(cached) ok Checking for arm-elf-ar...(cached) ok Checking for arm-elf-objcopy...(cached) ok Checking for arm-elf-ld...(cached) ok Locating a cross-compiled libgcc...(cached) ok - /Cross- ARM/yagarto-4.4.1/lib/gcc/arm-elf/4.4.1/interwork/libgcc.a Looking for Doxygen...(cached) not found scons: done reading SConscript files. scons: Building targets ... ./scripts/generate_fonts.py base/font.8x5.png base/_font.h.base base/_font.h ERROR: Python Imaging Library required for font generation. scons: *** [base/_font.h] Error 2 scons: building terminated because of errors. TCMBA-Mac:nxos tcmac$ ./scripts/generate_fonts.py base/font.8x5.png base/_font.h.base base/_font.h TCMBA-Mac:nxos tcmac$ << NO ERRORS >> TCMBA-Mac:base tcmac$ python Python 2.6.3 (r263:75183, Oct 9 2009, 21:45:39) [GCC 4.2.1 (Apple Inc. build 5646)] on darwin Type "help", "copyright", "credits" or "license" for more information.
import PIL
}}}
-- Ticket URL: <http://trac.macports.org/ticket/21970#comment:4> MacPorts <http://www.macports.org/> Ports system for Mac OS
#21970: scons with Python 2.6.3 on Snow Leopard can't find Packages path -----------------------------+---------------------------------------------- Reporter: tcwan@… | Owner: landonf@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 1.8.1 Keywords: | Port: scons -----------------------------+---------------------------------------------- Comment(by blb@…): Are you sure it's running the right python? That {{{scripts/generate_fonts.py}}} is simply appending the 2.5 python lib location to sys.path, which shouldn't break importing PIL with python 2.6 (unless you also have 2.5 installed). Manually reproducing that: {{{ $ /opt/local/bin/python2.6 Python 2.6.3 (r263:75183, Oct 11 2009, 02:48:30) [GCC 4.2.1 (Apple Inc. build 5646) (dot 1)] on darwin Type "help", "copyright", "credits" or "license" for more information.
import sys sys.path.append('/opt/local/lib/python2.5/site-packages') from PIL import Image }}} No error happens. I do note {{{scripts/generate_fonts.py}}} is using {{{#!/usr/bin/env python}}} so you'll need {{{/opt/local/bin}}} before {{{/usr/bin}}} and python_select installed and used to select MacPorts' python26 as the one.
-- Ticket URL: <http://trac.macports.org/ticket/21970#comment:5> MacPorts <http://www.macports.org/> Ports system for Mac OS
#21970: scons with Python 2.6.3 on Snow Leopard can't find Packages path -----------------------------+---------------------------------------------- Reporter: tcwan@… | Owner: landonf@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 1.8.1 Keywords: | Port: scons -----------------------------+---------------------------------------------- Comment(by tcwan@…): I've used python_select to specify python26 (macports). On my Leopard (2.5.x) environment, I have py25-pil, (but not py26-pil) installed. I use python25 on Leopard normally. if I select python26 as the default it can find PIL because it takes it from the 2.5 site-packages using the appended path. On Snow Leopard (2.6.x) environment, I have py26-pil (not py25-pil) installed. I don't plan to have python 2.5 on Snow Leopard (if possible). I suppose if I installed py25-pil it probably could work since it forces it to load from the 2.5 site-packages path. The lack of pil-25 doesn't affect the loading of PIL if it's executed from the command line, since python could find pil-26 from the installed location (/opt/local/Library...). It's only when scons invokes python and the script that it is not able to locate pil-26 on Snow Leopard. -- Ticket URL: <http://trac.macports.org/ticket/21970#comment:6> MacPorts <http://www.macports.org/> Ports system for Mac OS
#21970: scons with Python 2.6.3 on Snow Leopard can't find Packages path ------------------------------+--------------------------------------------- Reporter: tcwan@… | Owner: landonf@… Type: defect | Status: closed Priority: Normal | Milestone: Component: ports | Version: 1.8.1 Resolution: invalid | Keywords: Port: scons | ------------------------------+--------------------------------------------- Changes (by jmr@…): * status: new => closed * resolution: => invalid Comment: The SConscript is executing generate_fonts.py directly, and its shebang uses `/usr/bin/env python`. It should run it using a specifically configured python that you know has PIL, or at least sys.executable. -- Ticket URL: <https://trac.macports.org/ticket/21970#comment:7> MacPorts <http://www.macports.org/> Ports system for Mac OS
participants (1)
-
MacPorts