0

I have installed the astronomy software CASA in my computer, and I would like to be able to run it from any directory just by typing casa in the Ubuntu terminal. What should I change so that this is possible? I've tried the following:

sudo ln -s ./home/alcrespe/Desktop/casa-prerelease-4.7.0-22/bin/casa ./usr/bin/casa

... but it doesn't work. I'm no expert in Ubuntu, how can I fix this? As the previous line suggests, so far I can only access the program CASA in the following location:

./home/alcrespe/Desktop/casa-prerelease-4.7.0-22/bin/casa
  • 1
    please remove the . before each path and you should be fine. – George Udosen Apr 24 '17 at 17:15
  • It should have been: sudo ln -s /home/alcrespe/Desktop/casa-prerelease-4.7.0-22/bin/casa /usr/bin/casa – George Udosen Apr 24 '17 at 17:16
  • On another note "why" install it in Desktop directory. It should have been in /opt or /home/alcrespe ... – George Udosen Apr 24 '17 at 17:21
  • 1
    Making a symlink from a system dir to a user dir is pointless. If you are the only user of the PC, put the program in your own bin directory at ~/bin and add it to the PATH (see How to add a directory to the PATH?); or if other people use the PC, move the program into /usr/bin. – wjandrea Apr 24 '17 at 17:22
  • @George I didn't install it there, it's a weird program, it comes as a tar.gz file and I simply unpacked it and put it in Desktop (just so I don't forget where it is). I just did what you suggested (removed the dot), and it says "ln: failed to create symbolic link '/usr/bin/casa': File exists"... – Wild Feather Apr 24 '17 at 17:23
  • @wjandrea I don't have any idea how to add a program to the path, could you explain it a little more? I'm quite new to Ubuntu and I'd only used Windows before. Thanks! – Wild Feather Apr 24 '17 at 17:23
  • Please run which casa in the terminal and if it returns /usr/bin/casa then don't bother it's already at your disposal...Meaning you don't need that symbolic link any more – George Udosen Apr 24 '17 at 17:26
  • @WildFeather I edited the comment to clarify. – wjandrea Apr 24 '17 at 17:26
  • @George If I run which casa it simply doesn't do anything. How is this possible? If I try to run the program by typing casa, it says "no command casa found". – Wild Feather Apr 24 '17 at 17:28
  • You will need to re-install that program. Run ls /usr/bin | grep casa and tell me what it gives you... – George Udosen Apr 24 '17 at 17:30
  • @wjandrea Since the program is not an executable icon, but a folder with a lot of scripts, should I move the entire folder to "bin"? I can't run it by typing casa even if I'm in the right directory, so I'm not sure if that would work. – Wild Feather Apr 24 '17 at 17:30
  • @George I've installed it two times already, it's driving me crazy. If I run what you said, it writes "casa" in red below the command, so it seems to be there, right? – Wild Feather Apr 24 '17 at 17:32
  • @WildFeather Oh, it's not just one program... Maybe you'll want to try these (possibly outdated) installation instructions first: Installing CASA on Ubuntu – wjandrea Apr 24 '17 at 17:33
  • @wjandrea Oh thank you, I hadn't found that before! Should I delete something before I try to install it following those instructions? – Wild Feather Apr 24 '17 at 17:35
  • Yes its there alright... but i fear you might not be doing it right – George Udosen Apr 24 '17 at 17:35
  • 1
    Yes delete the /usr/bin/casa before trying that install option – George Udosen Apr 24 '17 at 17:36
  • That option is clean and instructive that will solve your problem but ping if you need help... – George Udosen Apr 24 '17 at 17:38
  • @George I followed those instructions and everything seemed to work... Until I typed casa to test it and it said again that it's not defined. I just want to burn my laptop, please help! I need it for a project and I can't even manage to get this simple task right... What could I have done wrong? – Wild Feather Apr 24 '17 at 17:53
  • Did you add this export PATH=$PATH:/usr/local/bin/CASA/casapy-30.0.9860-001-64b to your ~/.bashrc file, and after did source ~/.bashrc? – George Udosen Apr 24 '17 at 17:54
  • Your command should casapy not casa from that link. Try that! – George Udosen Apr 24 '17 at 17:56
  • @George I did that, but instead of casapy-30.0.9860-001-64b I typed casa-prerelease-4.7.0-22.tar.gz because that's the name of the file I downloaded. And when I typed source ~/.bashrc, nothing showed on the terminal... However, the directory is created and both the tar.gz file and the extracted one are there, I checked. And casapy doesn't work either... :( – Wild Feather Apr 24 '17 at 17:58

1 Answers1

2

You have two issues to address from my finds:

  1. Doing it right:

    • You are obviously not following the steps correctly as I did and have successfully ran it using casa command, though the link says casapy.
    • Solution please follow the steps verbatim.

      • sudo mkdir /usr/local/bin/CASA
      • sudo mv casapy-30.0.9860-001-64b.tar.gz /usr/local/bin/CASA
      • cd /usr/local/bin/CASA
      • sudo tar zxvf casapy-30.0.9860-001-64b.tar.gz
      • Add this to your ~/.bashrc file and then source it with source ~/.bashrc:
        • export PATH=$PATH:/usr/local/bin/CASA/casapy-30.0.9860-001-64b/bin
      • Test it with: casa
      • Output:

         george@george-ubuntu-server:~$ casa
        
         =========================================
         The start-up time of CASA may vary
         depending on whether the shared libraries
         are cached or not.
         =========================================
        
        CASA Version 5.0.0-101
        Compiled on: Thu 2017/01/05 04:33:33 UTC
        Activating service name='org.gnome.GConf'
        Successfully activated service 'org.gnome.GConf'
        Activating service name='org.gtk.vfs.Daemon'
        Successfully activated service 'org.gtk.vfs.Daemon'
        PYVER        -  2.7
        AIPS_DIR     -  /usr/local/bin/CASA/casa-stable-5.0.101
        SCRIPT_REPOS -  /usr/local/bin/CASA/casa-stable-
        5.0.101/linux/lib/python2.7/regressions/
        --------------------------------------------------------------------------------
        ls: cannot access '/usr/local/bin/CASA/casa-stable-5.0.101/linux/lib/python2.7/regressions/': No such file or directory
        --------------------------------------------------------------------------------
        ___________________________________________________________________
        For help use the following commands:
        tasklist               - Task list organized by category
        taskhelp               - One line summary of available tasks
        help taskname          - Full help for task
        toolhelp               - One line summary of available tools
        help par.parametername - Full help for parameter name
        ___________________________________________________________________
        ------------------------------------------------------------------------------------------
        
        {'dirs': {'xml': '/usr/local/bin/CASA/casa-stable-5.0.101/xml',
        
        'pipeline': None, 'python': '/usr/local/bin/CASA/casa-stable-5.0.101/lib/python2.7', 'data': '/usr/local/bin/CASA/casa-stable-5.0.101/data',
        'recipes': '/usr/local/bin/CASA/casa-stable-5.0.101/lib/python2.7/recipes', 
        'rc': '/home/george/.casa', 'root': '/usr/local/bin/CASA/casa-stable-5.0.101'}, 
        'files': {'logfile': '/home/george/casa-20170425-095553.log'},
        'source': {'url': 'https://svn.cv.nrao.edu/svn/casa/trunk', 'revision': '39214'}, 
        'state': {'unwritable': set([]), 'startup': True, 'init_version': 0}, 
        'helpers': {'info': None, 'viewer': 'casaviewer', 'crashPoster': '/usr/local/bin/CASA/casa-stable-5.0.101/bin/CrashReportPoster', 'dbus': '/usr/local/bin/CASA/casa-stable-5.0.101/lib/casa/bin/dbus-daemon', 'logger': 'casalogger', 'ipcontroller': '/usr/local/bin/CASA/casa-stable-5.0.101/lib/casa/bin/ipcontroller', 'ipengine': '/usr/local/bin/CASA/casa-stable-5.0.101/lib/casa/bin/ipengine'}, 
        'build': {'version': '5.0.0-101', 'number': '39214', 'time': 'Thu 2017/01/05 04:33:33 UTC'}, 'flags': {'/usr/local/bin/CASA/casa-stable-5.0.101/lib/python2.7/casapy.py': ''}}
         ------------------------------------------------------------------------------------------
         Activating auto-logging. Current session state plus future input saved.
         Filename       : ipython-20170425-095554.log
         Mode           : backup
         Output logging : False
         Raw input log  : False
         Timestamping   : False
         State          : active
         *** Loading ATNF ASAP Package...
         *** ... ASAP (rev#3110) import complete ***
        
         CASA <2>:    
        
  2. Library issues. The latest version works on Ubuntu Xenial, and the version your installing might not work on your version of Ubuntu as I discovered when I tried to install your version 4.* on it. So get back to your instructor for further help.

Important Note:

You might want to install it on a Virtual Device as I noticed your version insisted on creating a user with id 1001 irrespective of who owns that id. In my case the user koko was made the group owner of the /usr/local/bin/CASA/* directory. Permission given to folder:

drwxr-xr-x 11  12998   1001      4096 Jan  5 06:09 casa-stable-5.0.101/

Change the casapy-30.0.9860-001-64b to the one you download or the name seen there after extraction

Source:

https://casaguides.nrao.edu/index.php/Installing_CASA

George Udosen
  • 36,677