4

Installing CKAN locally on OSX 10.9, based on http://docs.ckan.org/en/latest/maintaining/installing/install-from-source.html.

I've created and activated the python virtualenv and now need to create a CKAN config file:

$ paster make-config ckan /etc/ckan/default/development.ini

The output is as follows (ImportError at the last line):

Distribution already installed:
      ckan 2.2 from ~/ckan/lib/default/src/ckan
    Traceback (most recent call last):
      File "/usr/lib/ckan/default/bin/paster", line 9, in <module>
        load_entry_point('PasteScript==1.7.5', 'console_scripts', 'paster')()
      File "/usr/lib/ckan/default/lib/python2.7/site-packages/paste/script/command.py", line 104, in run
        invoke(command, command_name, options, args[1:])
      File "/usr/lib/ckan/default/lib/python2.7/site-packages/paste/script/command.py", line 143, in invoke
        exit_code = runner.run(args)
      File "/usr/lib/ckan/default/lib/python2.7/site-packages/paste/script/appinstall.py", line 68, in run
        return super(AbstractInstallCommand, self).run(new_args)
      File "/usr/lib/ckan/default/lib/python2.7/site-packages/paste/script/command.py", line 238, in run
        result = self.command()
      File "/usr/lib/ckan/default/lib/python2.7/site-packages/paste/script/appinstall.py", line 295, in command
        self.distro, self.options.ep_group, self.options.ep_name)
      File "/usr/lib/ckan/default/lib/python2.7/site-packages/paste/script/appinstall.py", line 234, in get_installer
        'paste.app_install', ep_name)
      File "/usr/lib/ckan/default/lib/python2.7/site-packages/pkg_resources.py", line 2302, in load_entry_point
        return ep.load()
      File "/usr/lib/ckan/default/lib/python2.7/site-packages/pkg_resources.py", line 2029, in load
        entry = __import__(self.module_name, globals(),globals(), ['__name__'])
      File "~/ckan/lib/default/src/ckan/ckan/config/install.py", line 3, in <module>
        from pylons.util import PylonsInstaller
    ImportError: No module named pylons.util

I'm not sure how to proceed, any ideas?

dotlineform
  • 43
  • 1
  • 3

2 Answers2

10

ImportError: No module named pylons.util looks like Python cannot find the Pylons package, one of the Python packages that CKAN depends on. Two possibilities come to mind:

  1. Did you activate your CKAN virtualenv, before running the paster command? ~/ckan/default/bin/activate.

  2. Have you installed the Python packages that CKAN depends on into your virtualenv? With the virtualenv activated run pip install -r ~/ckan/default/src/ckan/requirements.txt

If you activate your CKAN virtual environment and then run pip freeze | grep pylons, this should tell you whether pylons is installed in the virtualenv.

The Distribution already installed: at the top of your terminal output is strange.

Sean Hammond
  • 12,550
  • 5
  • 27
  • 35
  • 2
    Right, no pylon. I’d overlooked an error in the `pip install -r …` which complained about not being able to get latest version of argparse. I hadn’t realised it had then aborted the whole install. Fixed by using --allow-all-external. Many thanks! – dotlineform Feb 23 '14 at 20:08
  • I got an argparse error as well which sounded like success but actually was an error halting the install. --allow-all-external did not help - warning: deprecated, now does nothing. Deleting argparse from global non-virtual environment /usr/lib/python2.7/argparse* allowed me to complete my pip install -r in the virtual env. Specific argparse error encountered: "Found existing installation: argparse 1.2.1 Not uninstalling argparse at /usr/lib/python2.7, outside environment /usr/lib/ckan/default" and finally "Successfully installed argparse-1.4.0" (success? no: pip freeze had no argparse) – Curtis Yallop Apr 03 '17 at 21:03
2

I had the same error and a slightly different solution:

  1. got the error only after using sudo, so I went out of it (sudo -k)
  2. then I got the following error: IOError: [Errno 13] Permission denied: '/etc/ckan/default/development.ini'
  3. after digging around a lot, I finally found out that while the /etc/ckan had correct permissions, it was actually a symlink to ~/ckan/etc and that folder did not have correct permissions
  4. I ran sudo chown -R `whoami` ~/ckan/etc and followed up with paster make-config ckan /etc/ckan/default/development.ini
LauriK
  • 1,899
  • 15
  • 20