Reputation: 81
I am looking to use the Python-Instagram package. I have downloaded the package using the script that is provided on https://github.com/Instagram/python-instagram.
I have attempted one of the scripts that is provided. However, I get the same error: ImportError: No module named client
from instagram.client import InstagramAPI
access_token = "YOUR_ACCESS_TOKEN"
api = InstagramAPI(access_token=access_token)
recent_media, next_ = api.user_recent_media(user_id="userid", count=10)
for media in recent_media:
print media.caption.text
What is the module client and how can I install it? I have registered a client with IG.
Upvotes: 6
Views: 16789
Reputation: 4174
You may end up here like I did, and even by having
from InstagramAPI import InstagramAPI
and everything else correctly set I still got the error:
ImportError: No module named InstagramAPI
I was stupid enough to have InstagramAPI installed in one venv and was using another venv to run my project... dah
Upvotes: 2
Reputation: 334
Did you put the name "instagram" on the file? This might be your problem.
After seeing this link, which describes the same error, I realized my mistake.
Upvotes: 10
Reputation: 1360
I just had this same problem and it turned out that I had file named instagram.py in the same package as the file where I was getting this error. So, it was just a name collision. I renamed my local file and everything worked fine.
Upvotes: 3
Reputation: 2701
pip install python-instagram
(you may require administrator/sudo privileges for this)instagram
directory to your python's dist-package
directory or site-package
directory (whatever is relevant to you)You should then be able to import InstagramAPI with
from instagram.client import InstagramAPI
Upvotes: 2