I just wasted a whole afternoon on this module. The module now requires that the api class be installed separately. This is not documented on the project page and none of the other documentation is updated. Only the release notes mention this and you don't see those when you are installing with drush.

Finally I found a mention of the make file and I tried to run it but it created the libraries folder in the module folder as there wasn't good documentation on how to use the included make command.

Then I moved the php class to the "sites/all/libraries/mailchimp" folder and on the reports screen of the site I still see an error message that the mail chimp class cannot be found.

MailChimp Not installed
You are missing MailChimp PHP wrapper class required to use the MailChimp module. Please download and install as a library.

I am sure it is in the right spot in the libraries folder and I have tried clearing my cache and disabling and enabling the mail chimp and libraries module and I cannot get this module to work for the first time.

When you take a library out of a module please put it in big bold red letters on the module page.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

alexander.sibert’s picture

I have exactly the same issue. I can not not use now Mailchimp.

iamcarrico’s picture

Priority: Major » Critical
Status: Active » Needs review
FileSize
1.35 KB

The issue is merely the check to see if the library is there does not have a not (!) in front of it. So, if you are seeing the error as it stands, it means you have it right.

I have a patch here that corrects that, as well as simplifies the make file for y'all. Moving this to critical as it will confuse the hell out of people. I would also recommend updating your module's page to reflect the changes of the MCAPI not being within the module any longer.

Heine’s picture

Note that you also need to move the README file into the libraries/mailchimp directory, or the version detection won't work and the library won't get registered.

a.ross’s picture

I made a dupe: #1884122: Put the MCAPI library in its own folder

This patch just fixes the error in the System Status page though. When you go to admin/config/services/mailchimp/lists you will still encounter an error.

a.ross’s picture

Oh sorry I was wrong about that. While debugging I moved the library files around a bit and that caused the issue. Indeed, the single negation fixes it.

a.ross’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
454 bytes

Made a patch with just this critical change, please commit this ASAP!

a.ross’s picture

The patch is in fact incorrect, because the test will pass even when the library is not installed properly. You have to use the "installed" array element for that. Attached a patch that does it correctly.

GOdev’s picture

Thanks, a.ross. That in combination with patch via #2 worked for me.

a.ross’s picture

Like I said, patches in #2 and in #6 are incorrect. Use #7

juliangb’s picture

I can confirm that this patch removes the error.

levelos’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
1.72 KB

Thanks everyone, sorry we missed that test in hook_requirements(). Here's a variation on the patch in #7 that provides a bit more functionality. Please review and we'll commit the fix.

Heine’s picture

Status: Needs review » Needs work

This is still missing documentation in README.txt and a good error message. "Install as a library" should indicate what files go where. Would you want example files on your server?

levelos’s picture

Status: Needs work » Needs review

@heine, the version detection is based on the README file provided when downloading and extracting the MCAPI library. There is no relevant README bundled with the module. I do agree the root README.txt should document the requirements, and I'll update accordingly. I'm also not clear about your question. What example files on what server?

Heine’s picture

Just extracting the linked package will get you an example directory. People need to know what files are necessary as most do not want examples on production because they are notorious for security holes.

mototribe’s picture

I downloaded the MCAPI.class.php from http://apidocs.mailchimp.com/api/downloads/mailchimp-api-class.zip and copied
it to sites/all/libraries/mailchimp.
I applied the patch, cleared the cache but still get error

PHP Fatal error: Class 'MCAPI' not found in ../sites/all/modules/mailchimp/includes/mailchimp.inc on line 3

levelos’s picture

Status: Needs review » Fixed

Just committed the following:

  • Adding a README file to the new activity module.
  • Updated installation instructions to account for downloading the external library.
  • Alter version pattern in mailchimp_libraries_info().
  • The patch to hook_requirements() in #7.
firfin’s picture

Dev version works fine for me. After clearing caches.
Thanks for the quick fix.

stewest’s picture

FYI: Be Careful - I used Dev module and lost the list. See http://drupal.org/node/1388722

fonant’s picture

Patch in #11 applied to 7.x-2.8 fixed the problem for me.

a.ross’s picture

The latest dev has this fix already. It should really be released as 2.9 ASAP, because it is a critical issue. Either that, or un-recommend 2.8 for the time being...

levelos’s picture

Just rolled a 7.x-2.9 release with the changes outlined in #16. Thanks for the help and support everyone.

bisonbleu’s picture

