Installing software locally

From CsWiki
Jump to: navigation, search

When you need software that isn't installed on CSE system, you can install is locally.

Python Packages

Using pip

Installing python packages may be done using a virtual environment as described here

For example

csusername@river:~% virtualenv my-venv-p3.7 -p python3.7 --system-site-packages
csusername@river:~% source my-venv-p3.7/bin/activate.csh
[my-venv-p3.7] csusername@river:~% pip install cowsay

Example of sing the package:

[my-venv-p3.7] csusername@river:~% python -c "import cowsay; cowsay.tux('I installed cowsay package')"

Compile Python packages using setup.py build

As with pip insallation, compiling python packages is done within an active virtualenv.

  • Create a virtualenv as described here
  • Activate it
  • Download the software, uncompress it if needed and change to the directory
  • Run python setup.py build, you may run python setup.py --help to see if you need to pass some extra parameters
  • After successful compilation, run python setup.py install (no sudo needed). The package will be installed under your activated virtualenv

Pre-compiled software

In case you need a pre-copiled software you may search for local installation such as tar.gz file, open it on a directory where you have write permissions (like sub-directory on your home directory, for example) and run the executable from this directory.

For example: installing Free42, simulator of HP-42s from https://thomasokken.com/free42/:

Download:

csusername@river:~/Downloads%  wget https://thomasokken.com/free42/download/Free42Linux.tgz

List files to see the content:

csusername@river:~/Downloads%  tar tvf Free42Linux.tgz

In case the files doesn't stored under a directory, create one:

csusername@river:~/Downloads%  mkdir free42

Extract the files:

csusername@river:~/Downloads%  tar xf Free42Linux.tgz -C free42

Run it from that location:

csusername@river:~/Downloads%  ~/Downloads/free42/free42dec

Other software

Compiling software for local installation

In order to compile and install software using local installation you'll have to:

  • Download the source code
  • Compile it, while making sure the target installation is not the default but a place you have write permissions on (like a directory under your home directory. or ~/.local)
  • Run 'make install' without sudo
  • Run it from that chosen directory

Make sure to read the compilation instructions, in order to find out how to set the installation location on a chosen directory instead of the default one.

For example: installing cmatrix from source code

The code can be found at: https://github.com/abishekvashok/cmatrix

The instructions tells us that we can compile and install using autoconf tools or CMake, and instruct how to choose a custom installation location

Download:

csusername@river:~/Sources%  git clone https://github.com/abishekvashok/cmatrix

Creating configure tool using autoconf:

csusername@river:~/Sources%  cd cmatrix
csusername@river:~/Sources/cmatrix%  autoconf -i
configure.ac:5: error: possibly undefined macro: AM_CONFIG_HEADER
     If this token and others are legitimate, please use m4_pattern_allow.
     See the Autoconf documentation.
configure.ac:6: error: possibly undefined macro: AM_INIT_AUTOMAKE
configure.ac:152: error: possibly undefined macro: AM_CONDITIONAL

Search google for this error and findout how to fix it (some libraries are missing, the below command fetch them as well. run autoreconf --help to see the parameters explanation):

csusername@river:~/Sources/cmatrix%  autoreconf -fvi

Configure before compilation, choosing an installation prefix, I choose here .local under my home directory:

csusername@river:~/Sources%  ./configure --prefix=`echo ~`/.local

In case that some needed library are missing, you can download them and run './configure --help' to find out how to configure it to search them there.

Actually compiling:

csusername@river:~/Sources%  make

If no errors, install it. You do not need root privileges because you choose a writable installation location:

 csusername@river:~/Sources%  make install

Now you can run the executable. You'll have to use the full path (unless you set it up on your $PATH environment variable):

 csusername@river:~/Sources%  ~/.local/bin/cmatrix

(Use q to quit :) )