Python install package apt

Python-apt: install package with specific version

More generally, what is the way, through command line and aptitude commands, to list what previous versions can be installed for a package ? Is there, for example, a standard that set another location for previous versions, like an archive repository I should always find in the form http://../ archive /../, or something else ?

Python-apt: install package with specific version

I’m using python-apt to install a debian package. I need to be able to install it with a specific version, but can not figure out how. According to the documentation for candidate:

Just assign a Version() object, and it will be set as the candidate version.

Currently I’m installing the package the following way:

import apt cache = apt.cache.Cache() pkg = cache['byobu'] # Or any random package for testing pkg.mark_install() cache.commit() 

The only way I’ve found so far to set the Version have been through apt.apt_pkg like this, but I do not know how to progress from here:

pkg_name = 'byobu' cache = apt.cache.Cache() pkg = cache[pkg_name] version = apt.apt_pkg.Cache()[pkg_name].version_list[1] # 5.77-0ubuntu1 new_version = apt.package.Version(pkg, version) # 5.77-0ubuntu1 new_version.package.candidate # 5.77-0ubuntu1.2  

The version in the end is the installed one and cache.commit() just returns True without doing anything (probably because the candidate version is the installed one). What am I doing wrong?

And after writing this down in a structured way I finally understood that pgk.candidate is overwritable by my new_version . I've tried previously but not with the mix of apt.package.Version , apt.cache.Cache and apt.apt_pkg.Cache .

I'm leaving this here for someone else to use in the future. Final sample code:

pkg_name = 'byobu' cache = apt.cache.Cache() package = cache[pkg_name] version = apt.apt_pkg.Cache()[pkg_name].version_list[1] candidate = apt.package.Version(package, version) package.candidate = candidate package.mark_install() cache.commit() 

Feeling stupid, realised that I don't have to build the version but can just use it from the version list. Remember kids, don't code while drunk.

cache = apt.cache.Cache() package = cache[package_name] candidate = package.versions.get(version) package.candidate = candidate package.mark_install() cache.commit() 

Linux: How to install certain old version of a software via, sudo apt-get install = OR. sudo apt-get -t= To see which packages are tracked, run. apt-cache showpkg Unfortunately though, if a particular version is not managed by the apt, then you are out of luck using apt. It might be managed by …

Install a specific package version

I need to install a tofrodos 1.17.3 for i386 . I'm running Ubuntu 16.04.2 and I know that if I run sudo apt-get install tofrodos:i386 it will install version 1.17.3 . However this will be in a script which possibly will be used much later and I need to fix the version, 1.17.3 and the 32 bit architecture, i386 . Does anyone know how to do that?

sudo apt-get install tofrodos=1.17.3:i386 sudo apt-get install tofrodos:i386=1.17.3 

Nobody can guarantee that the package in the repository will be a fixed version.

It is possible to hold an installed package from upgrading, but apt will always install an available version from the repos. Nobody keeps old versions there.

There actually may be two versions the initial one and an "upgrade" one.

But it is very unlikely that a package will be upgraded to some new major version in an LTS repository. Some minor fix may be released, but I don't think it can affect functionality.

sudo apt-get install tofrodos:i386=version 

is the correct command. But there is no 1.17.3 version in the repos.

The correct version is 1.7.13+ds-2ubuntu1 .

pilot6@Pilot6:~$apt-cache policy tofrodos tofrodos: Installed: (none) Candidate: 1.7.13+ds-2ubuntu1 Version table: 1.7.13+ds-2ubuntu1 500 500 http://ru.archive.ubuntu.com/ubuntu xenial/universe amd64 Packages 
sudo apt-get install tofrodos:i386=1.7.13+ds-2ubuntu1 

It is the "initial" version for xenial . Even if the package is upgraded in xenial-updates the command will install this version.

If the package is available in the repositories you can install a specific version from a specific architecture of a package using this command:

sudo apt-get install package:i386=version 

to see if your desired version is available to you, use:

apt-cache madison package-name 
apt-cache policy package-name 

the other option for your case is:

And it seems your desired package version does not exist in the repositories.