Well, I've just disabled, uninstalled , re-installed and re-enabled version 7.x-2.9 and I get the following message when trying to run update.php or calling Status report:

The MailChimp MCAPI library could not be found.

:-(

Tran’s picture

Error
MailChimp not found
The MailChimp MCAPI library could not be found

What should I do?

modctek’s picture

Getting the following error when trying to access my list settings or any page with the MailChimp subscribe block on it. Library has been installed. Something's still not right with 2.9.

Fatal error: Call to undefined function libraries_load() in /home/XXX/public_html/drupal-7/sites/all/modules/mailchimp/mailchimp.module on line 200

xaviersg’s picture

After installing 2.9 update, getting the same error. "The MailChimp MCAPI library could not be found."

Update, read and followed this installation note (apparently this needs to be redone for each new release 2.8+):
## Installation Notes
* You need to have a MailChimp API Key.
* You need to have at least one list created in MailChimp to use the
mailchimp_list module.
* For versions 7.x-2.8 and greater, the MCAPI library must be downloaded into
your libraries folder. IT's available at http://apidocs.mailchimp.com/api/downloads/mailchimp-api-class.zip
or by using the included example make file. Proper libraries structure:
- libraries
- mailchimp
- MCAPI.class.php
- README
The only required files are MCAPI.class.php and README.

Installation checks as correct now.

modctek’s picture

What I don't get was that my Mailchimp install was working fine with 2.8 without the library (at least I think it was working fine, never got an error). I upgraded to 2.9 using Drush, got the error, so went to get the API library. Installed it in /sites/all/libraries/mailchimp and still getting the error.

bisonbleu’s picture

#25 fixed it for me. Just needed to download the MCAPI library.

Perhaps the error message should mention this 'new' requirement and provide a link to the download page?

adshill’s picture

Version: 7.x-2.8 » 7.x-2.9
Status: Fixed » Needs work

I'm still getting this error message: "The version of the MailChimp MCAPI library could not be detected" using 7.x-2.9

Uninstalled, reinstalled and same result.

levelos’s picture

Status: Needs work » Fixed

Everyone who's still complaining about the module not working, read the release notes, documentation, and module requirements. To reiterate, the version 2.8 and greater of the module requires:

  • Version 2.0 or greater of the Libraries module. This requirement is dictated in the .info file.
  • Properly install the MCAPI class as instructed or using Drush.
lasseitorp’s picture

2.9 works fine for me on a single Drupal install, but gives my multi-site install the white screen of death!?!

Running the update script gives me this error:

Fatal error: Call to undefined function libraries_detect() in ../sites/all/modules/mailchimp/mailchimp.install on line 29

KD

a.ross’s picture

Ah, the update function doesn't seem to check for the existence of the libraries module. You should first install and enable that and then run the update again.

This issue is caused because libraries is a new dependency. I expected Core to handle that, but it apparently doesn't.

lasseitorp’s picture

Ahh... Stupid of me not to look!! Works fine now, thanks!

roborracle’s picture

Status: Fixed » Needs work

I followed the instructions in #25 (and the readme doc), downloaded and installed the library at sites/all/libraries/mailchimp and it's still not working. Same error as before:

Fatal error: Call to undefined function libraries_detect() in sites/all/modules/mailchimp/mailchimp.install on line 29

david387’s picture

Where can I find the MCAPI class installation instructions?

roborracle’s picture

I just rolled it back to 2.7. I don't have time for the craziness this morning. Not to say that the upgrades aren't great, just I don't have time to mess with it. Thank you contributors for what you do!

levelos’s picture

Status: Needs work » Fixed

@roborracle, I'm sorry you don't have time and this update caused you trouble, but please don't hijack this ticket and reopen it.

Metasequoia’s picture

@roborracle #33:

I had the same error message on a multi site installation. I deactivated all mailchimp module components, cleared the cache and run update.php. After that I copied the MCAPI library to my library folder as described in #25 and reactivated the module components. run update.php again and it worked!

StaceyF’s picture

Status: Fixed » Needs work

I'm just installing mailchimp for the first time (i.e. not updating an existing version) on a site and even after following the install instructions to the letter I still get this error message:

Fatal error: Call to undefined function libraries_detect() in sites/all/modules/mailchimp/mailchimp.install on line 29

This is what I've tried:

Attempt #1
Installing the MCAPI library (MCAPI.class.php and README) into a folder in sites/all/libraries called "mailchimp"
Enabling the module components in this order and one by one: MailChimp, MailChimp Activity, MailChimp Lists, MailChimp Campaigns
Clearing the cache

Attempt #2
Uninstalling and removing all mailchimp modules
Clearing the cache
Installing the MCAPI library (MCAPI.class.php and README) into a folder in sites/all/libraries called "mailchimp"
Enabling the module components in this order and one by one: MailChimp, MailChimp Activity, MailChimp Lists, MailChimp Campaigns
Clearing the cache

I've tried other various combinations of cache clearing at different points along the process but to no avail.

I've also just realized what I've done here is reopening a fixed ticket ("hijacking") and for that I apologise (my first time using the issue queue).

StaceyF’s picture

Status: Needs work » Fixed

Update: my problem was my libraries version. I already had libraries installed but it was V1. I assumed I had the correct libraries version installed but I didn't. I do apologise.

Druper’s picture

Is the Libraries Module referred to in #29 formally called Libraries API?

A search of 'Libraries" in modules with 7.x compatibility returns 643 results, none of which are named "Libraries" as far as I can tell. The fact that Libraries API has a 7.x-2.0 version leads me to believe that's the one but I don't want to install anything that may screw up my sites.

Thanks for the tip about checking the .info file for dependencies. I've never had to before and never would have thought of it on my own in a million years. I'm guessing that the (>=2) is the indicator of the version requirement.

Thanks for a great and very useful module.

a.ross’s picture

Yes, I meant libraries API.

@levelos, this should be documented in the README

vregouby’s picture

Just putting the #25 in the libraries directory does not work.

Is there a clean documentation somewhere that says :
Put the library in the libraries/mailchimp directory
deactivate module xxx
reactivate module xxx
do something else
So this can work ?

And do not upgrade this module without testing because it causes the white screen of death !

Konstantin Komelin’s picture

The same white screen. Rolled back to 2.7.

modctek’s picture

OK, I think I know what the problem is. The Libraries module is not reporting that it needs to be updated if you have 1.0 installed. Verifying this now.

Update: yup, if you are relying on drush or drupal's built-in reporting, the Libraries 1.0 module does not flag itself as needing an update. The new MailChimp must have v2.0.

cjamesrun’s picture

I have library 2 installed, and there wasn't any notification that I needed to install the Drupal API in the the libraries module at all. I was getting errors. So I found this thread. I installed the libraries but it won't update the lists from the server(s). (But that is likely for another thread.)

simondoyle’s picture

I was also getting errors, but installing the MCAPI library from here:
http://apidocs.mailchimp.com/api/downloads/mailchimp-api-class.zip
and installing to /sites/all/libraries/ as mailchimp (minus the examples subfolder)
and then updating libraries module to v2 fixed it all for me.
http://drupal.org/project/libraries
Libraries v1 doesn't report that it needs an update to v2, as mentioned above...

boon4376’s picture

I'd like to confirm that with Libraries API 2.0 I had this issue with a clean install of Mail Chimp's module.

No where except the README file does it indicate that you need to download and add the API... And don't people know by now that NO ONE reads README files? This is something that definitely needs to be a warning message upon module install (like how colorbox does it) - and at least on the module's page on drupal.org.

I solved my error message of

Fatal error: Class 'MCAPI' not found in [directory] on line 3

by doing the following:

1.) Uninstall mailchimp module completely
2.) Download the API libraries or whatever into the libraries/mailchimp folder in my drupal install
3.) Re-Install the module.

