LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > CentOS
User Name
Password
CentOS This forum is for the discussion of CentOS Linux. Note: This forum does not have any official participation.

Notices


Reply
  Search this Thread
Old 11-30-2022, 10:21 AM   #1
Shaggy1
Member
 
Registered: Oct 2010
Posts: 96

Rep: Reputation: 3
Build python 3.11 from source on centos 7


Hi

System Info:
Code:
$ cat /etc/centos-release
CentOS Linux release 7.6.1810 (Core)

$ gcc --version
gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-36)

$ openssl version
OpenSSL 1.0.2k-fips  26 Jan 2017

I am attempting to build python 3.11 on a centos 7 system.
When I try to configure using this command:
Code:
$ ./configure --prefix=/local/usr/local/python3 --enable-shared --with-ensurepip=install --enable-optimizations
and then try to make I get the following error:
Code:
Python runtime state: initialized
Traceback (most recent call last):
  File "/local/usr/local/src/python/Python-3.11.0/Lib/site.py", line 73, in <module>
    import os
  File "/local/usr/local/src/python/Python-3.11.0/Lib/os.py", line 29, in <module>
    from _collections_abc import _check_methods
SystemError: <built-in function compile> returned NULL without setting an exception
make[1]: *** [Python/frozen_modules/abc.h] Error 1
make[1]: Leaving directory `/local/usr/local/src/python/Python-3.11.0'
make: *** [profile-opt] Error 2
I think I am hitting the issue described here:
https://github.com/python/cpython/issues/94825

Which suggests I need a more up to date gcc version.
Does anyone know which gcc version works for building this with optimization ? Or know where I can find out ?

When it does build successfully (as mentioned in the link if I repeat it enough it eventually goes through and also if I turn off optimizations) I get the following message at the end:
Quote:
The necessary bits to build these optional modules were not found:
_hashlib _ssl _tkinter
I do need the _ssl module - does anyone know how I can find out what I need to allow it to build ? Possibly I need a newer openssl version ?

Ooops sorry I missed this message at the end:
Could not build the ssl module!
Python requires a OpenSSL 1.1.1 or newer

That explains the ssl issue. Anyone know if it is possible to install openssl 1.1.1 on centos 7 from a repository ? Or do I have to build a local version ?

Last edited by Shaggy1; 11-30-2022 at 10:37 AM. Reason: Adding some information I previously missed
 
Old 12-01-2022, 01:23 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 19,558

Rep: Reputation: 6623Reputation: 6623Reputation: 6623Reputation: 6623Reputation: 6623Reputation: 6623Reputation: 6623Reputation: 6623Reputation: 6623Reputation: 6623Reputation: 6623
You need to use gcc 11 or something similar (probably gcc 7 would be ok too). 4.8.5 is at about (or more than) 10 years old and does not support newer c++ standards.
 
Old 12-01-2022, 08:06 AM   #3
boughtonp
Senior Member
 
Registered: Feb 2007
Location: UK
Distribution: Debian
Posts: 3,069

Rep: Reputation: 2166Reputation: 2166Reputation: 2166Reputation: 2166Reputation: 2166Reputation: 2166Reputation: 2166Reputation: 2166Reputation: 2166Reputation: 2166Reputation: 2166

The current version of CentOS 7 is 7.9.2009 - why are you still on 7.6 yet trying to build Python 3.11 - which was released less than six weeks ago?

 
Old 12-01-2022, 09:18 AM   #4
Shaggy1
Member
 
Registered: Oct 2010
Posts: 96

Original Poster
Rep: Reputation: 3
> The current version of CentOS 7 is 7.9.2009 - why are you still on 7.6 ...
Unfortunately my hands are tied on this, it's a standard install for our lab machines, however

> ... yet trying to build Python 3.11
Indeed it does not need to be 3.11, I wound back to 3.8 and that build fine

Thank you for your help

Just in a general sense do you know if there is a way of getting hold of what version of tools is required for each version ?
 
Old 12-01-2022, 09:43 AM   #5
boughtonp
Senior Member
 
Registered: Feb 2007
Location: UK
Distribution: Debian
Posts: 3,069

Rep: Reputation: 2166Reputation: 2166Reputation: 2166Reputation: 2166Reputation: 2166Reputation: 2166Reputation: 2166Reputation: 2166Reputation: 2166Reputation: 2166Reputation: 2166
Quote:
Originally Posted by Shaggy1 View Post
Indeed it does not need to be 3.11, I wound back to 3.8 and that build fine
That's good then - Python 3.8 is supported until October 2024, which is later than the EOL for CentOS - so most software should run on it until then.

(You may want to check whoever controls the OS of your lab machine is aware of AlmaLinux and Rocky Linux.)


Quote:
Just in a general sense do you know if there is a way of getting hold of what version of tools is required for each version ?
I've never built Python from source but, speaking generally, when it's not part of core repos there's usually something good enough in EPEL.

I think there was one instance when I needed a specific version of either ImageMagick or GraphicsMagick and had to build it from source, but I can't remember the details.

 
  


Reply

Tags
centos 7, python311


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Linux 4.4 seems to refuse to build IPv6 for the 64-bit build - 32-bit build works fine GameCodingNinja Linux From Scratch 2 02-07-2016 07:40 PM
I got error while installing python-tk python-psycopg2 python-twisted saili kadam Linux - Newbie 1 09-05-2015 04:03 AM
Manual Python build cannot beat Ubuntu build??? taihd Ubuntu 0 12-26-2013 08:28 PM
LXer: Python Python Python (aka Python 3) LXer Syndicated Linux News 0 08-05-2009 09:30 PM
LXer: Build 'em Right, Build 'em Strong, Build 'em Linux LXer Syndicated Linux News 0 10-01-2007 10:51 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > CentOS

All times are GMT -5. The time now is 09:50 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration