# How can I install pgfplots on the home directory with or without sudo rights?

I need to use some packages at my uni network so I can compile my projects there too but I am pretty sure it doesn't have pgfplots (from looking at the log) perhaps some others.

All the tutorials seem to need access to admin directories so I can only install onto my home directory there. Is there a way I can install the package (and any others needed) to get it working anyway?

Oh and here is the relevant part of the log

``````(/usr/share/texmf/tex/generic/pgf/libraries/pgflibrarytikztopaths.code.tex
File: pgflibrarytikztopaths.code.tex 2006/10/16 v1.10 (rcs-revision 1.5)
)))

Type X to quit or <RETURN> to proceed,
or enter new name. (Default extension: sty)

Enter file name:
! Emergency stop.

l.13 \usepackage
{pgfplotstable}^^M
*** (cannot \read from terminal in nonstop modes)
``````

I would not be able to make any change to things in the `/usr/share/`

directory without sudo I don't think

Further to this additional help with configuring the editor to be able to reference the pgfplots but also the tex files that the administrator has already installed will be useful (I am on on scientific linux but a general answer will be helpful)

EDIT: I have managed to persuade them to add the package so everyone can use it. I would still be interested in getting an answer to the question and also with sudo rights for comparison.

EDIT: I have not managed to get either method suggested in answers below working. When I try to compile a file with my pgfplots package in the preamble a file called pgfplotshandlers.code.tex just opens in kile.

When I call `kpsewhich pgfplots.sty` command it does now get my `/Home/myusername/texmf/tex/latex/pgfplots/pgfplots.sty` which is an improvement because before this command was saying nothing whatsoever.

UPDATE: I have not a .profile or .bashrc in my home directory on the guest computer.

-
you can put them in the current working directory, or else ` ~/texmf/tex/latex/` –  cmhughes Feb 11 at 21:18
All of them? There's quite a lot! Will just the .sty be ok? –  Magpie Feb 11 at 21:46
you'll probably need all of them :) –  cmhughes Feb 11 at 22:13
Another option is just install texlive locally in, say, ~/texlive/ and put smth like "export PATH="~/texlive/2012/bin/x86_64-linux/":\$PATH" into yout ~/.barshrc file. A full installation of texlive (really full) is about 3GB. I think, if you have a fast Inet connection, this option is faster than trying to figure out how to "install" pgf in /home :) –  amorua Mar 1 at 22:47
I see you used inverted commas there. Is that because there is not really an installation script involved here? Just setting correct paths does this? If so, why would it take a fast internet connection? –  Magpie Mar 2 at 1:25

make a new empty directory say `~/pgfplots` download `pgfplots_1.7.tds.zip` from `http://sourceforge.net/projects/pgfplots/`

unzip the zip file into the empty directory. Then set your `TEXINPUTS` environment variable to

``````~/pgfplots/tex//:
``````

where the `//` means recursive directories below that, and the trailing `:` means search all the standard places as well.

Then you should be done.

To demonstrate, I just did this unzipping in to `/tmp/pgf` then

`````` \$ kpsewhich pgfplots.sty
``````

which produces the output:

``````/usr/local/texlive/2012/texmf-dist/tex/latex/pgfplots/pgfplots.sty
``````

Showing it is picking it up from the standard TL2012 place

``````\$ export TEXINPUTS=/tmp/pgf/tex//:
``````

set the environment variable (use `setenv` for `csh`)

``````\$ kpsewhich pgfplots.sty
``````

Try again:

``````/tmp/pgf/tex/latex/pgfplots/pgfplots.sty
``````

Now it picks it up from the locally installed file.

-
Will that not mess up the rest of my tex packages though? –  Magpie Mar 7 at 19:01
No not at all, no other packages are there so (because of the `:` at the end of the environment variable) all the standard places will be used as well so all other packages will be found where they are currently found. –  David Carlisle Mar 7 at 19:04
Please see my update –  Magpie Mar 8 at 0:17
@Magpie your update edits are very confusing (and just mentioned kile for the first time) make a small document `myfile.tex` that has `\usepackage{pgfplots}` in the preamble, If you have things set up as in this answer or your admins have added it, then it will work if you do `pdflatex myfile` on the command line. If it does not work post the document into your question (Questions should always contain a complete MWE example document). If it works on the command line but not in your kile system that is a question about kile configuration which you should ask as a different question. –  David Carlisle Mar 8 at 17:43
ok I cannot fathom why your example has tmp directory? –  Magpie Mar 9 at 0:56

On Unix/Linux, TeXLive's default `TEXMFHOME` directory is `~/texmf`. It should be enough to unzip the "tds" version (`pgfplots_*.tds.zip`) into ~/texmf in such way that the directory structure in the archive will be preserved, for example by running

``````\$ mkdir ~/texmf #if it does not exist yet
\$ cd ~/texmf
\$ unzip path/to/pgfplots_*.tds.zip
``````

should do the job (that should actually work for all TeX packages).

It that does not work, it would probably mean that your local TeX admin redefined the location of the `TEXMFHOME` directory. You may want to talk to them.

-
If `TEXMFHOME` is not `~/texmf`, try this command: `kpsexpand '\$TEXMFHOME'` –  Paul Gaborit Mar 7 at 0:43
yes I was going to mention that possibility but thought I'd stick to the unzip it anywhere but set env variable version for maximum portability, but of course this is simpler so long as it is set up that way –  David Carlisle Mar 7 at 9:28
Please see my update. –  Magpie Mar 8 at 0:17
I don't quite understand your update. Are you saying that it works for `pgfplots.sty` but not for `pgfplotshandlers.code.tex`? I have two versions of pgfplots on my machine, and none of them contains a file called `pgfplotshandlers.code.tex`. –  Jan Hlavacek Mar 8 at 1:29
@JanHlavacek no it does not work. If I try to compile this file will automatically open but it does not compile my file.I edited it again. I hope that is clearer now. –  Magpie Mar 8 at 1:44