The Library must be added BEFORE installing the module. The problem is, if you are installing VIA URL, then you don't see the README file you don't see the files ever. There has to be a warning or notice somewhere... Most people don't use drush (or whatever it is).

adshill’s picture

For info - I also had problems with this and here is my fix:

The issue for me is with Multisite.

I was installing the library in /sites/all/libraries which is the standard for a multi-site. The module only recognises the item in /sites/default/libraries at this moment.

modctek’s picture

I have a multisite installation, but Mailchimp 2.9 is working fine with the API installed in /sites/all/libraries/mailchimp

rwhitehead’s picture

For others reading this post I was having the same issue, but fixed it by setting owner and group permissions to executable on the mailchimp directory under sites/all/library. This allowed the MCAPI.class.php file to be read by the webserver.

Z2222’s picture

Where does the required README file come from? It is mentioned in the site's README file.

I uploaded the class file to /sites/all/libraries/mailchimp, and put a blank README there, but it still wasn't working.

deverman’s picture

I have downloaded the new release of the module and it works to find the Mailchimp library. I however am still having the problem mentioned in #1894956: Existing MailChimp list not available when adding a list in Drupal 7.19 and MailChimp 2.9 where my lists don't show up even though I am now using the dev version of the module.

gcb’s picture

Status: Fixed » Closed (fixed)

