Installing OpenCog for Noobs

From OpenCog
Jump to: navigation, search

THIS PAGE IS OBSOLETE. SEE HERE INSTEAD

Description

This page describes how to install the dependencies and source code for OpenCog in an Ubuntu 14.04 LTS environment. It is in the process of being updated from the Ubuntu 12.xx guide; please edit or report any errors.

If you are running an earlier or later version of Ubuntu, or a different Linux distribution, you can still use these instructions as a guide by replacing ocpkg with ocbootstrap in step 3.3.

Prerequisites

This page has the following prerequisites:

Contents

Getting to the command line

This supposes you are using an Ubuntu VM (virtual machine). If that is not the case, skip to the next subsection.

Start your Ubuntu VM and let it boot up. You will be asked to log in with the username and password you provided during installation. After that you should see a blank desktop.

(Note: In some cases, your VM may not launch due to the VMWare Tools installation breaking. See this link for slightly dated instructions on how to solve similar problems.)

Presuming you have successfully reached the Ubuntu desktop, look to the left launcher menu. All the way at the top, you should see an Ubuntu icon. Click on this, and start typing 'Terminal' in the search box. It should find a program called Terminal which is your main command prompt inside Ubuntu. Click this and you should get a fresh command prompt starting in your home directory.

Installing CogBuntu Start Terminal.png

How to Install OpenCog and its dependencies in a nutshell

There are numerous ways to install OpenCog. In short, the process consists of:

  • Getting the source code.
  • Installing dependencies for OpenCog to run.
  • Building OpenCog.

New instructions

These instructions should reflect a structural reorganization of code in OpenCog, done in May 2015. As of July 2015, they have worked for multiple new installations of Ubuntu 14.04.

  • Dependency edit on 11/11/15

First, you should prepare in your root directory or Desktop (or wherever) a main opencog directory (using mkdir). If you are interested in development rather than just having a working copy to toy around with, you should prepare a git branch instead of using git clone. Either way, you'll need to have git installed on your computer first.

