Installing Package from a Local .Tar.Gz File on Linux

How to install Python packages from the tar.gz file without using pip install

Thanks to the answers below combined I've got it working.

  • First needed to unpack the tar.gz file into a folder.
  • Then before running python setup.py install had to point cmd towards the correct folder. I did this by pushd C:\Users\absolutefilepathtotarunpackedfolder
  • Then run python setup.py install

Thanks Tales Padua & Hugo Honorem

How to install tar.gz package to Yocto by adding new layer?

First, before answering your questions

Let me mention some best practices advice for you:

Rename the recipe to some significant name related to you compressed package.

Naming the recipe to mylayer confuses Yocto users, because there is the term layer also.

Regarding you recipe:

There is no need for FILESEXTRAPATHS because the recipe path is added automatically to Yocto paths.

FILESEXTRAPATHS it is required for .bbappend files.

You need to override the do_install task function, it does nothing by default.

do_install is the first essential task to make sure that your sources are included in the final image.

Beside that, when specifying a compressed source file into SRC_URI, yocto automatically decompresses it.

This is mentioned here.

So, here what your recipe should look like:

SUMMARY = ""
LICENSE = "CLOSED"

# Prevent Yocto from decompressing the file
SRC_URI = "file://mypackage.tar;unpack=0"

do_install(){
# Create the opt folder into the final image, ${D} is ${WORKDIR}/image
install -d ${D}/opt
# Copy the compressed file there; You can change permissions as you want
install -m 0755 ${WORKDIR}/mypackage.tar ${D}/opt
}

# Very important to specify what you installed in (do_install)
FILES_${PN} = "/opt/*"

Now, when you run IMAGE_INSTALL_append += " mylayer" your file will be installed.

Regarding your questions:

  1. You mentioned that your compressed file contains .deb files, I assume that no license checksum is needed. Also, I understand that you may wanted to point to SRC_URI[md5sum] or other checksums for the full package. That is also not needed for local files, it is used to check for the integrity of online sources.

  2. PACKAGE_CLASSES as mentioned here, is used by the system to know in what type the data should be packaged. By the data I mean the data that you installed with do_install. That data get packaged for according to your PACKAGE_CLASSES variable, for example, to deb file. And that is used, along side with all other recipes packages, to build the final rootfs.

  3. Yes, if you are installing the tar file into the image and then unpack it to install all deb files, for example, with dpkg. You can use the bin_package class to do that, now the recipe must be changed for that reason:

  • Decompress the tar file and provide the deb files in the local files folder.

  • Add all deb files to SRC_URI

  • Inherit the bin_package class

  • Specify the files to be packaged.

Your recipe should look like this:

SUMMARY = ""
LICENSE = "CLOSED"

SRC_URI = "file://deb_file1.deb \
file://deb_file2.deb"

# No need to `do_install` , it is invoked by the (bin_package) class

FILES_${PN} = ""

Important:

About FILES_${PN}, you need to add all what the deb installed into the image folder

Example, if your deb file installs this:

/usr/bin/hello
/etc/hello.cfg

Specify them:

FILES_${PN} = "/usr/bin/*"
FILES_${PN} += "/etc/*"

Use * so if other deb files install files into the same folder as others it will include all.

installing a python package from tar.gz

Since you are running Ubuntu, simply run sudo apt-get install python-cvxopt

I can install it this way on 16.04. Not sure what version you are running.

It does look like the compiler (gcc) is complaining because you are missing dependencies (blas). Installing via the package manager should solve your issues.

Installing downloaded tar.gz files with pip

You can install tar.gz with pip Install a particular source archive file.

pip install ./Package-1.0.4.tar.gz

You can also install it with extracting tar.gz file. First you should extract it using using tar command.

tar -xzvf PyGUI-2.5.4.tar.gz
cd PyGUI-2.5.4.tar.gz

And then use the setup.py file to install the package .

python setup.py install

or

sudo python setup.py install

( use sudo only in linux )

Source: https://pip.readthedocs.io/en/stable/reference/pip_install/#git

R: make not found when installing a R-package from local tar.gz

what do you need is to update the Rtool, here is the link I had the same issue before once you update it will work.

Batch install RPM packages from .tar.gz file on CentOS

You have to untar the file and the install them with rpm

tar xfz file.tar.gz
rpm -i *rpm

There is no way for rpm to install RPMs from standard input.

Otherwise there is a archivemount to mount the tarball (see https://superuser.com/questions/265772/is-it-possible-to-mount-a-tar-file).



Related Topics



Leave a reply



Submit