This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Unsupported provider

classification
Title: Python 2.7 installation issue for Linux gcc-4.1.0-3 (Fedora Core 5?)
Type: compile error Stage:
Components: Installation Versions: Python 2.7
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: Ari.Consul, Richard.West, asisco, dmalcolm, eraonel, eric.araujo, flox, hozn, loewis, miro_ilias, orsenthil, spaceli, spprakash
Priority: normal Keywords:

Created on 2010-08-18 05:22 by spprakash, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (18)
msg114196 - (view) Author: Prakash Palanivel (spprakash) Date: 2010-08-18 05:22
Server on Linux:gcc version 4.1.0 20060304 (Red Hat 4.1.0-3)
Which "sunaudiodev" library i need to install on linux.

Kindly help me how to install or configure or avoid this issue.

Error:
Python build finished, but the necessary bits to build these modules were not found:
_tkinter           bsddb185           sunaudiodev     
To find the necessary bits, look in setup.py in detect_modules() for the module's name.
msg114197 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2010-08-18 05:55
You are misinterpreting what you are seeing. The message you get is not an error message. It works all fine, and correctly. To build the sunaudiodev module, you need Sun/Oracle Solaris, not Linux.
msg114199 - (view) Author: Prakash Palanivel (spprakash) Date: 2010-08-18 06:05
After complete the installation the below error message was displayed.Kindly check and revert.
./python -E ./setup.py install \
   	--prefix=/usr/local/python-2.7 \
	--install-scripts=/usr/local/python-2.7/bin \
	--install-platlib=/usr/local/python-2.7/lib/python2.7/lib-dynload \
	--root=/
make: execvp: ./python: Text file busy
make: *** [sharedinstall] Error 127
msg114202 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2010-08-18 06:29
What file system is this on?
msg114203 - (view) Author: Prakash Palanivel (spprakash) Date: 2010-08-18 07:40
After Installed the following error was through:

PYTHONPATH=/usr/local/Python-2.7/lib/python2.7   \
	./python -Wi -tt /usr/local/Python-2.7/lib/python2.7/compileall.py \
	-d /usr/local/Python-2.7/lib/python2.7 -f \
	-x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
	/usr/local/Python-2.7/lib/python2.7
Traceback (most recent call last):
  File "/usr/local/Python-2.7/lib/python2.7/compileall.py", line 17, in <module>
    import struct
  File "/usr/local/Python-2.7/lib/python2.7/struct.py", line 1, in <module>
    from _struct import *
ImportError: No module named _struct
make: *** [libinstall] Error 1
msg114205 - (view) Author: Senthil Kumaran (orsenthil) * (Python committer) Date: 2010-08-18 08:19
spprakash, do the following, in your python2.7 checkout (or download):
do 
make distclean
./configure
make
make install

If there is any failure in make/make install of the above steps, please paste that error message and also provide the file system type
(run  df -T)
msg114220 - (view) Author: Dave Malcolm (dmalcolm) (Python committer) Date: 2010-08-18 14:01
(BTW, the versioning seems slightly misleading: "(Red Hat 4.1.0-3)" refers to the version of GCC, not of the operating system.

You appear to be running gcc-4.1.0-3, which I believe was shipped in Fedora Core 5.

Updating "title" metadata of the bug accordingly)
msg122056 - (view) Author: Ari Consul (Ari.Consul) Date: 2010-11-22 01:25
Similar error on make install.  Using Centos 5

/usr/bin/install -c -m 644 ./LICENSE /home/ac927k/local/Python-2.7/lib/python2.7/LICENSE.txt
PYTHONPATH=/home/ac927k/local/Python-2.7/lib/python2.7   \
                ./python -Wi -tt /home/ac927k/local/Python-2.7/lib/python2.7/compileall.py \
                -d /home/ac927k/local/Python-2.7/lib/python2.7 -f \
                -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
                /home/ac927k/local/Python-2.7/lib/python2.7
Traceback (most recent call last):
  File "/home/ac927k/local/Python-2.7/lib/python2.7/compileall.py", line 17, in <module>
    import struct
  File "/home/ac927k/local/Python-2.7/lib/python2.7/struct.py", line 1, in <module>
    from _struct import *
ImportError: No module named _struct
make: *** [libinstall] Error 1


