Understanding Python Package Repository

Welcome to this lesson, to develops aplication using Python at least there 3 primary element which it you must know and certainly you will do if you truly will develops aplication which is not just ‘Hello Worl‘ aplication. What is..? first you must understand about Python Package.

On all progammin language there must be a concept which called with Package repository, probably the terms different, if on Java with Maven it has Java Package repository too, if on Visual Studio there .Net, if on WordPress there Plugin etc. The concept is you can reuse the Packages, soo your aplication directly has the features which the package have. As an example if you want to developos crawler aplication or data scarper on Python you just looking the Package which it called with ‘Python Beautifulsoup‘.Screenshot from 2017-09-04 14-48-11.png

By searching the package you can already doing simple Web Scraping.

Or on Desktop you can using Packahe which it called with ‘PyQt‘.Screenshot from 2017-09-04 14-52-08.png

That is Python framework most important framework to develops desktop aplication, commercial aplicationlike DropBox using this framework.

Then if on website you can using Django.Screenshot from 2017-09-04 14-59-48.png

or FlaskScreenshot from 2017-09-04 14-55-05.png

Django is the most complex Python package, complete, wort to learn.

While for mobile you can using KivyScreenshot from 2017-09-04 15-03-28.png

This package that makes you can develops aplication which it run on mobile or destop all platform.

That’s the breadth about Python package or if i show you the breadth again, you know about Raspberry Pi ..?pi2modb1gb_-comp

The Raspberry Pi is small device which often using for affairs Internet of Things (IoT), it develops use Python. So if you proficient about Python you can develops aplication which run in this device.

And.. many more, you can learn Python for machine learning and many more, but we back to our concept about Python packages repository.


Installing Pip

As you look there more website for the Packages, if you downloading to each one the website of course very troublesome. But indeed all the package listed on Pypi. All the package there on Pypy, like this example:

KivyScreenshot from 2017-09-04 15-20-47.png

or DJango
Screenshot from 2017-09-04 15-21-33.png

And of course unlikely you do searching on this website and then downloading and copying to your project. Well.. Python has tools which very usefull, the tool is ‘pip‘.

You can try it on windows or on Linux the same, example: type pip on your terminal:
Screenshot from 2017-09-04 15-26-13.png

If any result means already installed, but if not on Linux, type this command on your terminal:

sudo apt-get install python-pip

or if on Python 3:

sudo apt-get install python3-pip

For Ubuntu users usually already provide pip throug package, but usually default package not always up to date. Then there is best way to installing pip on windows or Linux is with using easy_install. But in windows already available, but if you’re Ubuntu users can do this command to install this package:


sudo apt-get install python-setuptools

or if Python 3:

sudo apt-get install python3-setuptools

after setuptools already installed you can call it with this command:

easy_install pip

or if Python 3:

easy_install3 pip

after already installed you can run this command:


or if Python 3:


So.. you can have Python 2 and 3 located on same system.

Installing Package

After pip installed, command which you will doing often is to show package already installed on system, run this command in your terminal to doing that:


pip list

Screenshot from 2017-09-04 15-43-04.png

There is more package already installed

And to installing Python package you  just run this command:

pip install nama_package

#misalnya flask
pip install flask

pip install django

#machine learning
pip install nltk

And if you want to uninstalling the package, just run this command:

pip uninstall nama_package

#misalnya flask
pip uninstall flask

And so are for the next command.

The problem is if you doing it, of course you must memorize and trying to guess what is the package name, this way probably not easy or familiar, then the best way is with using Pycharm.


Installing Package Using PyCharm

To showing in real use pip on Pycharm, as an example we will playing data scripting on Python with Beautifulsoup.

First open Beautifulsoup documentations, look at the quick start, we try to copy and paste to PycharmScreenshot from 2017-09-04 16-53-37.png

After copied, make new module on Python, the paste it on the new module:Screenshot from 2017-09-04 16-58-07.png

Ok.. ceck again Beautifulsoupthen copy this code:Screenshot from 2017-09-04 16-59-36.png

Then paste it again on PycharmScreenshot from 2017-09-04 17-01-13.png

If you try to look the code on the above, it will be complain beacuse we not yet installed the package. You can do as before manually search Beautifulsoup.Screenshot from 2017-09-04 17-06-14.png

But Pycharm smartly, just click on the package name on the code, You can click icon lamp or directly press on your keyboard ALT+ENTER.Screenshot from 2017-09-04 17-11-58.png

After installed, try to run it:Screenshot from 2017-09-04 17-13-50.png

Ok.. sufficient.. that is  just showing about convenience Pycharm to installing Python package which has not been installed on your system.

Ok.. thanks 🙂


Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout /  Ubah )

Foto Google

You are commenting using your Google account. Logout /  Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout /  Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout /  Ubah )

Connecting to %s