Install gnuplot on Ubuntu

I once again updated these instructions for Gnuplot 4.4.0 RC1 and newer Ubuntu versions. Find these instructions in this post.

There is an updated Howto for Ubuntu Gutsy Gibbon available.

Though there is gnuplot available in the Ubuntu/Debian repositories, there are reasons to compile gnuplot – first and most important gnu readline support! I don’t know why Debian maintainers don’t compile the GNU readline support into GNUplot – it’s some license issues – but it’s like that and this makes gnuplot practically unusable. Second having the pdf and wxWidgets terminal is not that bad at all 🙂

So here are the instructions:

First we compile and install wxWidgets

  • Download wxWidgets GTK 2.8.3
  • Untar it somewhere: tar xzf wxGTK-2.8.3.tar.gz
  • cd cd wxGTK-2.8.3/
  • mkdir buildgtk
  • cd buildgtk
  • ../configure
  • make
  • sudo paco -lp wxGTK-2.8.3 make install (or just make install if you don’t use paco)
  • sudo ldconfig (you may need to add /usr/local/lib to the file /etc/ld.so.conf before)

Than we are going to install the PDFlib lite

  • Download PDFlib Lite
  • tar xzf PDFlib-Lite-7.0.1.tar.gz
  • cd PDFlib-Lite-7.0.1
  • ./configure
  • make
  • sudo paco -lD make install
  • sudo ldconfig

Than we compile gnuplot

  • Download gnuplot 4.2
  • tar xzf gnuplot-4.2.0.tar.gz
  • cd gnuplot-4.2.0
  • ./configure –with-readline=gnu (check if we have the lines “pdf terminal: yes” and “wxt terminal: yes (EXPERIMENTAL)”, if you miss the jpeg, png and gif terminal install the libgd2-xpm-dev package; also check if you find “Readline library: GNU readline library with -lncurses”, if it says only minimal readline support than install the libreadline5-dev package; you need also the libx11-dev and libxt-dev package for the X11 terminal – libxt-dev package is normally not installed by default (at the debian page about gnuplot one can find the packages necessary to build gnuplot))
  • make (if you have problems here with some latex errors than disable the latex tutorial during the configure stage with “–without-tutorial”, if you get a “103: makeinfo: not found” error message than install the texinfo package)
  • sudo paco -lD make install

Than you have gnuplot installed with nice readline support (command line like in bash), a nice new wxWidgets terminal and a pdf terminal.

