title: Loading packages installed through 'package.el' in Emacs24
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/11127109/emacs-24-package-system-initialization-problems">Emacs 24 Package System Initialization Problems</a>  </p>
  </blockquote>
  
  
  
  <p>I am using Emacs 24. I have the ELPA and Marmalade repos added. Using 'package' I installed 'auto-complete'. I have the following lines added to my init.el:</p>
  
  <pre><code>(require 'auto-complete-config)
  (ac-config-default)
  </code></pre>
  
  <p>When I start Emacs, I get the error</p>
  
  <blockquote>
    <p>File error: Cannot open load file, auto-complete-config</p>
  </blockquote>
  
  <p>But then I use </p>
  
  <blockquote>
    <p>M-x load-file</p>
  </blockquote>
  
  <p>and load the same ~/.emacs.d/init.el file, it then works fine with the prompt saying</p>
  
  <blockquote>
    <p>Loading /home/user/.emacs.d/init.el (source)...done</p>
  </blockquote>
  
  <p>How is the usual loading different from the 'M-x load-file' command? In the start of the init.el file I do the following, is this somehow effecting the package from loading.</p>
  
  <blockquote>
    <p>(add-to-list 'load-path "~/.emacs.d") <br />
    (load "custom_code")</p>
  </blockquote>