[1]+  Exit 2                  make install >&~/python2.7_make_install.log
[ac927k@limbo Python-2.7]$ clear
[ac927k@limbo Python-2.7]$ df -T
Filesystem    Type   1K-blocks      Used Available Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
              ext3    73608360  11832396  57976516  17% /
/dev/sda1     ext3      101086     26199     69668  28% /boot
tmpfs        tmpfs     1029736         0   1029736   0% /dev/shm
[ac927k@limbo Python-2.7]$ uname -av
Linux limbo.local 2.6.18-194.8.1.el5 #1 SMP Thu Jul 1 19:04:48 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux
[ac927k@limbo Python-2.7]$ cat /etc/redhat-release
CentOS release 5.5 (Final)
[ac927k@limbo Python-2.7]$
msg133763 - (view) Author: sisco (asisco) Date: 2011-04-14 19:21
make install fails on Fedora Core 13 as well:

make distclean
./configure
make
make install

/usr/bin/install -c -m 644 ./LICENSE /usr/local/lib/python2.7/LICENSE.txt
PYTHONPATH=/usr/local/lib/python2.7   \
                ./python -Wi -tt /usr/local/lib/python2.7/compileall.py \
                -d /usr/local/lib/python2.7 -f \
                -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
                /usr/local/lib/python2.7
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/compileall.py", line 17, in <module>
    import struct
  File "/usr/local/lib/python2.7/struct.py", line 1, in <module>
    from _struct import *
ImportError: No module named _struct
make: *** [libinstall] Error 1
[root@freebie Python-2.7.1]# df -T
Filesystem    Type   1K-blocks      Used Available Use% Mounted on
/dev/sda3     ext4    50395844   2899168  46984864   6% /
tmpfs        tmpfs     2020464       864   2019600   1% /dev/shm
/dev/sda1     ext4      396672     29566    346626   8% /boot
/dev/sda2     ext4   898537912 146927532 705967272  18% /db
[root@freebie Python-2.7.1]# uname -av
Linux freebie 2.6.33.3-85.fc13.x86_64 #1 SMP Thu May 6 18:09:49 UTC 2010 x86_64 x86_64 x86_64 GNU/Linux
[root@freebie Python-2.7.1]# cat /etc/fedora-release
Fedora release 13 (Goddard)
msg133913 - (view) Author: Hans Lellelid (hozn) Date: 2011-04-17 00:12
I'm having apparently the same issue when attempting to build an RPM (based on EPEL 2.6.5 SPEC) on CentOS 5.5 i386.

A straight configure/make/make install will work fine, but when editing Modules/Setup.dist to enabled *shared* (and then uncommenting the modules that I want to enable), and passing  --enable-shared to configure, I now get the following error during make-install phase:

PYTHONPATH=/var/tmp/python27-2.7.1-1.wt_el5-root-hans//usr/lib/python2.7  LD_LIBRARY_PATH=/home/hans/rpm/python27/Python-2.7.1: \
                ./python -Wi -tt /var/tmp/python27-2.7.1-1.wt_el5-root-hans//usr/lib/python2.7/compileall.py \
                -d /usr/lib/python2.7 -f \
                -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
                /var/tmp/python27-2.7.1-1.wt_el5-root-hans//usr/lib/python2.7
Traceback (most recent call last):
  File "/var/tmp/python27-2.7.1-1.wt_el5-root-hans//usr/lib/python2.7/compileall.py", line 17, in <module>
    import struct
  File "/var/tmp/python27-2.7.1-1.wt_el5-root-hans/usr/lib/python2.7/struct.py", line 1, in <module>
    from _struct import *
ImportError: No module named _struct

