Building Python3 on a redhat 5 machine - linux

I am trying to build Python3 on a RHEL 5.7 machine, I successful managed to build Python 3.2.2, with :
# Install required build dependencies
yum install openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel
# Fetch and extract source. Please refer to http://www.python.org/download/releases
# to ensure the latest source is used.
wget http://www.python.org/ftp/python/3.2/Python-3.2.tar.bz2
tar -xjf Python-3.2.tar.bz2
cd Python-3.2
# Configure the build with a prefix (install dir) of /opt/python3, compile, and install.
./configure --prefix=/opt/python3
make
But I am failing (?) with Python 3.2.3:
Failed to build these modules:
_posixsubprocess
Is this a problem that should bother me ? How do I build it?
I found this patch, but it's not included in sources Python 3.2.3 I obtained from the website ...
Applying this patch on my sources, didn't solve the problem ...

Well, I already answered my own question in serverfault.com: building python 3.2.2 on a Red Hat 5 machine
You need to apply the patch found here.
And then you can successfully build Python 3.

Related

How to install older gcc package using APT from a repository?

I have GCC v9. But I'm trying to install a GCC 4.8.1 version to test a library compilation on that very old version of GCC.
The version is not available in the official Ubuntu repos,it is deprecated, but I've found it in other mirrors as told by the official GCC website. This one seems like popular one:
https://launchpad.net/~ubuntu-toolchain-r/+archive/ubuntu/test
I have very little knowledge of linux package systems except for the basic. I want to keep both versions. So I should do this:
sudo apt -y install gcc-4.8.1 gcc-9
The reason why I want to use this command and not install it from the file, apart from the difficulty of doing that for me, is that I'm following a guide in order to have several GCCs on my system:
https://www.fosslinux.com/39386/how-to-install-multiple-versions-of-gcc-and-g-on-ubuntu-20-04.htm
When I add the url to the sources.list file seems like it is working.
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt update -q
But when I try to call the install with gcc-4.8.1 or gcc-4.8 , or even gcc-4 the package doesn't exist.
Package gcc-4.8 is not available, but is referred to by another
package. This may mean that the package is missing, has been
obsoleted, or is only available from another source E: Package
'gcc-4.8' has no installation candidate
Also, I don't know if websites like these can be added to the repos list in order to find the package using APT:
http://www.netgull.com/gcc/releases/gcc-4.8.1/
[EDIT]
I downloaded the package from the website I linked. I have no idea how to install this by hand. If only I could find a repository that could help me with this... I have no idea how to make APT help me with the installation.
But I'm trying to install a GCC 4.8.1 version to test a library compilation on that very old version of GCC.
Developers have tools up their sleeve so they don't have to install dependencies and bloating their systems for every library (and every configuration of that library!) they want to try out and test.
Use docker. You could write for example a testing script, assuming your project uses make:
# test_my_lib_in_gcc-4.8.sh
#!/bin/sh
docker run -ti --rm -v $PWD:/project -w /project gcc:4.8 -u $UID:$GID sh <<EOF
make && make test
EOF
that will compile and test your application in using 4.8 gcc. Consider how easy it is to change gcc version - just change the number. You could test your library in gcc, in different versions, and using other compilers and on different distributions to make sure it works for others. If you're a developer of the library, write an automatized CI pipeline that would automatically test your application each commit in specific docker environment, using ex. https://docs.gitlab.com/ee/ci/README.html or https://travis-ci.org/ .

How to install python3-devel on red hat 7

