python - Python2.7 yum module
2014-04
I have a virtual machine running centos 5.8 and I just installed python2.7 because I was having some issues with import simplejson as json
. After installing python2.7 and running ansible roles I have the follwing error:
failed: [default] => (item=httpd,httpd-devel) => {"failed": true, "item": "httpd,httpd-devel", "parsed": false}
invalid output was: SUDO-SUCCESS-jexgalzfpawatwlwldjlitpbyuyelqew
Traceback (most recent call last):
File "/home/vagrant/.ansible/tmp/ansible-1391226441.99-18554377653196/yum", line 26, in <module>
import yum
ImportError: No module named yum
I searched all over the place for yum python module but I could not find it.
Can someone help me somehow?
I found an alternative solution to installing python2.7 yum module that fixes my initial error with import simplejosn as json
. The solution was to include a shell provision before the ansible one with the following script that installs an older version of simplejson (compatible) with python2.4 (available on Centos 5.8):
#!/bin/sh
yum -y install wget
wget --no-check-certificate http://pypi.python.org/packages/source/s/simplejson/simplejson-2.0.9.tar.gz#md5=af5e67a39ca3408563411d357e6d5e47
tar xzvf simplejson-2.0.9.tar.gz
cd simplejson-2.0.9
sudo python setup.py install
I am trying to install Altera's Quartus 10 web edition 32 bit
(but I think only the 32bit part is relevant to my problem) on Fedora 14 (x86_64bit), which runs inside a VM.
When I run the installer:
./altera_installer_cmd --install=quartus_free (...and some more options)
I get the following error:
Traceback (most recent call last):
File "<string>", line 18, in <module>
File "/tools/python/2.6.4/linux32/pyinstaller/iu.py",
line 436, in importHook
File "/tools/python/2.6.4/linux32/pyinstaller/iu.py",
line 521, in doimport
File "linux32/build/pyi.linux2/quartus_dl/outPYZ1.pyz/hashlib",
line 136, in <module>
File "linux32/build/pyi.linux2/quartus_dl/outPYZ1.pyz/hashlib",
line 63, in __get_builtin_constructor
File "/tools/python/2.6.4/linux32/pyinstaller/iu.py",
line 455, in importHook ImportError:
No module named _md5
I have no idea where those files are located, because it seems like the path /tools
doesn't exist.
And it seems like, that the installer wants to use python 2.6.4
while my regular installation uses python 2.7
$python --version
Python 2.7
Does anybody have an idea how to fix this?
Edit 1: (edited out a part for brevity)
The installer is unfortunately a binary file:
$ file altera_installer_cmd
altera_installer_cmd: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.2.5, not stripped
$ ldd altera_installer_cmd
linux-gate.so.1 => (0x00424000)
libpthread.so.0 => /lib/libpthread.so.0 (0x00990000)
libdl.so.2 => /lib/libdl.so.2 (0x007c7000)
libutil.so.1 => /lib/libutil.so.1 (0x00fc0000)
libm.so.6 => /lib/libm.so.6 (0x006bf000)
libz.so.1 => /lib/libz.so.1 (0x0069f000)
libc.so.6 => /lib/libc.so.6 (0x4b653000)
/lib/ld-linux.so.2 (0x4b62f000)
Here is a list of all the files and folders inside the directory of the installer. As you can see, there is no folder /tools
. But there is a file _hashlib.so
(line 27).
Edit 2:
I reinstalled python and after that imported hashlib
without a problem:
# python
Python 2.7 (r27:82500, Sep 16 2010, 18:02:00)
[GCC 4.5.1 20100907 (Red Hat 4.5.1-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import hashlib
>>> exit()
after that I ran the altera_installer_cmd
as described above with the same error. If I now run the python and import hashlib
I get again the error
$ python
Python 2.7 (r27:82500, Sep 16 2010, 18:02:00)
[GCC 4.5.1 20100907 (Red Hat 4.5.1-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import hashlib
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib64/python2.7/hashlib.py", line 136, in <module>
globals()[__func_name] = __get_hash(__func_name)
File "/usr/lib64/python2.7/hashlib.py", line 74, in __get_builtin_constructor
import _sha256
ImportError: ./_sha256.so: wrong ELF class: ELFCLASS32
>>>