Kariamoss
Kariamoss

Reputation: 552

PyCharm recognize a module but do not import it

I try to import the PyDrive module in my PyCharm project : from pydrive.auth import GoogleAuth. I tried different things :

Nothing works. Each time PyCharm recognize the module and even sugest the auto-completion, but when I run the project it keeps saying ImportError: No module named pydrive.auth

Any suggestion ?

EDIT : When I put directly the pydrive folder in my repository, and this time : ImportError: No module named httplib2 from the first import of PyDrive. My path is correct and httplib2 is again in my PyCharm project

Upvotes: 1

Views: 482

Answers (1)

amann
amann

Reputation: 369

After noticing that the module is already installed, both by pip and by the project interpreter, and nothing worked, this what did the trick (finaly!):

  1. make sure the module is indeed installed:

    sudo pip{2\3} install --upgrade httplib2

  2. locate the module on your computer:

    find / | grep httplib2

you will need to reach the place in which pip is installing the module, the path would probably look like this:

/usr/local/lib/python2.7/dist-packages

  1. get into the path specified there, search for the module and copy all the relevant files and folders into your local pycharm project environment. this will be a directory with a path like this:

    /home/your_user/.virtualenvs/project_name/lib/python2.7

this is it. note however you may need to do this multiple times, since each module may have a dependencies...

good luck!

Upvotes: 1

Related Questions