I am trying to install something in my virtual environment, which uses anaconda python 3.6. I get the gcc failed with exit status 1, hinting on the absence of the right python3-devel package, as described in error: command 'gcc' failed with exit status 1 while installing eventlet.
To fix the error, I tried to install the python3-devel package on my server running RHEL 7.3.
I did yum install python3-devel, but got a 'package not found' error. Then I found https://serverfault.com/questions/710354/repository-for-python3-devel-on-centos-7, which hints to the python34-devel package in the EPEL repository. I installed it using yum, but upon trying to install something in my virtual environment, I still get the gcc failed with exit status 1 error.
Does someone know how I can fix this? All help would be much apprechiated.
Search for the package in yum , use the following command:
yum search python3 | grep devel
It will list all the available devel packages. The result will be somewhat like this
python3-cairo-devel.x86_64 : Libraries and headers for python3-cairo
python3-devel.x86_64 : Libraries and header files needed for Python 3
: development
python34-devel.x86_64 : Libraries and header files needed for Python 3
: development
Then you can choose the package you want to install from the list , suppose if you want to to install python3-devel , execute the following
yum install -y python3-devel.x86_64
I thought I might update this for 2020. As of RHEL 7.7, python-devel is not available in EPEL, it has been retired by Fedora Project. All I wanted for today was the python h files, and this got me there:
# yum install python3-devel.x86_64 --enablerepo=rhel-7-server-optional-rpms
We do have one of the Redhat No-Cost Developer licenses, but I am not sure that is required for the optional-rpms.
PS, this was helpful in verifying which packages of interest were in optional-rpms
# yum repo-pkgs rhel-7-server-optional-rpms list | grep python3
There are no python3-* packages from Red Hat in Red Hat Enterprise Linux 6 or 7.
However there are python3-* packages available if you enable third party repos like EPEL or IUS. But, these are not supported by Red Hat. Chances are if you are running RHEL, your organization has a preference for supported packages.
You can get supported Python 3 packages from Red Hat via Red Hat Software Collections (RHSCL). Currently Python 3.6 is the newest available, the package name is rh-python36. Installing the RHSCL package will also install rh-python36-devel and a number of other packages.
See How to install Python 3, pip, venv, virtualenv, and pipenv on RHEL
Don't forget to install #development first, so you have gcc, make, etc. for building any dynamically loaded shared objects.
To install:
$ su -
# subscription-manager repos --enable rhel-7-server-optional-rpms \
--enable rhel-server-rhscl-7-rpms
# yum -y install #development
# yum -y install rh-python36
# yum -y install rh-python36-numpy \
rh-python36-scipy \
rh-python36-python-tools \
rh-python36-python-six
# exit
The blog linked above has lots of tips for working with Python, virtual environments, as well as software collections on Red Hat.

Compiling Cairo-dock errors on GTK dependency

I've Redhat 7.2 running Cinnamon, and hate the docks provided, how come I can't resize the area a widgit is allocated? All apps are jammed into half the dock.
Drives me to compile cairo-dock from source as it isn't an ibm redhat blessed package.
cmake .. -DCMAKE_INSTALL_PREFIX=/usr
...
-- checking for module 'wayland-client>=1.0.0'
-- package 'wayland-client>=1.0.0' not found
-- checking for module 'gtk+-3.0>=3.4.0'
-- package 'gtk+-3.0>=3.4.0' not found
so I find gtk version is 3.14.13-16.el7 using yum list installed "gtk*"
I downloaded gtk 3.4.4 and compiled it and follow the INSTALL provided, sudo make install, which completes with no errors
rerunning cmake gives me the same error, so I'm wondering if I had to remove 3.14? I'm not really sure how best to proceed and thought it best to get some advice. I'm not really in the mood to break things. Thanks for your time and consideration.
Calvin, I'm also IBMer and installed RHEL7.2 from IBM's image.
I could successfully download the sources and install Cairo Docker and respective plugins.
I followed the instructions in this page here:
Glx-Dock - Generic:Compilation
First, install all dependencies below from official IBM repository.
I used the same package names for the Fedora dependencies and some may NOT exist for RHEL. Therefore, some plugins won't be available by fetching dependencies from official repository only - but the Cairo Docker will work.
sudo yum install cmake make pkgconfig gcc gcc-c++ gettext glib2-devel\
cairo-devel librsvg2-devel dbus-glib-devel libxml2-devel libXrender-devel\
mesa-libGL-devel mesa-libGLU-devel pango-devel libXxf86vm-devel\
libXtst-devel libXrandr-devel libX11-devel libcurl-devel gtk3-devel\
vte3-devel lm_sensors-devel libxklavier-devel libexif-devel\
libetpan-devel gnome-menus-devel alsa-lib-devel libical-devel\
upower-devel libzeitgeist-devel
Untar the packages and build with the commands described there except that you need to force the lib64 in both main and plugin builds with:
cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DFORCE_LIB64=yes

package python to be installed to custom location