cd ~ (or wherever you'd like this main directory to be)
mkdir OPENCOG (or whatever you'd like to call this main directory)
cd OPENCOG (you'll prepare all of your OpenCog repositories in here)
git clone https://github.com/opencog/opencog.git (retrieve the code from the three repositories)
git clone https://github.com/opencog/atomspace.git
git clone https://github.com/opencog/cogutil.git

Next, install the required dependencies. The recommended method is via ocpkg. You can find ocpkg and its instructions here:

https://github.com/opencog/ocpkg
  • Only ocpkg is compatible with switches. The rest appear to completely ignore them.

Then, you will install these three repositories in the following order: cogutil, atomspace, opencog.

cd cogutil
mkdir build
cd build
cmake ..
make -j6
**make -j6 test** (you can optionally run some tests)
sudo make install  (you'll be prompted for a password)
cd ../..    # to OPENCOG/
cd atomspace
mkdir build
cd build
cmake ..
make -j6
**make -j6 test** (the test is optional. You may get a few errors here -- we're working on that.)
sudo make install
cd ../..    # to OPENCOG/
cd opencog
mkdir build
cd build
cmake ..
make -j6
**make -j6 test** (optional, may also have a few errors.)
sudo make install

Then, if everything has worked, you should be able to run OpenCog's main client like so:

cd ~/OPENCOG/opencog/build (if you're not already there)
./opencog/cogserver/server/cogserver -c ../lib/opencog.conf to run the server

You'll need a new terminal window to operate the client (in which you'll work). So open one up and try

telnet localhost 17001

from which point you may (upon successful connection) type 'help' for more options.

Older instructions: First Steps for **expert** users: those familiar with git, Github, and Linux

These brief instructions are for expert users. If you are not an expert user, or any of the above terms are unfamiliar to you, skip to the next subsection.

OpenCog's source code is available from Github at: https://github.com/opencog/opencog

In order to quickly install all dependencies, you will need to run these series of commands.

git clone https://github.com/opencog/opencog.git
wget http://raw.github.com/opencog/ocpkg/master/ocpkg -O octool && chmod +rx octool && ./octool -rdpcal

Build OpenCog using the following commands after moving to the root of the git clone:

mkdir build
cd build
cmake ..
make -j$(nproc)
opencog/server/cogserver

You are now ready to play with OpenCog. Well, you will be. Installation tends to take several minutes.


To update your opencog's sub-project installations(cogutil, link-grammar and atomsapce), as they are in a continues state of development, you will need to run these series of commands, once/multiple times a week/day depending on what type of fun you are having with opencog

 wget http://raw.github.com/opencog/ocpkg/master/ocpkg -O octool && chmod +rx octool && ./octool -cal

Older instructions: First Steps For **non-expert** users: those unfamiliar with git, Github, or Linux

Please follow the section above for experts, these section hasn't been updated for a while, thanks

These lengthy instructions are for non-expert users. If you have already downloaded the OpenCog source and dependencies, skip to the next section.

In your terminal window, you should end up in your own home directory (~username). The steps we'll be going through are:

  • Download and run a script to install all the dependencies.
  • Download the Opencog source code and build it.
  • Make a local 'fork' of source code.
  • Build the code again.
  • Build and run the tests.

Installing the dependencies for OpenCog is a matter of running a script which will install all of them one by one. This script is the ocpkg script, which you will download.

First go to your home directory using this command:

cd ~

The command below downloads and installs all the required packages for Ubuntu 14.04, downloads the latest version of the OpenCog source files and compiles them. (Link verified as of December 7 2014)

wget http://raw.github.com/opencog/ocpkg/master/ocpkg && chmod ugo+rx ocpkg && ./ocpkg -v

You will be prompted for your administrator password in order to install dependencies.

This can take a while (depending on your computer / internet speed), and might prompt you to confirm (press 'y') that you're ok with the amount of diskspace some of the packages require. Once this is done it should tell you 'Libraries and tools for OpenCog installed' and will then move on to downloading and building the OpenCog source files.

At the end of the build process, it should tell you

[ocpkg] Exiting ocpkg normally...

You should now have a folder called 'opencog', containing a folder called 'src' with all the actual project files in it.

Dependency Notes for Troubleshooting

If you are not having trouble with your installation, please skip this section. Refer to it later if problems with embodiment arise.

It is possible that, if the code is currently mid maintenance cycle, a dependency might not yet be included with ocpkg. At the time of writing, ocpkg should successfully install a library called xerces 3.1 with which we have had some difficulties. The command for installing this dependency manually would be:

sudo apt-get install libxerces-c3.1 libxerces-c-dev

If necessary, xerces 2.x can be removed with:

sudo apt-get remove libxerces-c2-dev, libxerces-c28 and libxerces2-java

Common symptoms of an incorrect xerces installation include that, when building OpenCog, OpenCog reports the embodiment will NOT be built.

Rebase the source code to your own fork

'Rebasing source code to your own fork' is a common Github practice. If you're just downloading OpenCog to see what it does you can skip this step. If you want to know more about working with our open source community and contributing to OpenCog, see our guide at [Standards]

If already you have your own fork of the OpenCog source code (for example, through Creating your own fork of OpenCog), you should rebase the repository the ocpkg script created for you in ~/opencog/opencog to target your own fork.

If you need backwards compatibility with a test or tutorial

Some of the tutorials on this website still expect you to be working from a 'bin' folder inside the OpenCog folder, which no longer exists. If you find you need this folder, you can run the script below to create this folder along with the required symbolic links (folder redirections) so that the components that the system expects to exist under the bin folder will redirect to the built components in the 'build' folder.

First go to the root folder of OpenCog, which should be:

cd ~/opencog

And then run the script:

./scripts/createSymLinksOCPKG.sh

You should now find the backwards compatibility links in the 'build'.

Build and run the tests

To run the tests, go to your opencog/build folder (assuming your opencog folder is in your home directory ~):

cd ~/opencog/build

Prepare the makefiles:

cmake ..

The following command will run all the (unit) tests in the Opencog source to make sure everything will actually work like it should.

make test

Again, if you run into any fatal errors here, feel free to report the issue on GitHub.


You have now compiled OpenCog! Congratulations! Feel free to call friends and family now to inform them of your new career as an AI developer!

Q&A

Great, what now?

Now you have an OpenCog environment ready to work with!
Some other options for the motivated learner to look into are described below:
If your interest is genetic algorithms consider exploring the MOSES man commandline tool. The AtomSpace is CogPrime's central knowledge store and is one of OpenCog's most central features. Learning about it is essential to understanding the entire OpenCog architecture. DeSTIN is a sophisticated deep learning algorithm that is being applied to visual problems, so if your interest is machine vision this may be a great place to start. Some work has been done with Natural Language Processing and there is a collection of experiments related to this domain that you could explore. To get a better grasp of the whole system consider reading Building Better Minds.