34 thoughts on “Install gnuplot on Ubuntu

  1. Great, thanks very much. BTW I used checkinstall instead of paco – a nice&easy way to create&install packages.

  2. Thanks for the guide. It is very helpful.

    I am having problems, though. I can get a pdf terminal, but not the wxt. In the ./configure I get these rather odd notes:

    —————-
    checking for g … no
    checking for c … no
    ————-
    checking whether we are using the GNU C compiler… no
    checking whether g accepts -g… no
    checking dependency style of g … none
    configure: WARNING: No C compiler found. The wxWidgets terminal will not be compiled.
    ———————

    Anyone else having this problem? Anyone know how I need to set things up so that it can find the C compiler?

  3. You need to install the GNU C compiler. First test if you already have it: “gcc –version”. If there is an error message, install the C-compiler. Best is, if you use the build-essential package. So just run “sudo apt-get install build-essential”, and all necessery packages for programming should be installed, also the gcc compiler.

    I hope this helps,
    Werner

  4. Thank you so much. I couldn’t believe it, but c was not installed, nor was fortran. I installed them using:

    sudo apt-get install gfortran g

    though you can use cpp, c , or others to get the proper packages. I tried to compile it again, but ran into pango, cairo, and pangocairo problems. After some failed attempts, I tried libcairo , and it said it was already installed. From a suggestion on a message board tried installing gperiodic, but it didn’t seem to install anything else. However, I got most of the Cairo/Pango files when I installed:
    libpango1.0-dev

    That installed a bunch of packages. I then did congure, make, make install. The result is a very awesome window for graphs.

    Thank you very much for this guide, and I hope what I did can help someone who is just as lost as me.

  5. Hi Matt,

    keep in mind, that debian packages of libraries only install the library itself not the headers and other stuff to develop with this libraries. You always need the developer packages (like libpango1.0-dev) to compile a program which uses this library.

    Great, that it worked out for you,
    Werner

  6. Also having some problems. When I do ../configure I get:
    The development files for GTK+ were not found. For GTK+ 2, please
    ensure that pkg-config is in the path and that gtk+-2.0.pc is
    installed.
    I have gcc installed, I have tried compiling c-programs, but I cant use ‘gcc -version’
    gcc: unrecognized option ‘-version’
    ‘man gcc’, or just ‘gcc [file]’ works great

  7. Hi Peter,

    gcc is installed, otherwise there would be a different error message, I made a mistake above, it should have been ‘gcc –version’ with two ‘-‘.
    Apart from that the development files of gtk+ are missing. Start synaptic (ubuntu) or adept (kubuntu) and search for libgtk packages. One must be called like ‘libgtk-2.0-dev’ or similar (note the ‘dev’) – you need to install this package (many other packages will be installed as well). I can’t tell you right now the correct package, since I’m running in the moment the wrong OS (in every sense :). Hope this helps, Werner

  8. Hi,

    I have a problem, I have followed the instructions but when I try to run gnuplot I cann`t open it becuase a error. This is the error:
    aquiles@ulises-laptop:~$ gnuplot
    gnuplot: error while loading shared libraries: libwx_gtk2_aui-2.8.so.0: cannot open shared object file: No such file or directory

    What can I do?

  9. Hi Ismael,

    if you do ‘ldd gnuplot’ it will print out all libraries needed by this executable and also shows you which is missing. You may forgot the last step of the wxWidgets installation:

    sudo ldconfig (you may need to add /usr/local/lib to the file /etc/ld.so.conf before)

    Edit the file /etc/ld.so.conf and add /usr/local/lib to the file at the beginning or end. if you issue the command ‘sudo ldonfig -v’ than it will print out out libraries it found – look for libwx_… in the long list (must be at the top). You could also redirect the output with ‘sudo ldconfig -v > output.txt’. Or you forgot the ‘sudo make install’ (above it’s without sudo, so this doesn’t work, I’ll change that) – in that case the wxwidgets library is not copied to /usr/local/lib. But if that is the case, gnuplot configure wouldn’t have found wxWidgets???? Which wxWidgets version do you use, and tell me if the ldd command says, that only the aui library is missing?

    Werner

  10. Thanks for your answer… but I still have the same problem. I did this:
    1) In the /etc/ld.so.conf file I add this
    include /usr/local/lib
    2)After that I follow the same instrutions becuase if I wrote only “make install” it showed me an error:
    /usr/bin/install: it cann`t delete it `/usr/local/lib/libwx_base-2.8.so’: permission denied
    make: *** [install_basedll] Error 1
    and when I wrote “sudo make install” everything ran well. After all this I have the same problem.
    When I did “ldd gnuplot” I have another error ldd: ./gnuplot: there is no file or directory
    I`m using wxGTK- 2.8.3

    Please help me thanks a lot

  11. Hi,

    1) Did you run ‘sudo ldconfig -v’ afterwards and is the wxwidgets library listed? After you change /etc/ld.so.conf you need to rerun ldconfig.

    2) ‘ldd /usr/local/bin/gnuplot’ should work. What libraries can’t be found?

    Werner

  12. 2) When I did : “ldd /usr/local/bin/gnuplot”
    All these are not found:

    libwx_gtk2_aui-2.8.so.0 => not found
    libwx_gtk2_xrc-2.8.so.0 => not found
    libwx_gtk2_qa-2.8.so.0 => not found
    libwx_gtk2_html-2.8.so.0 => not found
    libwx_gtk2_adv-2.8.so.0 => not found
    libwx_gtk2_core-2.8.so.0 => not found
    libwx_base_xml-2.8.so.0 => not found
    libwx_base_net-2.8.so.0 => not found
    libwx_base-2.8.so.0 => not found

  13. Than the problem must be with ldonfig:

    Run ’sudo ldconfig -v’ and check the output for the wxwidgets libraries? After you change /etc/ld.so.conf you need to rerun ldconfig!

    alternatively you could use:
    export LD_LIBRARY_PATH=/usr/local/lib

    and run gnuplot again. But the alternative is just a temporary solution, this should normally not be necessary.

    Werner

  14. Ok I`m going to do that. But it which place do I have to put
    “export LD_LIBRARY_PATH=/usr/local/lib”

    and If I wasn`t able to fix this do you know how can I unistall gnuplot and reinstall it??

    Thanks.

  15. Hi Ismael,

    you just type ‘export …’ in the terminal where you did all the compiling (it’s an bash command and sets the environment variable, where to find libraries).

    Regards,
    Werner

  16. Thank you for your instruction. I’m absolute newbie for Ubuntu trying to install GNUPLOT. I have a problem with the command “make”, it does not work at all. When I type “make”, the following line appear “make: *** No targets specified and no makefile found. Stop.” Thanks in advance 🙂

  17. This really helped. Very well written – even novice linux user like me could do it.

    Thanks.

  18. checking for zlib.h >= 1.1.4… no
    checking for zlib.h… (cached) no
    configure: WARNING: zlib library not found or too old, will use built-in instead
    checking for png.h > 0.90… no
    checking for png.h… (cached) no
    configure: WARNING: system png library not found or too old, will use built-in instead
    checking for jpeglib.h… no
    configure: WARNING: system jpeg library not found, will use built-in instead
    checking tiffio.h usability… no
    checking tiffio.h presence… no
    checking for tiffio.h… no
    configure: WARNING: system tiff library not found, will use built-in instead
    checking expat.h usability… no
    checking expat.h presence… no
    checking for expat.h… no
    configure: WARNING: system expat library not found, will use built-in instead
    checking mspack.h usability… no
    checking mspack.h presence… no
    checking for mspack.h… no
    checking for GTK+ version…
    checking for pkg-config… /usr/bin/pkg-config
    checking for GTK+ – version >= 2.0.0… no
    *** Could not run GTK+ test program, checking why…
    *** The test program failed to compile or link. See the file config.log for the
    *** exact error that occured. This usually means GTK+ is incorrectly installed.
    configure: error:
    The development files for GTK+ were not found. For GTK+ 2, please
    ensure that pkg-config is in the path and that gtk+-2.0.pc is
    installed. For GTK+ 1.2 please check that gtk-config is in the path,
    and that the version is 1.2.3 or above. Also check that the
    libraries returned by ‘pkg-config gtk+-2.0 –libs’ or ‘gtk-config
    –libs’ are in the LD_LIBRARY_PATH or equivalent.

    …..that was the message what will i do:(

  19. evolution,

    you need to install the development files for libgtk.
    “sudo apt-get install libgtk2.0-dev” or install the libgtk2.0-dev package via synaptic.

    Regards,
    Werner

  20. Don’t forget that “sudo apt-get build-dep gnuplot” conveniently installs the library header packages needed for compiling.

    Anyway, gnuplot in Debian/Ubuntu now uses libedit which is a pretty good alternative to GNU readline.

  21. Hi!

    Can you help me with. When I installed WXGTK it ran into this mistake :

    *** Could not run GTK+ test program, checking why…
    *** The test program failed to compile or link. See the file config.log for the
    *** exact error that occured. This usually means GTK+ is incorrectly installed.
    configure: error:
    The development files for GTK+ were not found. For GTK+ 2, please
    ensure that pkg-config is in the path and that gtk+-2.0.pc is
    installed. For GTK+ 1.2 please check that gtk-config is in the path,
    and that the version is 1.2.3 or above. Also check that the
    libraries returned by ‘pkg-config gtk+-2.0 –libs’ or ‘gtk-config
    –libs’ are in the LD_LIBRARY_PATH or equivalent.

    I dint known what exactly to do next. please help me as soon as posible. thanks

    nddieu

  22. I had installed Looptools 4.2.5 without prefix to a clearly directory. Now I want to remove it (to install again with prefix) what is the command line I should do ?

    please help me as soon as possiple. thank you!!

    nddieu

  23. nddieu,

    regarding the gtk library, read the comments further above: “you need to install the development files for libgtk.
    “sudo apt-get install libgtk2.0-dev” or install the libgtk2.0-dev package via synaptic.”

    Regards,
    Werner

  24. nddieu,

    regarding looptools (whatever this is), in the source directory where you’ve run “make install”, run “make uninstall” – this only works if the developers provided this make target.

    Regards,
    Werner

  25. The reason libreadline is not used is that gnuplot is not a GPL(-compatible) program, while libreadline is GPL which requires programs that it’s linked into to also be GPL

    You shouldn’t use checkinstall or paco or any somesuch to recompile it, but the proper Debian/Ubuntu package from your distribution – it should be of better quality than something you stitch together with spit and checkinstall.

    In short:
    add a deb-src line to /etc/apt/sources.list
    sudo apt-get build-dep gnuplot;
    mkdir /tmp/build; cd /tmp/build
    apt-get source gnuplot
    cd gnuplot*
    pico debian/rules
    # change –with-readline=builtin to
    # –with-readline=gnu the two times it appears and save file
    # change whatever else you like
    dpkg-buildpackage;
    cd ..;
    sudo dpkg -i *.deb;

    Cheers,
    I.

  26. Hello Iri,

    I followed your instruction, but I get error in my Ubuntu 9.10:

    energeticsaerosol@ubuntu:~/Program_run$ cd gnuplot-4.4.0-rc1/
    energeticsaerosol@ubuntu:~/Program_run/gnuplot-4.4.0-rc1$ ls
    aclocal.m4 config.status FAQ.pdf Makefile.am PGPKEYS stamp-h1
    BUGS configure GNUmakefile Makefile.in pm3d term
    ChangeLog configure.in INSTALL Makefile.maint PORTING TODO
    CodeStyle configure.vms INSTALL.gnu man README tutorial
    config Copyright install-sh missing README.1ST VERSION
    config.h demo lisp mkinstalldirs share
    config.hin depcomp m4 NEWS src
    config.log docs Makefile PATCHLEVEL stamp-h
    energeticsaerosol@ubuntu:~/Program_run/gnuplot-4.4.0-rc1$ mkdir /tmp/build
    energeticsaerosol@ubuntu:~/Program_run/gnuplot-4.4.0-rc1$ cd /tmp/build/
    energeticsaerosol@ubuntu:/tmp/build$ ls
    energeticsaerosol@ubuntu:/tmp/build$ apt-get source gnuplot
    apt-get: /home/energeticsaerosol/OpenFOAM/ThirdParty-1.6/gcc-4.3.3/platforms/linux/lib/libstdc++.so.6: version `GLIBCXX_3.4.11′ not found (required by apt-get)
    apt-get: /home/energeticsaerosol/OpenFOAM/ThirdParty-1.6/gcc-4.3.3/platforms/linux/lib/libstdc++.so.6: version `GLIBCXX_3.4.11′ not found (required by /usr/lib/libapt-pkg-libc6.10-6.so.4.8)

    If you have some ideas, would you please let me know.

    Thank you.

    Bin

Leave a Reply

Your email address will not be published. Required fields are marked *

 

This site uses Akismet to reduce spam. Learn how your comment data is processed.