The README has been updated in 7.x-2.10 to be extra clear about this, and we added an extra check during update to verify a correct version of libraries is installed, which should prevent the white screen folks were seeing if they had the 1.0 version of libraries.

Thanks for the detailed bug information everyone.

kanshin’s picture

Status: Closed (fixed) » Needs review

This is what worked for me in solving the issue after updating to MailChimp 2.10 from a previous version in an installation of Drupal 7.19 running on Windows 7:

- Disable all the MailChimp components (and Libraries, if you had installed it previously)
- Uninstall all the MailChimp components (and Libraries, if you had installed it previously). Delete the mailchimp (and the libraries) directory from the /sites/modules directory
- Download the MailChimp module, http://drupal.org/project/mailchimp
- Download the libraries module, http://drupal.org/project/libraries
- Download the current MailChimp MCAPI module, http://apidocs.mailchimp.com/api/downloads/#php (mailchimp-api-class.zip)
- In the administrator pages >> Modules >> Install new module, find the libraries-7.x-2.0.tar module and install it
- Enable the new Libraries module (it is located in the "OTHER" group)
- Unpack the same libraries-7.x-2.0.tar file and add it to /sites/all
- Create the mailchimp directory in your new /sites/all/libraries (/sites/all/libraries/mailchimp)
- Unpack the mailchimp-api-class.zip file and add its MCAPI.class php and readme.txt files to /sites/all/libraries/mailchimp directory
- Create a mailchimp directory in the /sites/modules/libraries and add the same MCAPI.class php and readme.txt files to the new /sites/modules/libraries/mailchimp directory
- In the administrator pages >> Modules >> Install new module, find the mailchimp-7.x-2.10.tar module and install it
- Enable MailChimp
- Go to Reports >> Status report, and in the MailChimp section you should see the "The MailChimp MCAPI wrapper library is installed correctly." message

a.ross’s picture

Title: Can't get module to recognize library » Fix for "Can't get module to recognize library"

Alright please stop re-opening this issue for support requests, it keeps coming up in my dashboard.

marysalome’s picture

Status: Needs review » Closed (fixed)

This was very helpful. Thank you!

Kiampp’s picture

Version: 7.x-2.9 » 7.x-2.10

I have no idea what I am doing wrong. I am using a fresh install of libraries and mailchimp and I did everything like in post #54. But I am still getting the error "The MailChimp MCAPI library could not be found." on the status report page.
Noticed I had libraries.7.x-2.1 version instead of the older 7.x-2.0 so I switched to that, but it still doesn't work.
All my modules automatically get installed in public_html/sites/all/modules/
I also tried adding both modules to public_html/modules/ but that was no help.

Anyone got any idea what I can do to fix it?

Kiampp’s picture

Never mind I got it to work.
I installed the MailChimp MCAPI module in the libraries folder in sites/all/modules but I had to make new libraries folder in sites/all.

Not really logical but ah well it works now.

a.ross’s picture

*self-redacted* ....

michaeldaly352’s picture

Hi
Am also running multisites
I got rid of the "The MailChimp MCAPI library could not be found" error when running update.php via
making a shortcut:
/sites/all/libraries
that linked to
/sites/all/modules/libraries

I have the two files , ie MCAPI.class.php and README,
as downloaded from http://apidocs.mailchimp.com/api/downloads/mailchimp-api-class.zip, in
/sites/all/modules/libraries/mailchimp/

This should not be necessary; possibly there is still an issue in:
/sites/all/modules/mailchimp/mailchimp.install
I will have to ensure the shortcut remains when updating drupal core

HTH

ressa’s picture

Thanks @kanshin. Un-installing mailchimp_lists mailchimp_campaign and mailchimp and reinstalling fixed it. I think your list is right, but you don't need this step:

- Create a mailchimp directory in the /sites/modules/libraries and add the same MCAPI.class php and readme.txt files to the new /sites/modules/libraries/mailchimp directory

I got it working without, and the message on the Reports page is: MailChimp 1.3 - The MailChimp MCAPI wrapper library is installed correctly.

I have just tested it, and I can send out Newsletters again. Remember that you have to "Add a list" again for each newsletter list, if you uninstalled since they are removed in the process. I was clicking on "Refresh lists from MailChimp" until I realized that the lists are created in Drupal :-)