I have cleaned out and rebuilt this many times.  I'm going to continue digging to see if I can figure out how to get the the .so files in the right place (or put the right dir on the path).  I'm also curious what changed from version 2.6 in this regard (and hopefully I'll figure it out with some more work).
msg133918 - (view) Author: Hans Lellelid (hozn) Date: 2011-04-17 03:14
Ok, I think I have tracked down the problem to a change that happened in site.py.  In comparing against a build that worked fine for Python 2.6.5, I noticed that the Modules subdir (which contains the shared .so files) was present on the sys.path for Python 2.6 but not for 2.7.  Digging deeper let me to the site.py module.  In Python 2.7 the behavior was changed so that the Modules path element was removed from sys.path. 

This is probably best explained by the patch I applied to revert to 2.6.x behavior, which fixed the compile problem for me:

--- Python-2.7.1/Lib/site.py    2010-10-12 18:53:51.000000000 -0400
+++ Python-2.7.1/Lib/site.py.addbuilddir-revert 2011-04-16 23:03:47.000000000 -0400
@@ -122,7 +122,7 @@
     s = "build/lib.%s-%.3s" % (get_platform(), sys.version)
     if hasattr(sys, 'gettotalrefcount'):
         s += '-pydebug'
-    s = os.path.join(os.path.dirname(sys.path.pop()), s)
+    s = os.path.join(os.path.dirname(sys.path[-1]), s)
     sys.path.append(s)

Obviously I imagine there was a reason why this change was made, so the above patch is probably not an appropriate universal fix.  I don't know anything about the original reasoning, but this change does seem to work for me on CentOS 5.5 now.

Notably, the issue I'm describing doesn't appear to have anything to do with gcc.  (Incidentally, I'm using gcc-4.1.2-48.el5.)
msg151618 - (view) Author: mike (eraonel) Date: 2012-01-19 13:03
Hi,

I downloaded source and did the following instructions.


We use Red Hat Enterprise Linux Server release 5.5.

./configure --prefix=/home/mike/python_rh_32
make
make install

I also changed the line in site.py

from:
    
s = os.path.join(os.path.dirname(sys.path.pop()), s)

to:

s = os.path.join(os.path.dirname(sys.path[-1]), s)

but I still get:

/usr/bin/install -c -m 644 ./LICENSE /home/mike/python_rh_32/lib/python2.7/LICENSE.txt
PYTHONPATH=/home/mike/python_rh_32/lib/python2.7   \
                ./python -Wi -tt /home/mike/python_rh_32/lib/python2.7/compileall.py \
                -d /home/mike/python_rh_32/lib/python2.7 -f \
                -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
                /home/mike/python_rh_32/lib/python2.7
Traceback (most recent call last):
  File "/home/mike/python_rh_32/lib/python2.7/compileall.py", line 16, in <module>
    import struct
  File "/home/mike/python_rh_32/lib/python2.7/struct.py", line 1, in <module>
    from _struct import *
ImportError: No module named _struct
make: *** [libinstall] Error 1


Did anyone slove this problem?
msg153502 - (view) Author: miro ilias (miro_ilias) Date: 2012-02-16 21:27
Hi, 

with the fresh downloadable version of Python 2.7.2 I got the same error.


/usr/bin/install -c -m 644 ./Lib/curses/wrapper.py /home/ilias/bin/python_static/lib/python2.7/curses
/usr/bin/install -c -m 644 ./Lib/pydoc_data/__init__.py /home/ilias/bin/python_static/lib/python2.7/pydoc_data
/usr/bin/install -c -m 644 ./Lib/pydoc_data/topics.py /home/ilias/bin/python_static/lib/python2.7/pydoc_data
/usr/bin/install -c -m 644 ./Lib/plat-linux3/IN.py /home/ilias/bin/python_static/lib/python2.7/plat-linux3
/usr/bin/install -c ./Lib/plat-linux3/regen /home/ilias/bin/python_static/lib/python2.7/plat-linux3
/usr/bin/install -c -m 644 ./LICENSE /home/ilias/bin/python_static/lib/python2.7/LICENSE.txt
PYTHONPATH=/home/ilias/bin/python_static/lib/python2.7   \
		./python -Wi -tt /home/ilias/bin/python_static/lib/python2.7/compileall.py \
		-d /home/ilias/bin/python_static/lib/python2.7 -f \
		-x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
		/home/ilias/bin/python_static/lib/python2.7
Traceback (most recent call last):
  File "/home/ilias/bin/python_static/lib/python2.7/compileall.py", line 16, in <module>
    import struct
  File "/home/ilias/bin/python_static/lib/python2.7/struct.py", line 1, in <module>
    from _struct import *
ImportError: No module named _struct
make: *** [libinstall] Chyba 1
msg153567 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2012-02-17 16:41
This was changed by Florent for #8205 (“Remove the "Modules" directory from sys.path when Python is running from the build directory (POSIX only)”).
msg154590 - (view) Author: Space Li (spaceli) Date: 2012-02-29 01:49
Hi,

I recently compiled Python 2.7.2 and got an ImportError on struct module during 'make install'. 

What I found working for me is just to 'make'. Before doing 'make install', copy the lib.linux-xxxxx directory in 'build' to {prefix}/lib/python2.7 and rename it as lib-dynload.

Then find something that looks like followings:
        $(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt
        PYTHONPATH=$(DESTDIR)$(LIBDEST)  $(RUNSHARED) \
                ./$(BUILDPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
                -d $(LIBDEST) -f \
                -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
                $(DESTDIR)$(LIBDEST)
        PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
                ./$(BUILDPYTHON) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
                -d $(LIBDEST) -f \
                -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
                $(DESTDIR)$(LIBDEST)
        -PYTHONPATH=$(DESTDIR)$(LIBDEST)  $(RUNSHARED) \
                ./$(BUILDPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \
                -d $(LIBDEST)/site-packages -f \
                -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
        -PYTHONPATH=$(DESTDIR)$(LIBDEST):$(DESTSHARED) $(RUNSHARED) \
                ./$(BUILDPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \
                -d $(LIBDEST)/site-packages -f \
                -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
        -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
                ./$(BUILDPYTHON) -Wi -t -c "import lib2to3.pygram, lib2to3.patcomp;lib2to3.patcomp.PatternCompiler()"

Add :$(DESTSHARED) behind each PYTHONPATH. Then it looks like

        $(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt
        PYTHONPATH=$(DESTDIR)$(LIBDEST):$(DESTSHARED)  $(RUNSHARED) \
                ./$(BUILDPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
                -d $(LIBDEST) -f \
                -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
                $(DESTDIR)$(LIBDEST)
        PYTHONPATH=$(DESTDIR)$(LIBDEST):$(DESTSHARED) $(RUNSHARED) \
                ./$(BUILDPYTHON) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
                -d $(LIBDEST) -f \
                -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
                $(DESTDIR)$(LIBDEST)
        -PYTHONPATH=$(DESTDIR)$(LIBDEST):$(DESTSHARED)  $(RUNSHARED) \
                ./$(BUILDPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \
                -d $(LIBDEST)/site-packages -f \
                -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
        -PYTHONPATH=$(DESTDIR)$(LIBDEST):$(DESTSHARED) $(RUNSHARED) \
                ./$(BUILDPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \
                -d $(LIBDEST)/site-packages -f \
                -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
        -PYTHONPATH=$(DESTDIR)$(LIBDEST):$(DESTSHARED) $(RUNSHARED) \
                ./$(BUILDPYTHON) -Wi -t -c "import lib2to3.pygram, lib2to3.patcomp;lib2to3.patcomp.PatternCompiler()"

After doing so, you can 'make install'.

This is tested on OpenSUSE 10.3 with GCC 4.2.1.
msg156273 - (view) Author: miro ilias (miro_ilias) Date: 2012-03-18 20:31
Dear Space, 

On my Ubuntu 11.10 x86_64 Linux I have static python buildup prescription:
./configure LDFLAGS="-static -static-libgcc"  --disable-shared   CPPFLAGS=-static --prefix=/home/ilias/bin/python_static

with *static* in Modules/Setup

but 'make' failes, getting errors like:

collect2: ld returned 1 exit status
/usr/bin/ld: error: /usr/lib/gcc/x86_64-linux-gnu/4.6.1/crtbeginT.o: requires dynamic R_X86_64_32 reloc against '__DTOR_END__' which may overflow at runtime; recompile with -fPIC
collect2: ld returned 1 exit status
/usr/bin/ld: error: /usr/lib/gcc/x86_64-linux-gnu/4.6.1/crtbeginT.o: requires dynamic R_X86_64_32 reloc against '__DTOR_END__' which may overflow at runtime; recompile with -fPIC
collect2: ld returned 1 exit status
.
.
.
/home/ilias/bin/python_static/Python-2.7.2/Modules/_ctypes/libffi/src/dlmalloc.c: In function ‘mmap_resize’:
/home/ilias/bin/python_static/Python-2.7.2/Modules/_ctypes/libffi/src/dlmalloc.c:3193:5: warning: implicit declaration of function ‘mremap’ [-Wimplicit-function-declaration]
/home/ilias/bin/python_static/Python-2.7.2/Modules/_ctypes/libffi/src/dlmalloc.c:3193:16: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
/home/ilias/bin/python_static/Python-2.7.2/Modules/_ctypes/libffi/src/dlmalloc.c: In function ‘sys_trim’:
/home/ilias/bin/python_static/Python-2.7.2/Modules/_ctypes/libffi/src/dlmalloc.c:3612:62: warning: comparison between pointer and integer [enabled by default]
/usr/bin/ld: error: /usr/lib/gcc/x86_64-linux-gnu/4.6.1/crtbeginT.o: requires dynamic R_X86_64_32 reloc against '__DTOR_END__' which may overflow at runtime; recompile with -fPIC
collect2: ld returned 1 exit status

Python build finished, but the necessary bits to build these modules were not found:
_bsddb             _curses            _curses_panel   
_sqlite3           _ssl               _tkinter        
bsddb185           bz2                dbm             
dl                 gdbm               imageop         
linuxaudiodev      ossaudiodev        readline        
sunaudiodev        zlib                               
To find the necessary bits, look in setup.py in detect_modules() for the module's name.

Failed to build these modules:
_bisect            _codecs_cn         _codecs_hk      
_codecs_iso2022    _codecs_jp         _codecs_kr      
_codecs_tw         _collections       _csv            
_ctypes            _ctypes_test       _elementtree    
_functools         _heapq             _hotshot        
_io                _json              _locale         
_lsprof            _md5               _multibytecodec 
_multiprocessing   _random            _sha            
_sha256            _sha512            _socket         
_struct            _testcapi          array           
audioop            binascii           cmath           
cPickle            crypt              cStringIO       
datetime           fcntl              future_builtins 
grp                itertools          math            
mmap               nis                operator        
parser             pyexpat            resource        
select             spwd               strop           
syslog             termios            time            
unicodedata                         

Any help, please ?

________________________________________
From: Space Li [report@bugs.python.org]
Sent: Wednesday, February 29, 2012 2:49 AM
To: Ilias Miroslav
Subject: [issue9631] Python 2.7 installation issue for Linux gcc-4.1.0-3        (Fedora Core 5?)

Space Li <spacelis@gmail.com> added the comment:

Hi,

I recently compiled Python 2.7.2 and got an ImportError on struct module during 'make install'.

What I found working for me is just to 'make'. Before doing 'make install', copy the lib.linux-xxxxx directory in 'build' to {prefix}/lib/python2.7 and rename it as lib-dynload.

Then find something that looks like followings:
        $(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt
        PYTHONPATH=$(DESTDIR)$(LIBDEST)  $(RUNSHARED) \
                ./$(BUILDPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
                -d $(LIBDEST) -f \
                -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
                $(DESTDIR)$(LIBDEST)
        PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
                ./$(BUILDPYTHON) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
                -d $(LIBDEST) -f \
                -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
                $(DESTDIR)$(LIBDEST)
        -PYTHONPATH=$(DESTDIR)$(LIBDEST)  $(RUNSHARED) \
                ./$(BUILDPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \
                -d $(LIBDEST)/site-packages -f \
                -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
        -PYTHONPATH=$(DESTDIR)$(LIBDEST):$(DESTSHARED) $(RUNSHARED) \
                ./$(BUILDPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \
                -d $(LIBDEST)/site-packages -f \
                -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
        -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
                ./$(BUILDPYTHON) -Wi -t -c "import lib2to3.pygram, lib2to3.patcomp;lib2to3.patcomp.PatternCompiler()"

Add :$(DESTSHARED) behind each PYTHONPATH. Then it looks like

        $(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt
        PYTHONPATH=$(DESTDIR)$(LIBDEST):$(DESTSHARED)  $(RUNSHARED) \
                ./$(BUILDPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
                -d $(LIBDEST) -f \
                -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
                $(DESTDIR)$(LIBDEST)
        PYTHONPATH=$(DESTDIR)$(LIBDEST):$(DESTSHARED) $(RUNSHARED) \
                ./$(BUILDPYTHON) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
                -d $(LIBDEST) -f \
                -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
                $(DESTDIR)$(LIBDEST)
        -PYTHONPATH=$(DESTDIR)$(LIBDEST):$(DESTSHARED)  $(RUNSHARED) \
                ./$(BUILDPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \
                -d $(LIBDEST)/site-packages -f \
                -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
        -PYTHONPATH=$(DESTDIR)$(LIBDEST):$(DESTSHARED) $(RUNSHARED) \
                ./$(BUILDPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \
                -d $(LIBDEST)/site-packages -f \
                -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
        -PYTHONPATH=$(DESTDIR)$(LIBDEST):$(DESTSHARED) $(RUNSHARED) \
                ./$(BUILDPYTHON) -Wi -t -c "import lib2to3.pygram, lib2to3.patcomp;lib2to3.patcomp.PatternCompiler()"

After doing so, you can 'make install'.

This is tested on OpenSUSE 10.3 with GCC 4.2.1.

----------
nosy: +spaceli

_______________________________________
Python tracker <report@bugs.python.org>
<http://bugs.python.org/issue9631>
_______________________________________
msg161300 - (view) Author: Richard West (Richard.West) Date: 2012-05-21 22:11
I also had an ImportError on _struct module during 'make install' when building 2.7.3 from source configured with --enable-shared. My solution, which *seems* to have worked, is simple:

   $ make -i install
   $ make install

My guess is that the part of the 'make install' that copies _struct.so into the correct place occurs AFTER a part of the 'make install' that tries to use it. If you tell make to ignore errors and carry on (-i), it then completes the installation, copies _struct.so (and everything else) into their correct places, and you can then do another make install without any errors!

I hope this helps someone track down a sensible fix, and in the mean-time provides a work-around for the rest of us.
(p.s. remember your PYTHONHOME and PYTHON_PATH should be clear before making)
msg161305 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2012-05-21 23:08
I believe too many issues are getting confused here. Even though the symptom appears to be the same (a complaint about _struct not being importable), the causes might be completely different, as all kinds of different configure options, compilers, and Linux distributions are being used.

So I'm closing this issue now. If anybody is still having the issue, please resubmit a new bug report. Do not follow-up to this message asking that the issue be reopened.
History
Date User Action Args
2022-04-11 14:57:05adminsetgithub: 53840
2012-05-21 23:08:40loewissetstatus: open -> closed

messages: + msg161305
2012-05-21 22:11:12Richard.Westsetnosy: + Richard.West
messages: + msg161300
2012-03-18 20:31:42miro_iliassetmessages: + msg156273
2012-02-29 01:49:19spacelisetnosy: + spaceli
messages: + msg154590
2012-02-17 16:41:25eric.araujosetnosy: + flox, eric.araujo
messages: + msg153567
2012-02-16 21:27:13miro_iliassetnosy: + miro_ilias
messages: + msg153502
2012-01-19 13:03:18eraonelsetnosy: + eraonel
messages: + msg151618
2011-04-17 03:14:44hoznsetmessages: + msg133918
2011-04-17 00:12:03hoznsetnosy: + hozn
messages: + msg133913
2011-04-14 19:21:50asiscosetnosy: + asisco
messages: + msg133763
2010-11-22 01:25:51Ari.Consulsetnosy: + Ari.Consul
messages: + msg122056
2010-08-18 14:01:10dmalcolmsetnosy: + dmalcolm

messages: + msg114220
title: Python 2.7 installation issue for Linux Red Hat 4.1 -> Python 2.7 installation issue for Linux gcc-4.1.0-3 (Fedora Core 5?)
2010-08-18 08:19:42orsenthilsetnosy: + orsenthil
messages: + msg114205
2010-08-18 07:40:12spprakashsetmessages: + msg114203
2010-08-18 06:29:15loewissetmessages: + msg114202
2010-08-18 06:05:34spprakashsetstatus: closed -> open

messages: + msg114199
2010-08-18 05:55:12loewissetstatus: open -> closed

nosy: + loewis
messages: + msg114197

resolution: not a bug
2010-08-18 05:23:29spprakashsettype: compile error
2010-08-18 05:22:32spprakashcreate