Community Documentation

Installing an external library that is required by a contributed module

Last updated June 7, 2012. Created by tstoeckler on February 14, 2012.
Log in to edit this page.

If you want to install a contributed module, which depends on an external library, and also depends on the Libraries API module, you are on the right page.

Note that installing the Libraries API module and installing an external library are two separate steps, that are independent of each other.

In detail, the steps you need to follow are the following:

Install Libraries API

Install Libraries API just like you would any other contributed module. See this page for Drupal 6 and this page for Drupal 7.

Please note that, as is described on those pages, the Libraries API module directory should be inside the sites/all/modules directory (or sites/example.com/modules if you have a multi-site installation).

Install the external library

  1. Download the library
    The module that requires the external library should provide a link to the homepage of that library or, even better, directly to that library's download page. Sometimes the module will specify a version for you to download, otherwise just download the latest version.
  2. Extract the files
    If the file you downloaded is an archive, i.e. its file extension is .zip or .tar.gz, you will need to extract it first. On Windows, use a program like 7-zip to extract it. On the Mac, you can use Stuffit Expander. For *nix systems, use the command line: tar -zxvf modulename-drupalversionnumber.tar.gz. After extracting the file, you should see multiple files or a single folder with the library's name.
  3. Upload the library
    First you need to check if there is a sites/all/libraries directory (or sites/example.com/libraries if you have a multi-site installation) in your Drupal installation and, if not, create one. Then inside of that directory create a new directory with the Drupal machine name of the library. The machine name should be provided by the module that requires it, sometimes implicitly as in "Install the foo library!" (in that case the machine name would be foo). Upload the library files into the directory you have just created. If the library consists of a directory, which you have just extracted, upload the entire directory into the sites/all/libraries/machine_name directory.

Please note that, as is described above, the external library (unlike the Libraries API module) should be inside the sites/all/libraries directory (or sites/example.com/libraries if you have a multi-site installation).

The external library should not be in the sites/all/modules/libraries directory, which is the directory of Libraries API module (see above). This is a subtle, yet very important difference.

Install the other module

Now you should be able to install the module that requires the external library just like you installed Libraries API above, or as you would install any other contributed module.

Comments

D'oh!

I just spent three hours figuring out that sites/all/libraries isn't the same as sites/all/modules/libraries.

Liz
Stumbling along.

/sites/foo/libraries + /profile/foo/libraries

If not already - then ensure that /profiles/foo/libraries is supported too... not just /sites/foo/libraries as there are make Drush(make) based workflows that see sites as profiles (stepping outside the the whole multi-site /sites/x/.. structure) (see: here)

Web Deli™
www.webdeli.com.au
projects@webdeli.com.au
---------------------
About.Me

I think that is what you

I think that is what you meant by striking-through part of your comment, but just to make sure that there is no confusion: Yes, profiles/profile-name/libraries is supported, too.

Also a top-level libraries/ (next to the top-level modules/ and themes/) is supported as well, for distributions that want to ship with their own libraries. For 99% of users that should be irrelevant, though.

Yes! - I picked it up later.

Strike-through is because after I posted this I saw it is supported.. so I update comment accordingly.

Web Deli™
www.webdeli.com.au
projects@webdeli.com.au
---------------------
About.Me

external library .info files?

Does anybody have a more or less complete example of a .info file that would be included with an external library? From the documentation, it's not exactly clear what gets included from the external library.

Thanks in advance.

Dick Munroe

Richard Munroe
Cottage Software Works, Inc.
Our Motto: Cottage Software Works!

About this page

Drupal version
Drupal 6.x, Drupal 7.x
Level
Beginner
Audience
Site administrators

Develop for Drupal

Drupal’s online documentation is © 2000-2013 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution-ShareAlike 2.0. PHP code is distributed under the GNU General Public License. Comments on documentation pages are used to improve content and then deleted.
nobody click here