cloudant / python-cloudant

A Python library for Cloudant and CouchDB
Apache License 2.0
163 stars 55 forks source link

Getting ImportError: No module named document for any cloudant import #323

Closed imutkarshpatil closed 7 years ago

imutkarshpatil commented 7 years ago

Hi, I'm trying to use cloudant-python library in my application, but I'm not able to import the library itself as I'm getting ImportError: No module named document as soon as I try to import anything from cloudant context. Following are details:

The error is as follows:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "cloudant.py", line 3, in <module>
    from cloudant.document import Document
ImportError: No module named document
tomblench commented 7 years ago

@imutkarshpatil I can't reproduce this.

Have you installed the library correctly with pip install cloudant?

You appear to be trying to use a dev version which is not supported.

imutkarshpatil commented 7 years ago

@tomblench

I tried with pip install cloudant, was receiving the same error so I uninstalled and tried with dev version by installing with pip install git+https://github.com/cloudant/python-cloudant.

Still the issue is the same.

tomblench commented 7 years ago

The latest released version should work; for example this test script works fine for me:

from cloudant.client import Cloudant
client = Cloudant("tomblench", "XXXX", account="tomblench", connect=True)
session = client.session()
print 'Username: {0}'.format(session['userCtx']['name'])
print 'Databases: {0}'.format(client.all_dbs())
imutkarshpatil commented 7 years ago

@tomblench issue is resolved as soon as I refreshed the session, duh!

tomblench commented 7 years ago

OK no problem 😄

edwardstudy commented 6 years ago

I just set export PYTHONPATH=/usr/local/lib/python2.7/site-packages which cloudant lib exists.