4

I am trying to install Python3.8 on Ubuntu 14.04, I get this error:

E: Unable to locate package python3.8 E: Couldn't find any package by regex 'python3.8'

Is it even possible to have python3.8 on Ubuntu that is that old? If it is possible, please tell me how.

EDIT

When installing from source ( I followed that instruction) I get this error:

Fatal Python error: _PySys_InitCore: can't initialize sys module Python runtime state: preinitialized

Current thread 0x00002ab78e1b3740 (most recent call first): generate-posix-vars failed make: *** [pybuilddir.txt] Error 1

3 Answers 3

4

An alternative solution could be to compile python statically on a newer system. Then such binaries can be transferred to the target system.

Compilation tested on vanilla Ubuntu 20.04 LTS

$ cat /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Ubuntu 20.04.1 LTS"
$ sudo apt-get install build-essential checkinstall
$ sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev \
libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libffi-dev zlib1g-dev
$ wget https://www.python.org/ftp/python/3.8.6/Python-3.8.6.tgz
$ tar xzf Python-3.8.6.tgz
$ cd Python-3.8.6
$ ./configure LDFLAGS="-static" --disable-shared
$ make LDFLAGS="-static" LINKFORSHARED=" "
....
$ cd ..
$ zip -r Python-3.8.6.zip Python-3.8.6

Transfer Python-3.8.6.zip to target sysytem

$ unzip Python-3.8.6.zip
$ cd Python-3.8.6
$ ./python

Of course you would have to do

make install

or clean this folder, that's your choice.

Sign up to request clarification or add additional context in comments.

Comments

2

Normally, as long as you are not using any kind of dockerization/paravirtualization, simple:

sudo snap install python38

should work.

1 Comment

Not for Ubuntu 14.04: error: system does not fully support snapd: you need to reboot into a 4.4 kernel to start using snapd
1

I built python from source directly on an Ubuntu 14.04 machine, almost as described here This is what I did:

$ sudo apt-get update
$ sudo apt-get install build-essential
$ sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev \
libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libffi-dev zlib1g-dev

$ wget https://www.python.org/ftp/python/3.8.6/Python-3.8.6.tgz
$ tar xzf Python-3.8.6.tgz
$ cd Python-3.8.6
$ ./configure
$ make -j
$ make install

And it worked for me just fine

1 Comment

tried this on Ubuntu 14.04.5, this results in broken pip: SSLError("Can't connect to HTTPS URL because the SSL module is not available."), I assume python3.8 uses openssl version 3.0, when ubuntu14 has version 1.0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.