TikZ in LyX: Package tikz error?

I am trying to compile a document that uses the tikzpicture and pgf packages, but I am getting this error

UPDATE

Code:

\begin{tikzpicture}
\begin{semilogyaxis}[
width=0.75\columnwidth,
xtick={10,20,...,40},
xlabel=Tamaño del arreglo (miles),
ylabel=Tiempo (ms),
legend pos=outer north east,
title=\textbf{Comparación}]
\legend{Selección,Inserción,Mezcla,Montículos,Rápido,Residuos}
\end{semilogyaxis}
\end{tikzpicture}

Latex preamble:

\usepackage{lmodern}
\usepackage{graphicx}
\usepackage{chngcntr}
\counterwithout{figure}{section}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{pgfplots}
\usepgfplotslibrary{groupplots}
\usepgfplotslibrary{units}
\date{}
-

The error message is quite descriptive; you are using some code that requires the calc library, so need to load it; add

\usetikzlibrary{calc}

after

\usepackage{tikz}

Try processing this sample document exactly as it is:

\documentclass{article}
\usepackage{pgfplots}

\begin{document}

\begin{tikzpicture}
\begin{semilogyaxis}[
width=0.75\columnwidth,
xtick={10,20,...,40},
xlabel=Tamaño del arreglo (miles),
ylabel=Tiempo (ms),
legend pos=outer north east,
title=\textbf{Comparación}]
\legend{Selección,Inserción,Mezcla,Montículos,Rápido,Residuos}
\end{semilogyaxis}
\end{tikzpicture}

\end{document}

From the comments (and a discussion in chat) it was clear that the problem was an outdated LaTeX system.

-
Thanks that fixed one thing, however I keep getting: -Package pgfkeys Error and Missing \begin{document} –  metroxylon Sep 4 '12 at 1:25
What's the complete error message you are getting? Can we see the complete TikZ code producing the error? –  Gonzalo Medina Sep 4 '12 at 1:26
\usepgfplotslibrary {groupplots} The control sequence at the end of the top line of your error message was never \def'ed. If you have misspelled it (e.g., \hobx'), type I' and the correct spelling (e.g., `I\hbox'). Otherwise just continue, and I'll forget about whatever was undefined. –  metroxylon Sep 4 '12 at 1:30
Updated screenshot: Screenshot –  metroxylon Sep 4 '12 at 1:31
The last line refers to legend pos which suggests that you are using the pgfplots package. Did you load this package? –  Gonzalo Medina Sep 4 '12 at 2:00