My objective is to build a python rpm that can install to custom location on rhel 6 box.
I have take source from https://dl.iuscommunity.org/pub/ius/stable/Redhat/6/SRPMS/python34u-3.4.3-2.ius.el6.src.rpm
rpmbuild with prefix of /tmp/python/new_install succeeded in packaging.
When I try to install rpm, I am encountering circular dependency.
Install of ABCpython34u-3.4.3-2.ius.el6.x86_64.rpm gives
error: Failed dependencies:
ABCpython34u-libs(x86-64) = 3.4.3-2.ius.el6 is needed by ABCpython34u-3.4.3-2.ius.el6.x86_64
libpython3.4m.so.1.0()(64bit) is needed by ABCpython34u-3.4.3-2.ius.el6.x86_64
Install of ABCpython34u-libs-3.4.3-2.ius.el6.x86_64.rpm gives
error: Failed dependencies:
/tmp/python/new_install/bin/python3.4 is needed by ABCpython34u-libs-3.4.3-2.ius.el6.x86_64
Any guidance is much appreciated.
Update:
/bin/rpm -i --noscripts -v ABCpython34u-libs-3.4.3-2.ius.el6.x86_64.rpm ABCpython34u-3.4.3-2.ius.el6.x86_64.rpm 2>&1
error: Failed dependencies:
libpython3.4m.so.1.0()(64bit) is needed by ABCpython34u-3.4.3-2.ius.el6.x86_64
$ rpm -q --provides -p ABCpython34u-libs-3.4.3-2.ius.el6.x86_64.rpm|grep libpython3.4m.so.1.0
libpython3.4m.so.1.0()(64bit)(ABC)
You just need to install them together:
yum install ./ABCpython34u-3.4.3-2.ius.el6.x86_64.rpm ./ABCpython34u-libs-3.4.3-2.ius.el6.x86_64.rpm
But what you are doing (python in custom location) is very likely wrong. If you want to have recent python on RHEL6 box you very likely want Software Collection:
https://www.softwarecollections.org/en/
https://www.softwarecollections.org/en/scls/rhscl/rh-python34/

How do I install protobuf 2.5 on Arch Linux for compiling hadoop 2.6.0 using maven 3.3.1?

Am looking for installing protobuf 2.5.0 on Arch Linux, so that protoc-2.5.0.so is installed on the OS, so that I can go ahead with building hadoop 2.6.0 from source and make my life easy! :)
BTW, protobuf 2.6.0 does not compile when hadoop is built from source I have tried that as well. Ubuntu 14.04 comes with protoc 2.5.0. I DO NOT want to use Ubuntu.
Please check the screenshot first (there is no protobuf 2.5.0), since the problem lies there.. I guess
am getting the following exception, I am aware that protoc is not installed in arch linux currently.
[ERROR] Failed to execute goal
org.apache.hadoop:hadoop-maven-plugins:2.6.0:protoc (compile-protoc)
on project hadoop-common:
org.apache.maven.plugin.MojoExecutionException: 'protoc --version' did
not return a version -> [Help 1]
Please help me out, since, I have spent 4 hours every day from two days, with no luck.
Compiling Google's protobuf is pretty easy.
I originally found out how to do it on this blog post while compiling hadoop myself.
But here is my version:
$ cd /usr/local/src/
$ wget https://github.com/google/protobuf/releases/download/v2.5.0/protobuf-2.5.0.tar.gz
$ tar xvf protobuf-2.5.0.tar.gz
$ cd protobuf-2.5.0
$ ./autogen.sh
$ ./configure --prefix=/usr
$ make
$ make install
$ protoc --version
Install protobuf for java
$ cd java
$ mvn install
$ mvn package
You should be good to go.
To enable you to install different versions of protobuf, install stow
then change ./configure --prefix=/usr to ./configure --prefix=/usr/local/stow/protobuf-2.5.0
Then link protobuf into your system with stow:
$ cd /usr/local/stow
$ stow protobuf-2.5.0
Note: stow uses /usr/local/bin by default. Make sure thats in your $PATH
To unlink that version of protobuf,
$ stow -D protobuf-2.5.0
Hope this helped.
I wonder why the above answer got downvoted,even I had to perform few more steps (in addition to the accepted answer by Rudker) to get protobuf 2.5 installed on Ubuntu Xenial.
Leaving the additional steps here for everyone's benefit:
apt-get install autoconf in response to the error : ./autogen.sh: autoreconf: not found for command : ./autogen.sh
apt-get install libtool in response to the error : autoreconf: libtoolize is needed because this package uses Libtool for command : ./autogen.sh
apt install g++ in response to the error : configure: error: C++ preprocessor "/lib/cpp" fails sanity check for command : ./configure --prefix=/usr
An easier but not future proof solution (for future queries) would be to head over to Arch Linux Archives: http://seblu.net/a/archive/packages/p/protobuf/
Uninstall the newer version of protobuf and install the downloaded package via pacman -U protobuf-2.5.x..
Though whenever you upgrade the Arch Linux packages via pacman you'd need to ensure you are doing: sudo pacman -Syu --ignore protobuf
I currently don't have enough reputation to comment, so I add a answer here to update the top voted answer.
Since protobuf move to different repo, the new wget command should be:
wget https://github.com/protocolbuffers/protobuf/releases/download/v2.5.0/protobuf-2.5.0.tar.gz
And in order to run ./autogen.sh, you may need install these:
sudo yum install libtool automake autoconf
For OSX prerequisites, try SunitaKoppar's answer (I don't know why the down-votes).
Thanks for the steps. Just wanted to add that, to get autogen.sh to work, I had to install the below packages (commands for mac below):
brew install gtk
brew install autoconf
brew install automake

Resources