[Python-bugs-list] [ python-Bugs-446588 ] Python-2.2a1 build dies

noreply@sourceforge.net noreply@sourceforge.net
Thu, 02 Aug 2001 10:37:07 -0700


Bugs item #446588, was opened at 2001-07-31 15:17
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=446588&group_id=5470

Category: Build
Group: Python 2.2
Status: Open
Resolution: Works For Me
Priority: 3
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Nobody/Anonymous (nobody)
Summary: Python-2.2a1 build dies

Initial Comment:
after doing:

./configure --prefix=$HOME/local/STOW
make

the build bombs in the install phase with:

usr/bin/install -c ./install-sh
/home/mahler/local/STOW/Python-2.2a1/lib/python2.2/config/install-sh
/usr/bin/install -c -m 644 ./Misc/Makefile.pre.in
/home/mahler/local/STOW/Python-2.2a1/lib/python2.2/config/Makefile.pre.in
PYTHONPATH= ./python ./setup.py install \

--install-platlib=/home/mahler/local/STOW/Python-2.2a1/lib/python2.2/lib-dynload
'import site' failed; use -v for traceback
Traceback (most recent call last):
  File "./setup.py", line 6, in ?
    import sys, os, getopt
ImportError: No module named os
make[1]: *** [sharedinstall] Error 1
make[1]: Leaving directory
`/mcallister0/home/mahler/local/SRC/Python-2.2a1'
make: *** [STOW/Python-2.2a1] Error 2
rm SRC/Python-2.2a1make: unlink: SRC/Python-2.2a1: Is a
directory
 STOW/Python-2.2a1make: unlink: STOW/Python-2.2a1: Is a
directory
 SRC/Python-2.2a1/Makefile


----------------------------------------------------------------------

Comment By: Nobody/Anonymous (nobody)
Date: 2001-08-02 10:37

Message:
Logged In: NO 

Guido,

I forgot to mention that
the new image would not find
any of the standard modules
on the sys.path since I unstowed
my old instatallation be fore the build
and ~/local/SRC/Python2.2a1/Lib is not
on sys.path.
(You expected it to be there automatically if I remeber)

Daniel

----------------------------------------------------------------------

Comment By: Nobody/Anonymous (nobody)
Date: 2001-08-02 10:19

Message:
Logged In: NO 

Guido,

Yes, the sys.path does make sense.
I use stow <http://www.gnu.org/software/stow/manual.html>
to manage my downloaded software.
So package X ends up being installed at $HOME/local/STOW/X.
Stow then creates symlinks to make it look like it is
installed at $HOME/local.
This makes it easy to tell which file belongs to which
package without having PATH, INCLUDE etc be as long as your
arm.
I have a make file $HOME/local which when invoked with "make
X", 
untars $HOME/local/TAR/X.tgz into $HOME/local/SRC
does 
$ cd $HOME/local/SRC/X
where it then does
$ ./configure --prefix=$HOME/local/STOW/X
$ make
$ make install
finally it then does
$ cd $HOME/local/STOW
$ stow X

Therefore, PYTHONPATH is $HOME/local
so I do not have to change it between installs.
This has worked with
versions 1.5.2, 1.6, 2.0, and 2.1,
and with all GNU software,
and most other autoconfiguring software. 

Here is the python section of my .bashrc

# Python
export PYAPPS=$LOCAL/PYTHON
alias pyapps='/bin/ls -d $PYAPPS/*'
alias pyappspath='jn : `pyapps`'
export PYTHONHOME=$LOCAL
export PYTHONSTARTUP=~/.pythonrc.global.py
export PYTHONSTARTUPPATH=~/.pythonrc.py:./.pythonrc.py
export PYTHONPATH=.:`pyappspath`:$LIB/python:$PYTHONPATH
export PATH=$PYTHONPATH:$PATH

Here is the makefile
I use to build GNU style software.
+++++++++++++++++++++++++++++++++++++++++++
.SUFFIXES: .jar .tar .tar.bz2 .tar.gz .tgz .Z .zip .build
.kill .clean .check .test


#ANT_JARS=find $(JAVA_DIR)/SRC/dist -name "*.jar"
#ANT_PATH=jn : \



%: STOW/%
	rm -f $</info/dir; # remove this line if installing emacs
itself
	(cd STOW; stow $(<F));

STOW/%: SRC/%/Makefile
	 $(MAKE) $(@F).kill;
	 cp -a STOW/LOCAL $@
	 $(MAKE) -C SRC/$(@F) install;

#%: SRC/%/build.xml
#	 CLASSPATH=`$(ANT_PATH)`:$(CLASSPATH)
#	 ant -buildfile $< all

#STOW/%: SRC/%/build.sh
#	(cd $(<D); sh ./build.sh -Dbuild=$@)

#%: SRC/%/build.sh
#	$(<D)/build.sh -buildfile $< all

# SRC/%/build.sh: SRC/%

# SRC/%/build.xml: SRC/%

#SRC/%.build: SRC/%/Makefile
#	 $(MAKE) -C $(<D);

SRC/%/Makefile: SRC/%
#	(HERE=`(cd ..; pwd)`; cd $<;  ./configure
--prefix=$$HERE/STOW/$(<F))
	cd $<; ./configure --prefix=$(STOW)/$(<F)

SRC/%: TAR/%.tgz
	tar zfx $< --directory $(@D);

SRC/%: TAR/%.tar.gz
	tar zfx $< --directory $(@D);

SRC/%: TAR/%.tar.Z
	tar zfx $< --directory $(@D);

SRC/%: TAR/%.zip
	unzip -d $(@) $<

SRC/%: TAR/%.tar
	tar fx $< --directory $(@D);

TAR/%.tar: TAR/%.tar.bz2
	bunzip2 $<

SRC/%: TAR/%.jar
	jar fx $< --directory $(@D);

%.kill:
	(cd STOW; stow -D $(*F))
	rm -rf  STOW/$(*F);

%.clean: %.kill
	rm -rf SRC/$(*F);

%.check: SRC/%/Makefile
	 $(MAKE) -C $(<D) check;

%.test: SRC/%/Makefile
	 $(MAKE) -C $(<D) test;
+++++++++++++++++++++++++++++++++++++++++++++++++

My ~/pythonrc.global.py is

+++++++++++++++++++++++++++++++++++++++++++++++++
import os
import string

path = string.split(os.environ.get('PYTHONSTARTUPPATH'),':')
for file in path:
    if os.path.isfile(file):
        execfile(file)
+++++++++++++++++++++++++++++++++++++++++++++++++

but that should not be coming into play
when python is being invoked by make

regards
Daniel


----------------------------------------------------------------------

Comment By: Guido van Rossum (gvanrossum)
Date: 2001-08-02 05:28

Message:
Logged In: YES 
user_id=6380

You have to do some thinking yourself too, you know. :-)

Does that sys.path value make any sense to you? It doesn't
match the prefix.

Are the missing modules found on any of those?

What other env vars do you have set that start with PYTHON?
Do you have PYTHONHOME?

----------------------------------------------------------------------

Comment By: Nobody/Anonymous (nobody)
Date: 2001-08-01 15:57

Message:
Logged In: NO 

$ ./python
'import site' failed; use -v for traceback
Python 2.2a1 (#4, Aug  1 2001, 16:55:28) 
[GCC egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)] on
linux2
Type "copyright", "credits" or "license" for more
information.
Traceback (most recent call last):
  File "/home/mahler/.pythonrc.global.py", line 1, in ?
    import os
ImportError: No module named os
>>> import sys
>>> sys.path
['', '.', '/home/mahler/local/PYTHON/Meta',
'/home/mahler/local/PYTHON/kwP',
'/home/mahler/local/lib/python',
'/home/mahler/local/lib/python2.1',
'/home/mahler/local/APPS/jack-2.2.0',
'/home/mahler/local/lib/python2.1',
'/home/mahler/local/lib/python2.2/',
'/home/mahler/local/lib/python2.2/plat-linux2',
'/home/mahler/local/lib/python2.2/lib-tk',
'/home/mahler/local/lib/python2.2/lib-dynload']
>>> 


----------------------------------------------------------------------

Comment By: Guido van Rossum (gvanrossum)
Date: 2001-08-01 15:34

Message:
Logged In: YES 
user_id=6380

Need more info.  Try this:

./python
>>> import sys
>>> print sys.path



----------------------------------------------------------------------

Comment By: Nobody/Anonymous (nobody)
Date: 2001-08-01 15:19

Message:
Logged In: NO 

python only starts correctly if I give it the Lib path:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$ ./python -v
'import site' failed; traceback:
ImportError: No module named site
Python 2.2a1 (#4, Aug  1 2001, 16:55:28) 
[GCC egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)] on
linux2
Type "copyright", "credits" or "license" for more
information.
Traceback (most recent call last):
  File "/home/mahler/.pythonrc.global.py", line 1, in ?
    import os
ImportError: No module named os
>>> 
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$ PYTHONPATH=Lib ./python -v
# Lib/site.pyc matches Lib/site.py
import site # precompiled from Lib/site.pyc
# Lib/os.pyc matches Lib/os.py
import os # precompiled from Lib/os.pyc
import posix # builtin
# Lib/posixpath.pyc matches Lib/posixpath.py
import posixpath # precompiled from Lib/posixpath.pyc
# Lib/stat.pyc matches Lib/stat.py
import stat # precompiled from Lib/stat.pyc
# Lib/UserDict.pyc matches Lib/UserDict.py
import UserDict # precompiled from Lib/UserDict.pyc
Python 2.2a1 (#4, Aug  1 2001, 16:55:28) 
[GCC egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)] on
linux2
Type "copyright", "credits" or "license" for more
information.
#
/mcallister0/home/mahler/local/SRC/Python-2.2a1/Lib/string.pyc
matches
/mcallister0/home/mahler/local/SRC/Python-2.2a1/Lib/string.py
import string # precompiled from
/mcallister0/home/mahler/local/SRC/Python-2.2a1/Lib/string.pyc
>>>
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Daniel


----------------------------------------------------------------------

Comment By: Guido van Rossum (gvanrossum)
Date: 2001-08-01 15:08

Message:
Logged In: YES 
user_id=6380

Hm.  Why does the newly built image not know that ./Lib is
the library?  This works for me!  (Note that PYTHONPATH gets
appended to the default sys.path, so setting it empty
shouldn't make a difference.)

What happens when you execute ./python at the command line? 
Does "import site" also fail there?

Please try to poke around for more evidence.

----------------------------------------------------------------------

Comment By: Nobody/Anonymous (nobody)
Date: 2001-08-01 15:00

Message:
Logged In: NO 

Yes, I made a boo boo:
--prefix=$HOME/local/STOW/Python-2.2a1
$PYTHONHOME is $HOME/local
since I use stow to manage all my dowloaded software in
$HOME/local.
This has always worked in the past.
I have a script which automactes the whole
untar, configure,make, install process to stop me making 
errors like the above.
The problem appears to be that last command:
PYTHONPATH= ./python ./setup.py install  ...
sets the $PYTHONPATH to be empty and the newly built image
does not know that the libraries are in the Lib directory
just below it.
doing
PYTHONPATH=./Lib ./python ./setup.py install
--install-platlib=/home/mahler/local/STOW/Python-2.2a1/lib/python2.2/lib-dynload
does not crash but produces a whole bunch of warnings like:

building 'zlib' extension
skipping
/mcallister0/home/mahler/local/SRC/Python-2.2a1/Modules/zlibmodule.c
(build/temp.linux-i686-2.2/zlibmodule.o up-to-date)
gcc -shared build/temp.linux-i686-2.2/zlibmodule.o
-L/usr/local/lib -lz -o build/lib.linux-i686-2.2/zlib.so
WARNING: removing "zlib" since importing it failed

Daniel

----------------------------------------------------------------------

Comment By: Guido van Rossum (gvanrossum)
Date: 2001-08-01 13:55

Message:
Logged In: YES 
user_id=6380

I can't reproduce this; configuring with a prefix works
fine.

Your story seems inconsistent: you say you configured with
prefix $HOME/local/STOW, but the output you cite looks like
it was configured with prefix $HOME/local/STOW/Python-2.2a1.

What platform?  What's $PYTHONHOME?

Try adding -v to the python invocation that fails to see the
failure traceback.

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=446588&group_id=5470