ckan / ckanapi

A command line interface and Python module for accessing the CKAN Action API
Other
176 stars 74 forks source link

Ckanapi: ImportError: No module named ckan.lib.cli #117

Closed jakubklimek closed 7 years ago

jakubklimek commented 7 years ago

I installed ckanapi (4.0.0) on the server where I have ckan installed (2.6.1), it is Debian 8, ckan installed using pip.

When I run "remote" commands, it works OK

(testing)klimek@xrg11:~$ ckanapi action package_list -r http://localhost:5221
[]

However, when I try to run local commands, it fails:

(testing)klimek@xrg11:~$ ckanapi action package_list -c /etc/ckan/testing/development.ini
Traceback (most recent call last):
  File "/usr/local/bin/ckanapi", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/dist-packages/ckanapi/cli/main.py", line 94, in main
    return _switch_to_paster(arguments)
  File "/usr/local/lib/python2.7/dist-packages/ckanapi/cli/main.py", line 141, in _switch_to_paster
    sys.exit(load_entry_point('PasteScript', 'console_scripts', 'paster')())
  File "/usr/local/lib/python2.7/dist-packages/paste/script/command.py", line 101, in run
    command = commands[command_name].load()
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2229, in load
    return self.resolve()
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2235, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/local/lib/python2.7/dist-packages/ckanapi/cli/paster.py", line 2, in <module>
    from ckan.lib.cli import CkanCommand
ImportError: No module named ckan.lib.cli
jakubklimek commented 7 years ago

OK, so the problem was I had ckanapi installed both outside and inside the virtual environment. Once I uninstalled ckanapi from outside the environment, it started working inside...

TkTech commented 7 years ago