DistributionNotFound error with pydev on external lib

222 views Asked by At

I am trying to do my first python program using an external Ckan library. I added the library and it seems to be working because the command import ckanap does not give me no errors. BUT when i try to run the program, i get this error

pkg_resources.DistributionNotFound: ckanapi

the full error message (if needed) is this

Finding files... done.
Traceback (most recent call last):
  File "/home/ilias/Programming/Eclipse/eclipse/plugins/org.python.pydev_4.1.0.201505270003/pysrc/pydev_runfiles.py", line 468, in __get_module_from_str
    mod = __import__(modname)
  File "/home/ilias/EclipseWorkspace/PythonFirst/root/nested/example.py", line 14, in <module>
    import ckanapi
  File "/home/ilias/Downloads/ckanapi-master/ckanapi/__init__.py", line 19, in <module>
    from ckanapi.remoteckan import RemoteCKAN
  File "/home/ilias/Downloads/ckanapi-master/ckanapi/remoteckan.py", line 11, in <module>
    from ckanapi.version import __version__
  File "/home/ilias/Downloads/ckanapi-master/ckanapi/version.py", line 3, in <module>
    __version__ = pkg_resources.require("ckanapi")[0].version
  File "/usr/lib/python3/dist-packages/pkg_resources.py", line 725, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python3/dist-packages/pkg_resources.py", line 628, in resolve
    raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: ckanapi
ERROR: Module: example could not be imported (file: /home/ilias/EclipseWorkspace/PythonFirst/root/nested/example.py).
Importing test modules ... done.
----------------------------------------------------------------------
Ran 0 tests in 0.000s
OK

I have search the internet about it, but the error is not much helpfull, let alone that i am complete newbie to python.

by the way, i get this error even with no commands at all, just with the import statement

Edit
Output of commandpython -c "import sys ; print( '\n'.join(sorted(sys.path)))"

/usr/lib/pymodules/python2.7
/usr/lib/python2.7
/usr/lib/python2.7/dist-packages
/usr/lib/python2.7/dist-packages/PILcompat
/usr/lib/python2.7/dist-packages/gtk-2.0
/usr/lib/python2.7/dist-packages/ubuntu-sso-client
/usr/lib/python2.7/lib-dynload
/usr/lib/python2.7/lib-old
/usr/lib/python2.7/lib-tk
/usr/lib/python2.7/plat-x86_64-linux-gnu
/usr/local/lib/python2.7/dist-packages
1

There are 1 answers

7
Fabio Zadrozny On

I think this is an installation issue with ckanapi...

It seems it has many dependencies: https://github.com/ckan/ckanapi/blob/master/requirements.txt

How did you install it? Have you tried pip install ckanapi?