paultrotter50’s picture

Thanks for taking the trouble to write this Kanshin - this method worked for me too

fkelly12054@gmail.com’s picture

Thanks also Kanshin ... after mucking with this for hours I went through your steps and they worked. Hard to believe that the "ultimate" solution requires putting the same files in two different spots though.

ressa’s picture

You don't need to do this step:

- Create a mailchimp directory in the /sites/modules/libraries and add the same MCAPI.class php and readme.txt files to the new /sites/modules/libraries/mailchimp directory

a.ross’s picture

The "ultimate solution" was full of mistakes, but anyway.

geidorei’s picture

Ok ultimate solution full of mistakes but...

Ive tried everything, still get server error, plus if I flush caches, i get website has encountered an error on front page.

Any suggestions appreciated.

a.ross’s picture

It is really pretty simple. All you need to do is to put the MCAPI files in this folder:
sites/all/libraries/mailchimp
Which is, by the way, the standard way of installing any library in Drupal.

barbarae’s picture

Lots of ideas have been shared about how to get the Mailchimp MCAPI library installed - and I too had put every piece in the right place before reading Kanshin's item #54 tonight.

Seems the real trick here is to put each piece in its' proper location in the correct sequence ! The library has to be in its' righful home prior to installing the Mailchimp module. At least that appears true to me since I had all the same code in the same folders (directories) prior to uninstalling all of it and then putting each piece back in the sequence described.

Thank you for taking the time to describe each step in detailed order.

LG - Life is Good when your Drupal module is a working right ;-)

l0calh0rst’s picture

http://apidocs.mailchimp.com/api/downloads/mailchimp-api-class.zip

That zip does not contain any file by the name "MCAPI.class.php". Only a folder "examples" and a readme.

I tried all other api packages in http://apidocs.mailchimp.com/api/downloads/#php but nothing seems to fit.

Very confusing.

konrad_u’s picture

I'm confirming #69. File MCAPI.class.php is no longer in the api package.

I've found this https://github.com/jbrooksuk/MCAPI-PHP
Downloaded and renamed MAPI.class.php to MCAPI.class.php -> cache-clear

Heaven't tested yet but the error is gone.

If somebody found direct download link to MCAPI.class.php post it here

l0calh0rst’s picture

Very weird... NOW the linked zip DOES contain a file 'MCAPI.class.php' again.

konrad_u’s picture

Good to know. They probably saw your post. I hope that solves everybody's problem.
10-4

cstalberg’s picture

Issue summary: View changes

To save others time installing the libraries correctly, be sure you have the following in sites/all/libraries/mailchimp

examples MCAPI.class.php README

Then, as instructed in the README file, manually enter the API key into sites/all/libraries/mailchimp/examples/inc/config.inc.php. Then and only then would drupal talk to Mailchimp and bring in my lists.

phelix’s picture

Where can i find the mailchimp v2 api that is already compiled? I am on pantheon so I can't compile and figure out this composer crap. I just need a MCAPI.class.php that is v2.. Does anyone have this????

alangallery’s picture

If you're using 7.x-3.x then the link for version 2 of the Mailchimp API class is in the module's readme:
https://bitbucket.org/mailchimp/mailchimp-api-php/downloads

[edit] You don't need to compile it, just copy it to your site's libraries folder and rename the folder to 'mailchimp'. Check the module readme to confirm the folder structure.

plato1123’s picture

Easily one of the most frustrating modules I've ever experienced on Drupal. I can hear the voices of friends who are developers echoing in my head. "Open source? You'll be sorrrrry!!!!"

gcb’s picture

@plato1123 this issue is long closed and resolved. Do you have a particular problem that you are struggling with, or just needed to vent? Are you using the version of the module that this issue refers to? (7.x-2.10) If so, that may be your problem. The Mailchimp API has been updated, which required the module to be updated as well. Please use the 7.x-4.8 version for any new setups with Drupal 7.

plato1123’s picture

Sorry to reopen this old issue, I did finally get it working although it took me at least a day to nail it down. Thanks for reaching out to me and I'll be more careful about reopening old issues. My message was more to the original poster who said he had burned an afternoon plus on this module as did I. Best!

gcb’s picture

Glad you got it sorted! If you have any suggestions for clarifying our documentation on the library issue, please let us know. Sometimes it's hard for us to tell where the ambiguity in the docs are, or where an important detail is easy to miss.