Home > Hacks, Science > Run Stata 10/11 with GUI under Ubuntu

Run Stata 10/11 with GUI under Ubuntu

Stata 10/11 are available for Linux, which is great but… after installing Stata (dynamically linked) under Ubuntu, starting the GUI version (xstata) usually results in an error message because one or more libraries apparently cannot be found.

By adding the corresponding symbolic links

sudo ln -s /usr/lib/libgtk2.0-0 /usr/lib/libgtk-1.2.0

sudo ln -s /usr/lib/libtiff.so.4 /usr/lib/libtiff.so.3

sudo ln -s /usr/lib/libgtksourceview-2.0.so.0 /usr/lib/libgtksourceview-1.0.so.0

Stata can be tricked into using the newer version instead of the old version it is expecting.

As Julian pointed out below, Stata 11 may close unexpectedly when starting the .do file editor. If that happens (I reproduced that bug on a fresh Karmic install), installing libgtksourceview 1.0 may fix the problem:

sudo apt-get install libgtksourceview1.0-0

Natty Narwhal update: After upgrading to 11.04, I got an error message (“error while loading shared libraries: libtiff.so.3: cannot open shared object file: No such file or directory.”) when trying to run Stata. I fixed it by creating another symbolic link:

sudo ln -s /usr/lib/i386-linux-gnu/libtiff.so.4.3.3 /usr/lib/libtiff.so.3

Oneiric Ocelot update: Thanks to Charles Opondo for pointing out that libgtksourceview1.0 is not in the Oneiric repos.
You can either 1) download and install libgtksourceview from the Natty repos or 2) re-install the statically linked version of Stata.

– Option 1 –
cd ~/Desktop
wget http://mirrors.us.kernel.org/ubuntu//pool/universe/g/gtksourceview/libgtksourceview-common_1.8.5-2build1_all.deb
wget http://mirrors.us.kernel.org/ubuntu//pool/universe/g/gtksourceview/libgtksourceview1.0-0_1.8.5-2build1_i386.deb
sudo dpkg --install libgtksourceview-common_1.8.5-2build1_all.deb
sudo dpkg --install libgtksourceview1.0-0_1.8.5-2build1_i386.deb
rm libgtksourceview*.deb

– Option 2 –
Delete your Stata installation in the /usr/local/stata folder and re-install it from the disk. During the installation, Stata asks whether you want to install the 32-/64-bit dynamically/statically linked version. Choose statically linked.

Whichever way you choose, please update Stata 11 after installing it before doing any analyses. There is a serious bug in the original CD version that can completely muck up your results. You have to run Stata as a superuser to do that

sudo /usr/local/stata/xstata

Replace xstata with xstata-se if you are using Stata/SE.
Then, in Stata, type update all and when prompted update swap. When you are done, restart Stata as a normal user. It should now say “Stata 11.2” in the title bar.

Advertisements
Categories: Hacks, Science
  1. Julian
    March 10, 2010 at 9:58 pm

    Thanks for this. It worked really well for me. I have a question: when I click the .do file editor Stata closes. do you have any solution for this?

    Thanks again,

    Julian

    • March 11, 2010 at 7:12 am

      I have installed Stata on a few Ubuntu machines but I never had that happen.
      If you are using Stata 11 I would start it as superuser
      ‘sudo /usr/local/stata11/xstata’
      and then run
      ‘update query’
      in Stata to get the latest Stata updates.
      If that doesn’t fix the problem, start Stata 11 as a normal user from the Terminal
      ‘/usr/local/stata11/xstata’
      and watch for the error messages that you get when you click the .do file editor icon. Maybe the error message provides some clues.

    • March 11, 2010 at 10:45 am

      Holy smokes, you jinxed my Stata installation! (-:
      I upgraded my computer at work to Karmic a couple of days ago and now I’m having the same problem! — Strange as Stata works fine under Karmic at home…
      When starting Stata from the Terminal and click the .do file editor button, Stata closes and I get:
      ‘symbol lookup error: /usr/local/stata11/xstata: undefined symbol: gtk_source_buffer_set_check_brackets’
      Just on a whim I did
      ‘sudo apt-get install libgtksourceview1.0-0’
      and it worked… (-:

  2. May 19, 2010 at 8:37 pm

    Thanks so much for this post. Helped me out greatly!

  3. Greg
    May 21, 2010 at 12:04 am

    Thanks the solution for the do file button problem worked great for me.

  4. June 11, 2010 at 7:05 am

    Thanks a lot – the do file button has solved a longstanding problem for me

  5. Tim
    August 4, 2010 at 7:52 am

    This worked for me on stata10. Thank you!

  6. September 13, 2010 at 3:26 pm

    Thanks a lot for this post, it helped me sort out my problem right away!

  7. November 14, 2010 at 10:28 pm

    I should add my thanks as well. This was a life-saver.

  8. Carlos Dorantes
    February 15, 2011 at 10:51 am

    I really thank you. The stata editor was not working, and now I can run Stata 11 completely in Ubuntu! This is great!

  9. Anton Babkin
    April 7, 2011 at 11:22 am

    Thanks a lot, this was actually the only google result to my request – and fitted perfectly.

  10. Konstantin
    May 19, 2011 at 2:38 am

    Unfortunately, the solution does not seem to work for me (Stata11, 64, dynamic; Ubuntu 11.04),I still get “./xstata: symbol lookup error: ./xstata: undefined symbol: gtk_source_buffer_set_check_brackets”… any other ideas?

    • May 19, 2011 at 6:02 am

      Hi Konstantin, I’m not sure what’s wrong there. Stata11 worked fine under Natty 64-bit in my VM installation. You could try installing the statically linked version of Stata. In theory, this should install all the libraries that you need to run Stata.
      Gruss in die schoenste Stadt der Welt (die ich arg vermisse..) (-;

  11. Clara
    September 18, 2011 at 11:51 am

    Thanks for posting this fix; I have Stata 11 and Ubuntu 10.10. I figured out the libraries thing more or less on my own, but the do-file editor problem just left me blinking. Thanks for helping!

    The do-file editor doesn’t have any syntax highlighting in my version; is this just a missing feature, or did I not turn something on?

    • September 18, 2011 at 12:23 pm

      The missing syntax highlighting is unfortunately a missing feature.

  12. Charles Opondo
    October 16, 2011 at 10:07 am

    The problem might recur when you upgrade to Ubuntu 11.10 Oneiric. Unfortunately libgtksourceview1.0-0 is not available in Oneiric’s repositories. Manually downloading it from Natty (along with the necessary dependencies) fixed it for me.

  13. Stephan
    October 17, 2011 at 4:11 am

    Can you describe how you did that in noob way? thanks!

  14. Stephan
    October 17, 2011 at 4:35 am

    i fixed it also, by installing libgtksourceview-common_1.8.5-1_all.deb and then libgtksourceview1.0-0_1.8.3-1_amd64.deb

  15. Uli
    November 1, 2012 at 6:32 am

    Thank you, you helped me with the do-file editor crash of STATA 11 on Ubuntu 11.4. Cheers, Uli

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: