Installing python 3.8.0 as a module on CentOS 7

I get the package from here. Unzip it on my test folder, move it to my software folder called /net/ here, and do as suggested on tecmint. I add to the commands in blue a little output with comments to understand it better.

# tar xJf Python-3.6.3.tar.xz
# cd Python-3.6.3
# ./configure
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
... a lot of checks here ...
configure: creating ./config.status
config.status: creating Makefile.pre
config.status: creating Misc/python.pc
config.status: creating Misc/python-embed.pc
config.status: creating Misc/python-config.sh
config.status: creating Modules/ld_so_aix
config.status: creating pyconfig.h
creating Modules/Setup.local
creating Makefile
If you want a release build with all stable 
optimizations active (PGO, etc),
please run ./configure --enable-optimizations
# make
gcc -pthread -c -Wno-unused-result -Wsign-compare 
-DNDEBUG -g -fwrapv -O3 -Wall -std=c99 -Wextra 
-Wno-unused-result -Wno-unused-parameter 
-Wno-missing-field-initializers 
-Werror=implicit-function-declaration 
-I./Include/internal -I. -I./Include -DPy_BUILD_CORE 
-o Programs/python.o ./Programs/python.c
... and a lot of lines like the one above...
gcc -pthread -Xlinker -export-dynamic 
-o Programs/_testembed Programs/_testembed.o libpython3.8.a 
-lcrypt -lpthread -ldl -lutil -lm -lm 
sed -e "s,@EXENAME@,/usr/local/bin/python3.8," < 
./Misc/python-config.in >python-config.py
LC_ALL=C sed -e 's,\$(\([A-Za-z0-9_]*\)),\$\{\1\},g' 
< Misc/python-config.sh >python-config
# make install
Collecting setuptools
Collecting pip
Installing collected packages: setuptools, pip
Successfully installed pip-19.2.3 setuptools-41.2.0

End of the dump. I have compiled it on /net/python-3.8.0/ without any further configuration options. After make install, I still don’t have the new python by default, but I’m able to run it:

root@test ~ ## > /net/python-3.8.0/python 
Python 3.8.0 (default, Nov 7 2019, 16:17:32) 
[GCC 4.9.2] on linux
Type "help", "copyright", "credits" or "license" 
for more information.
>>> exit()

Let’s make a module for it:

#%Module1.0##############################
## modules python-3.8.0
## modulefiles/python-3.8.0 . Python 3.8.0 module
##
proc ModulesHelp { } {
   global version modroot
   puts stderr "setenv python3.8.0"
}
module-whatis "Sets the environment for python-3.5.3"
# for Tcl script use only
set topdir /net/python-3.8.0
set version 3.8.0
set sys linux86
setenv PYTHON_V "3.8.0"
prepend-path PATH $topdir

Now I can do module load python-3.8.0 and I will have my brand new python. Next step: install the requested “modern” python code. The output, maybe tomorrow 🙂

EDIT: Althought it’s a functional python 3.8.0 prompt, it lacks conda. Trying to install JANNI  with conda, the next message is displayed:

conda create -n janni -c anaconda python=3.6 cudnn=7.1.2 
libtiff wxPython=4.0.4
ERROR: The install method you used for conda--probably 
either `pip install conda` or `easy_install conda`
--is not compatible with using conda as an application.
If your intention is to install conda as a standalone 
application, currently supported install methods 
include the Anaconda installer 
and the miniconda installer. 
You can download the miniconda installer from
https://conda.io/miniconda.html.

So back to square zero 😦

1 thought on “Installing python 3.8.0 as a module on CentOS 7

  1. Pingback: Installing JANNI as a python environment | Bits and Dragons

Leave a comment