CKAN Install: paster error

2019-03-21 11:26发布

问题:

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?

回答1:

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.



回答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