4

I am trying to create a project in python using some libraries from GitHub that I found. I am using InstaPy and Instagram-API-python. My project structure is as follows

  • Project(main folder)
  • Instapy(sub-folder)
  • Instagram-API-python(sub-folder)
  • insta.py

How would I import both these into the insta.py file? I am new to python and not sure how the imports work.

1
  • did import instapy not work? What have you tried? Commented Aug 17, 2017 at 16:26

1 Answer 1

3

Don't copy them into your project folder, use pip to install them on your Python path.

But first, read about virtual environments.

Once you have your virtual environment set up and activated you can install the packages thus:

$ pip install git+https://github.com/timgrossmann/InstaPy.git $ pip install git+https://github.com/LevPasha/Instagram-API-python.git 

Then, in your python script just import them

from instapy import InstaPy import InstagramAPI 

and use them.

I followed these instructions and it (mostly) worked. It looks like InstagramAPI needs an executable installed (ffmpeg) which I'm not wanting to install on my laptop. It reports the error during the initial import.

I could definitely import instapy .. but notice that it is all lower case.
But since there is only the InstaPy class in the instapy module, it's best to simply import it this way.

More on InstaPy here: https://github.com/timgrossmann/InstaPy

Sign up to request clarification or add additional context in comments.

4 Comments

I did it like that and I still get the ImportError: No module named instapy error
Check their README's. They both have installation and usage instructions
@JohnDoe The READMEs are unreliable. Updated the instructions
@JohnDoe Don't install the package with pip... Just either download or clone the whole repository and follow the getting started instructions in the Readme from there... Still working on getting this thing easy to install using pip

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.