Opened 15 years ago
Closed 14 years ago
#21970 closed defect (invalid)
scons with Python 2.6.3 on Snow Leopard can't find Packages path
Reported by: | tcwan (TC Wan) | Owned by: | landonf (Landon Fuller) |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | ports | Version: | 1.8.1 |
Keywords: | Cc: | blb@… | |
Port: | scons |
Description
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.
Attachments (3)
Change History (10)
comment:1 Changed 15 years ago by mf2k (Frank Schima)
Cc: | blb@… added |
---|---|
Keywords: | python 2.6.3 scons removed |
Owner: | changed from macports-tickets@… to landonf@… |
Port: | scons added; 1.8.1 removed |
comment:2 follow-up: 3 Changed 15 years ago by blb@…
Changed 15 years ago by tcwan (TC Wan)
Attachment: | generate_fonts.py added |
---|
Python script which generates font definitions requiring PIL
Changed 15 years ago by tcwan (TC Wan)
Attachment: | SConscript added |
---|
SConscript which calls the generate_fonts.py script
comment:3 follow-up: 4 Changed 15 years ago by tcwan (TC Wan)
Replying to 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
comment:4 Changed 15 years ago by tcwan (TC Wan)
Replying to 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 >>>
comment:5 Changed 15 years ago 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.
comment:6 Changed 15 years ago by tcwan (TC Wan)
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.
comment:7 Changed 14 years ago by jmroot (Joshua Root)
Resolution: | → invalid |
---|---|
Status: | new → closed |
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.
Replying to tcwan@…:
Do you have a way to reproduce this?
Nothing at all should be there, the ktoblzcheck port may be doing things wrong (that location is not in sys.path).