Apt - How to change the package version in candidate?, What I want to do is basically installed CUDA 8.0, which automatically installs gcc, but because of candidate version of gcc is 7.2.0, it installs this version. However, this afterwards gives compatibility errors. In summary: I need to install a gcc version less than 5. I am trying to install torch …

Install specific version of apt package for specific ubuntu version

I want to install package foo version 1234 in a docker container. I prefer this to the latest version, as it will always work the same way.

So my Dockerfile has this:

RUN apt-get update && apt-get install -y foo=1234 

But the base image is mongodb:4.0.2 , which is layered on Ubuntu xenial.

When I build the image, the apt install fails because it cannot find that version. I think xenial doesn't support that version.

So how do I find the latest supported version of a package foo on xenial? If I run apt policy foo it shows me the latest for the ubuntu I'm using (bionic), not for xenial.

If the package at stake is, say, rlwrap , you could just take a look at the webpage https://packages.ubuntu.com/xenial/rlwrap

But if you want a proper way to get this version info programatically, you can rely on the Launchpad API, which comes with an official API client implemented as a Python library.

Otherwise, you can directly query the API with tools such as curl and jq (to parse the retrieved JSON data):

$ curl -fsSL "https://api.launchpad.net/1.0/ubuntu/+archive/primary?ws.op=getPublishedSources&source_name=rlwrap&exact_match=true&distro_series=https://api.launchpad.net/1.0/ubuntu/xenial" \ | jq --raw-output ".entries | .[0] | .source_package_version" → 0.41-1build1 

As mentioned in this Askubuntu question, a similar API exists for Debian as well.

Apt-get install for different python versions, Note that the Debian - and Ubuntu - systems devised a way to run parallel official Python's in /usr, and to have apt-get to install Python packages to both Python versions at once. This mostly works, but they mess with Python's default directory hierarchy, and some applications fail to use Python in this way.

List previous versions available for a package and install one of them by apt-get

A 10.5-2 version of postgresql that is coming from the
deb http://apt.postgresql.org/pub/repos/apt/ stretch-pgdg main
repository has a problem, and I would like to return to the 10.4 version I know to be working the way I want.

an apt-cache madison postgresql-10 returns me these informations atm :
postgresql-10 | 10.5-2.pgdg90+1 | http://apt.postgresql.org/pub/repos/apt stretch-pgdg/main amd64 Packages postgresql-10 | 10.5-2.pgdg90+1 | http://apt.postgresql.org/pub/repos/apt stretch-pgdg/main Sources

How can I find the previous packages version(s) existing for 10.4 ?
When I try to use a version number I found somewhere (on chocolatey website : I had no clue about how to search and was a bit lost), it didn't succeed : sudo apt-get install postgresql-10=10.4.0.20180721 E: Version '10.4.0.20180721' for 'postgresql-10' was not found

Going to the postgresql repository, http://apt.postgresql.org/pub/repos/apt/dists/stretch-pgdg/, I didn't found a clue about how to get any previous version.

More generally, what is the way, through command line and aptitude commands, to list what previous versions can be installed for a package ?
Is there, for example, a standard that set another location for previous versions, like an archive repository I should always find in the form http://../ archive /../, or something else ?

apt-cache showpkg will list all the available versions

apt-mark hold will prevent automatic upgrades

postgresql is now on version 11 is available from the main website.

On github, next to "make a pull request" click on master, change selection to '10 stable', then make a pull request. You'll need to fix the bug if 10 stable is 10.5. If this isn't easy, you can compare code from 9.5 stable - only 1066 files that were altered and go through changing them. Stinks that they didn't actually keep tags for other versions.

Edit: Don't forget to update before you check for the available packages.

Apt - How to install a specific version of a metapackage, Here's what happens when I want to try to install version 460.67 instead of 460.80 (which is buggy, FYI). $ apt-get install -s nvidia-driver-460=460.67-0ubuntu1 NOTE: This is only a simulation! apt-get needs root privileges for real execution. Keep also in mind that locking is deactivated, so don't depend …

Источник

Читайте также:  Insert title here
Оцените статью