Install ERPNext/Frappe on Ubuntu 22.04

Read: https://docs.frappe.io/framework/user/en/installation#debian-ubuntu

Update your system’s package index

if not exist, Install/update gitpython, and redis

Check:

Now, edit the MariaDB configuration file (this step is not required for Frappe v15.21.0 or above).

And add this configuration

Now, just restart the MariaDB service and you are good to go.

Check Node or Install Node if not exist

Use node > 18. use the stable version (v20..) instead

Check:

Finally, check/install yarn using npm

Install the libraries for wkhtmltopdf

Download and install wkhtmltopdf package from https://wkhtmltopdf.org/downloads.html, then run this command to install the package. As an example for Ubuntu 22.04 amd64 in Download directory

if you found this error: Package xfonts-75dpi is not installed. then run this to install the dependencies

Install Bench CLI
Install bench via pip (or pip3)
[codesyntax lang=”bash”]

[/codesyntax]

Note: WARNING: The script bench is installed in ‘/home/satria/.local/bin’ which is not on PATH.
So run –> THIS IS NOT SAVED BECAUSE WHEN I TRIED TO LOGIN AGAIN, THE PATH IS MISSING
[codesyntax lang=”bash”]

[/codesyntax]

 

Check ‘Bench’ version
[codesyntax lang=”bash”]

[/codesyntax]

Read: https://docs.frappe.io/framework/user/en/tutorial/install-and-setup-bench
Create frappe-bench directory
Let’s create our project folder which will contain our apps and sites. Run the following command: bench init frappe-bench in my projects directory
[codesyntax lang=”bash”]

[/codesyntax]
Note: make sure to use node > = v18…

Let’s fix the installation problem:
1. [codesyntax lang=”bash”]

[/codesyntax]
pls go to ‘apps/frappe’ directory (here is the complete path: /home/satria/Documents/projects/frappe-bench/apps/frappe) then run ‘npx update-browserslist-db@latest’
[codesyntax lang=”bash”]

[/codesyntax]
2. WARN Cannot connect to redis_cache to update assets_json

the redis service is running:
sudo systemctl status redis
[sudo] password for satria:
● redis-server.service – Advanced key-value store
Loaded: loaded (/lib/systemd/system/redis-server.service; enabled; vendor >
Active: active (running) since Wed 2025-05-14 13:49:23 WIB; 16min ago
Docs: http://redis.io/documentation,
man:redis-server(1)
Main PID: 1390 (redis-server)
Status: “Ready to accept connections”
Tasks: 5 (limit: 57560)
Memory: 5.2M
CPU: 1.714s
CGroup: /system.slice/redis-server.service
└─1390 “/usr/bin/redis-server 127.0.0.1:6379” “” “” “” “” “” “” “”>

Mei 14 13:49:23 teddy systemd[1]: Starting Advanced key-value store…
Mei 14 13:49:23 teddy systemd[1]: Started Advanced key-value store.

here is the content of sites/common_site_config.json:
{
“background_workers”: 1,
“file_watcher_port”: 6787,
“frappe_user”: “satria”,
“gunicorn_workers”: 17,
“live_reload”: true,
“rebase_on_pull”: false,
“redis_cache”: “redis://127.0.0.1:13000”,
“redis_queue”: “redis://127.0.0.1:11000”,
“redis_socketio”: “redis://127.0.0.1:13000”,
“restart_supervisor_on_update”: false,
“restart_systemd_on_update”: false,
“serve_default_site”: true,
“shallow_clone”: true,
“socketio_port”: 9000,
“use_redis_auth”: false,
“webserver_port”: 8000
}

SO the redis server used PORT 13000 instead of PORT 6379. CHANGED THE PORT FOR redis_cache, redis_queue and redis_socketio to port 6379 in sites/common_site_config.json. So now the content is:
[codesyntax lang=”text”]

[/codesyntax]

Test the redis server for 6379 port
[codesyntax lang=”bash”]

[/codesyntax]

Start the Bench Server
Now that we have created our frappe-bench directory, we can start the Frappe web server by running the following command: bench start

[codesyntax lang=”bash”]

[/codesyntax]

Note: Type CTRL+C to stop the bench engine

It can be opened on http://127.0.0.1:8000/ or http://192.168.1.23:8000
but the app still empty!

So Create an App
Read: https://docs.frappe.io/framework/user/en/tutorial/create-an-app
Case study: Library Management System

To create our Library Management app, run the new-app command:

You should get some prompts, and output like the following. You can enter information manually, or press enter to select the defaults

[codesyntax lang=”bash”]

[/codesyntax]

You will be prompted with details of your app, fill them up and an app named library_management will be created in the apps folder.

Create A Site
Read: https://docs.frappe.io/framework/user/en/tutorial/create-a-site

Run : bench new-site library.localhost
[codesyntax lang=”bash”]

[/codesyntax]
the admin password is Teddy@123

This command will create a new database, so you need to enter your MariaDB root password. It will also ask to set the password for the Administrator user, just set a password that you won’t forget. This will be useful later.

Now, you will have a new folder named library.localhost in the sites directory.

If site creation fails for any reason, you’ll be prompted to roll back the changes. This will delete the library.localhost or equivalent in your sites directory, and delete the database/user that was created. This will allow you to easily retry without having to manually cleanup the unusable site.

the new database (_5b0e23f4238e31a0), user and password can be seen in sites/library.localhost/site_config.json

Now you can open the site http://library.localhost:8000/ on your browser
Note: make sure to run ‘bench start’ first in the frappe-bench directory

The login page will be displayed:
username: Administrator
password: Teddy@123
This user also can be found in the database (tabUser table)

Then install app on site
[codesyntax lang=”bash”]

[/codesyntax]

To confirm if the app was installed, run the following command:
[codesyntax lang=”bash”]

[/codesyntax]

then run ‘bench start’ again!

I found some glitch on the frontend.
for example on http://library.localhost:8000/login, i found these errors related to css on the console:
Failed to load resource: the server responded with a status of 404 (NOT FOUND) -> http://library.localhost:8000/assets/frappe/dist/css/login.bundle.O2AXXQ4F.css
I can’t find the file but I found this file:
sites/assets/frappe/dist/css/login.bundle.M242FIII.css
–> NEED TO RESTART bench server (stop bench then run again bench start). then refresh the browser

but after the login, i found another frontend glitch:
GET http://library.localhost:8000/assets/frappe/dist/css/desk.bundle.5EPJH5Z3.css net::ERR_ABORTED 404 (NOT FOUND) -> http://library.localhost:8000/assets/frappe/dist/css/desk.bundle.5EPJH5Z3.css

GET http://library.localhost:8000/assets/frappe/dist/css/report.bundle.7F2GVCHL.css net::ERR_ABORTED 404 (NOT FOUND) -> http://library.localhost:8000/assets/frappe/dist/css/report.bundle.7F2GVCHL.css

–> READ THE WARNING MESSAGE:
WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add ‘vm.overcommit_memory = 1’ to /etc/sysctl.conf and then reboot or run the command ‘sysctl vm.overcommit_memory=1’ for this to take effect. –> So fix it as requested! then restart bench (bench start)
Open http://library.localhost:8000/app/ -> should be working and run the app install wizard
email: advcha@yahoo.com
pass: Teddy@123

Create a DocType
Read: https://docs.frappe.io/framework/user/en/tutorial/create-a-doctype
DocType is analogous to a Model in other frameworks. Apart from defining properties, it also defines the behavior of the Model.

Enable Developer Mode
Before we can create DocTypes, we need to enable developer mode on our bench. This will enable boilerplate creation when we create doctypes and we can track them into version control with our app.

Go to your terminal and quit the bench server if it’s already running then from the frappe-bench directory, run the following command:

Creating a DocType

While in Desk, navigate to the DocType List using the Awesomebar. This list will include DocTypes bundled with the framework, those that are a part of the installed Frappe apps and custom ones, which you can create specific to each site.

The first doctype we will create is Article. To create it, click on New.
-> http://library.localhost:8000/app/doctype/view/list then click ‘+Add DocType’ button on the top right

  1. Enter Name as Article
  2. Select Library Management in Module

Then click ‘Create & Continue’ button
then Go to http://library.localhost:8000/app/doctype
then select ‘Article’

  1. Add the following fields in the Fields table: (Better use ‘Form’ tab)
    1. Article Name (Data, Mandatory)
    2. Image (Attach Image)
    3. Author (Data)
    4. Description (Text Editor)
    5. ISBN (Data)
    6. Status (Select) – Enter two options: Issued and Available (Type Issued, hit enter, then type Available)
    7. Publisher (Data)

Refer the following images to check how it should be done:
Form tab

Naming tab

Setting tab

Field tab (usually populated from the Form tab entries)

After adding the fields, click on Save.

You will see a Go to Article List button at the top right of the form. Click on it to go to the Article List. Here you will see a blank list with no records because the table has no records.

Let’s create some records. But before that, we need to clear the Desk cache. Click on the Settings dropdown on the right side of the navbar and click on Reload.

Click ‘Go to Article List’ button (http://library.localhost:8000/app/article)
then click ‘Add Article’ button

The github gave me much headeache
[codesyntax lang=”bash”]

[/codesyntax]

Python and Streamlit on Ubuntu 22.04

Check the installed python

satria@teddy:~$ pip -V
pip 22.0.2 from /usr/lib/python3/dist-packages/pip (python 3.10)

it seems I already installed python 3. but when I want to find out the location with ‘whereis python’, it showed up nothing

satria@teddy:~$ whereis python
python:

so use ‘whereis python3’ instead

satria@teddy:~$ whereis python3
python3: /usr/bin/python3 /usr/lib/python3 /etc/python3 /usr/share/python3 /usr/share/man/man1/python3.1.gz

I need to symlink python 3 to use just ‘python’ like this
satria@teddy:~$ sudo ln -s /usr/bin/python3 /usr/bin/python

then I can use like this
satria@teddy:~$ whereis python
python: /usr/bin/python

Install streamlit with python3 virtual environment (venv)
ref: https://docs.streamlit.io/get-started/installation/command-line

create a new directory.  for  example ‘streamlit’
satria@teddy:~$ cd Documents/projects/python/streamlit/

then go into the dir. make sure you already have python3-venv package. if not install it
satria@teddy:~/Documents/projects/python/streamlit$ sudo apt install python3.10-venv

then use python3-venv like this:
satria@teddy:~/Documents/projects/python/streamlit$ python -m venv .venv

Activate the virtual environment
satria@teddy:~/Documents/projects/python/streamlit$ source .venv/bin/activate
(.venv) satria@teddy:~/Documents/projects/python/streamlit$

install streamlit with pip in the venv
(.venv) satria@teddy:~/Documents/projects/python/streamlit$ pip install streamlit
Collecting streamlit
Using cached streamlit-1.41.1-py2.py3-none-any.whl (9.1 MB)
Collecting click<9,>=7.0
Downloading click-8.1.8-py3-none-any.whl (98 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 98.2/98.2 KB 915.4 kB/s eta 0:00:00
Collecting tornado<7,>=6.0.3
Using cached tornado-6.4.2-cp38-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (437 kB)
Collecting packaging<25,>=20
Using cached packaging-24.2-py3-none-any.whl (65 kB)
Collecting requests<3,>=2.27
Using cached requests-2.32.3-py3-none-any.whl (64 kB)
Collecting pydeck<1,>=0.8.0b4
Using cached pydeck-0.9.1-py2.py3-none-any.whl (6.9 MB)
Collecting numpy<3,>=1.23
Using cached numpy-2.2.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (16.4 MB)
Collecting gitpython!=3.1.19,<4,>=3.0.7
Using cached GitPython-3.1.44-py3-none-any.whl (207 kB)
Collecting toml<2,>=0.10.1
Using cached toml-0.10.2-py2.py3-none-any.whl (16 kB)
Collecting cachetools<6,>=4.0
Using cached cachetools-5.5.0-py3-none-any.whl (9.5 kB)
Collecting pandas<3,>=1.4.0
Using cached pandas-2.2.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (13.1 MB)
Collecting blinker<2,>=1.0.0
Downloading blinker-1.9.0-py3-none-any.whl (8.5 kB)
Collecting altair<6,>=4.0
Using cached altair-5.5.0-py3-none-any.whl (731 kB)
Collecting watchdog<7,>=2.1.5
Using cached watchdog-6.0.0-py3-none-manylinux2014_x86_64.whl (79 kB)
Collecting pyarrow>=7.0
Using cached pyarrow-19.0.0-cp310-cp310-manylinux_2_28_x86_64.whl (42.1 MB)
Collecting typing-extensions<5,>=4.3.0
Using cached typing_extensions-4.12.2-py3-none-any.whl (37 kB)
Collecting pillow<12,>=7.1.0
Downloading pillow-11.1.0-cp310-cp310-manylinux_2_28_x86_64.whl (4.5 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.5/4.5 MB 14.1 MB/s eta 0:00:00
Collecting protobuf<6,>=3.20
Using cached protobuf-5.29.3-cp38-abi3-manylinux2014_x86_64.whl (319 kB)
Collecting rich<14,>=10.14.0
Using cached rich-13.9.4-py3-none-any.whl (242 kB)
Collecting tenacity<10,>=8.1.0
Using cached tenacity-9.0.0-py3-none-any.whl (28 kB)
Collecting jsonschema>=3.0
Using cached jsonschema-4.23.0-py3-none-any.whl (88 kB)
Collecting narwhals>=1.14.2
Using cached narwhals-1.22.0-py3-none-any.whl (297 kB)
Collecting jinja2
Using cached jinja2-3.1.5-py3-none-any.whl (134 kB)
Collecting gitdb<5,>=4.0.1
Using cached gitdb-4.0.12-py3-none-any.whl (62 kB)
Collecting pytz>=2020.1
Downloading pytz-2024.2-py2.py3-none-any.whl (508 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 508.0/508.0 KB 5.5 MB/s eta 0:00:00
Collecting tzdata>=2022.7
Using cached tzdata-2024.2-py2.py3-none-any.whl (346 kB)
Collecting python-dateutil>=2.8.2
Using cached python_dateutil-2.9.0.post0-py2.py3-none-any.whl (229 kB)
Collecting certifi>=2017.4.17
Downloading certifi-2024.12.14-py3-none-any.whl (164 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 164.9/164.9 KB 12.2 MB/s eta 0:00:00
Collecting urllib3<3,>=1.21.1
Downloading urllib3-2.3.0-py3-none-any.whl (128 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 128.4/128.4 KB 12.5 MB/s eta 0:00:00
Collecting idna<4,>=2.5
Downloading idna-3.10-py3-none-any.whl (70 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 70.4/70.4 KB 14.6 MB/s eta 0:00:00
Collecting charset-normalizer<4,>=2
Using cached charset_normalizer-3.4.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (146 kB)
Collecting pygments<3.0.0,>=2.13.0
Using cached pygments-2.19.1-py3-none-any.whl (1.2 MB)
Collecting markdown-it-py>=2.2.0
Using cached markdown_it_py-3.0.0-py3-none-any.whl (87 kB)
Collecting smmap<6,>=3.0.1
Using cached smmap-5.0.2-py3-none-any.whl (24 kB)
Collecting MarkupSafe>=2.0
Downloading MarkupSafe-3.0.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (20 kB)
Collecting referencing>=0.28.4
Using cached referencing-0.36.1-py3-none-any.whl (26 kB)
Collecting jsonschema-specifications>=2023.03.6
Using cached jsonschema_specifications-2024.10.1-py3-none-any.whl (18 kB)
Collecting rpds-py>=0.7.1
Using cached rpds_py-0.22.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (381 kB)
Collecting attrs>=22.2.0
Using cached attrs-24.3.0-py3-none-any.whl (63 kB)
Collecting mdurl~=0.1
Using cached mdurl-0.1.2-py3-none-any.whl (10.0 kB)
Collecting six>=1.5
Downloading six-1.17.0-py2.py3-none-any.whl (11 kB)
Installing collected packages: pytz, watchdog, urllib3, tzdata, typing-extensions, tornado, toml, tenacity, smmap, six, rpds-py, pygments, pyarrow, protobuf, pillow, packaging, numpy, narwhals, mdurl, MarkupSafe, idna, click, charset-normalizer, certifi, cachetools, blinker, attrs, requests, referencing, python-dateutil, markdown-it-py, jinja2, gitdb, rich, pydeck, pandas, jsonschema-specifications, gitpython, jsonschema, altair, streamlit
Successfully installed MarkupSafe-3.0.2 altair-5.5.0 attrs-24.3.0 blinker-1.9.0 cachetools-5.5.0 certifi-2024.12.14 charset-normalizer-3.4.1 click-8.1.8 gitdb-4.0.12 gitpython-3.1.44 idna-3.10 jinja2-3.1.5 jsonschema-4.23.0 jsonschema-specifications-2024.10.1 markdown-it-py-3.0.0 mdurl-0.1.2 narwhals-1.22.0 numpy-2.2.2 packaging-24.2 pandas-2.2.3 pillow-11.1.0 protobuf-5.29.3 pyarrow-19.0.0 pydeck-0.9.1 pygments-2.19.1 python-dateutil-2.9.0.post0 pytz-2024.2 referencing-0.36.1 requests-2.32.3 rich-13.9.4 rpds-py-0.22.3 six-1.17.0 smmap-5.0.2 streamlit-1.41.1 tenacity-9.0.0 toml-0.10.2 tornado-6.4.2 typing-extensions-4.12.2 tzdata-2024.2 urllib3-2.3.0 watchdog-6.0.0

test it by typing ‘streamlit hello’

(.venv) satria@teddy:~/Documents/projects/python/streamlit$ streamlit hello

👋 Welcome to Streamlit!

If you’d like to receive helpful onboarding emails, news, offers, promotions,
and the occasional swag, please enter your email address below. Otherwise,
leave this field blank.

Email: your_email@yahoo.com

You can find our privacy policy at https://streamlit.io/privacy-policy

Summary:
– This open source library collects usage statistics.
– We cannot see and do not store information contained inside Streamlit apps,
such as text, charts, images, etc.
– Telemetry data is stored in servers in the United States.
– If you’d like to opt out, add the following to ~/.streamlit/config.toml,
creating that file if necessary:

[browser]
gatherUsageStats = false

Welcome to Streamlit. Check out our demo in your browser.

Local URL: http://localhost:8501
Network URL: http://192.168.1.23:8501

Ready to create your own Python apps super quickly?
Head over to https://docs.streamlit.io

May you create awesome apps!

it’d open http://localhost:8501 on the browser.

Create new app and run it
In your project directory (/home/satria/Documents/projects/python/streamlit) that exist .venv file, create a new file ‘app.py’

[codesyntax lang=”python”]

[/codesyntax]
then run it.
note: pls make sure you’re already in the virtual environment (venv). if not type ‘source .venv/bin/activate’ to activate it. then run it by typing ‘streamlit run app.py’:
satria@teddy:~/Documents/projects/python/streamlit$ source .venv/bin/activate
(.venv) satria@teddy:~/Documents/projects/python/streamlit$ streamlit run app.py

You can now view your Streamlit app in your browser.

Local URL: http://localhost:8501
Network URL: http://192.168.1.23:8501

it’ll open it on your browser and printed ‘Hello World’

….

if you already finished, you can stop the streamlit app with ctrl+c and deactivated the venv
^C Stopping…
(.venv) satria@teddy:~/Documents/projects/python/streamlit$ deactivate
satria@teddy:~/Documents/projects/python/streamlit$

Install Django on Ubuntu 16.04

Ref: https://tecadmin.net/install-django-on-ubuntu/

Check python3 (no need python2) version and pip3 version

I need to upgrade pip with this command (must with sudo)

but when I checked the newest installed pip, I got this

SOLUTION: https://askubuntu.com/questions/1034018/problem-in-installing-pip-in-ubuntu-16-04
So I need to do this after the upgrade:

Install Django (NO) — USE VIRTUALENV INSTEAD (http://myprojects.advchaweb.com/index.php/2018/01/24/ubuntu-16-04-3-installation-problem-and-solution/)

USE VIRTUALENV

Go to ‘djangotest’ directory and run migration if exist

RUN SERVER

OPEN IT ON YOUR BROWSER: http://localhost:8000/
LOGIN ADMIN
http://localhost:8000/admin/login/?next=/admin/CREATE SUPERUSER FOR ADMIN

so superuser:
username: admin
password: admin123

THEN LOGIN TO ADMIN AGAIN WITH THIS SUPERUSER ACCOUNT. HERE IS THE ADMIN DASHBOARDDEACTIVATE

 

INSTALL NEWEST DJANGO (VERSION 2.2) WITH VIRTUALENV ‘django2.2’

CHECK THE DJANGO VERSION

CREATE DJANGO APP PROJECT ‘django_app’

Goto the project directory and migrate

CREATE SUPERUSER ACCOUNT

so superuser:
username: admin
password: admin123

RUN DJANGO SERVER

OPEN: http://localhost:8000/THE ADMIN (http://localhost:8000/admin/) HAS SAME ACCOUNT AND DISPLAY

CREATE POLLS APP
ref: https://docs.djangoproject.com/en/2.2/intro/tutorial01/
Go to the ‘django_app’ directory:

activate the virtualenv ‘django2.2’ then go to the project directory

create ‘polls’ app

That’ll create a directory polls, which is laid out like this:

Write your first view
Let’s write the first view. Open the file polls/views.py and put the following Python code in it:

This is the simplest view possible in Django. To call the view, we need to map it to a URL – and for this we need a URLconf.

To create a URLconf in the polls directory, create a file called urls.py. Then Open the file polls/urls.py

The next step is to point the root URLconf at the polls.urls module. In django_app/urls.py, add an import for django.urls.include and insert an include() in the urlpatterns list, so you have:

Then run the server

open: http://localhost:8000/polls/
NOTE: BUT I GOT AN ERROR IF I OPEN http://localhost:8000/

 

CNN and TensorFlow For Recognizing Dogs and Cats

Reference: https://blog.keras.io/building-powerful-image-classification-models-using-very-little-data.html
https://github.com/abnera/image-classifier
https://github.com/abnera/image-classifier/blob/master/code/fine_tune.py
http://www.subsubroutine.com/sub-subroutine/2016/9/30/cats-and-dogs-and-convolutional-neural-networks

NOTE: THIS MAY BE MISLEADING BECAUSE I CAN’T USE TENSORFLOW AS HERE BUT THEANO ALTHOUGH I INTEND TO USE TENSORFLOW. PLS READ THE REST WHY.

  1. Make sure keras and tensorflow already installed.
  2. Download the data needed from Kaggle’s Dogs vs Cats. Download train.zip dan test1.zip
  3. Create a new directory ‘dogs-vs-cats-tf’
    Then in the ‘dogs-vs-cats-tf’ directory create a new directory ‘data’
    then in ‘data’ directory, create a few new dirs ‘train/dogs’, ‘train/cats’, ‘validation/dogs’ and ‘validation/cats’.
  4. The first time to use keras and tensorflow, I just want to use 1000 samples for each class (1000 samples for dogs and 1000 samples for cats. although the original dataset had 12,500 cats and 12,500 dogs) for the training. We’d put them in their respective directories (data/train/dogs and data/train/cats).
    Then we use additional 400 samples for each class as validation data, to evaluate our models. We’d put them in their respective directories (data/validation/dogs and data/validation/cats).
    Here are the clear instruction:
    – cat pictures index 0-999 in data/train/cats
    – cat pictures index 1000-1399 in data/validation/cats
    – dogs pictures index 0-999 in data/train/dogs
    – dog pictures index 1000-1399 in data/validation/dogs

     
  5. in ‘dogs-vs-cats-tf’ directory, create a new python file ‘dogs-vs-cats1.py’. Here is the content (ref: https://gist.github.com/fchollet/0830affa1f7f19fd47b06d4cf89ed44d).

     
  6. Run the python file.
    NOTE: In http://myprojects.advchaweb.com/index.php/2017/02/22/installation-of-opencv-keras-and-tensorflow-on-ubuntu-14-04/, I use virtualenv ‘opencv_keras_tf’ and installed keras and tensorflow there. Use the virtualenv! The first time I forgot to use the virtualenv then I got this error when I tried to run the python file

    The error ‘ImportError: No module named keras.preprocessing.image’ because I ONLY install keras in virtualenv ‘opencv_keras_tf’ NOT GLOBALLY!
    OK. Use virtualenv ‘opencv_keras_tf’ then run the python file.


    I GOT AN ERROR: ‘ValueError: Negative dimension size caused by subtracting 2 from 1’
    SOLUTION: Modify keras.json and replace ‘tf’ in ‘image_dim_ordering’ to ‘th’ (WHY ‘tf’ DIDN’T WORK???)

    SO HERE IS THE CONTENT OF ~/.keras/keras.json

     

    RUN AGAIN (IT’S WORKING NOW):
    START AT 2017-02-24 10:08PM


    NOTE: Read this about CUDA compute capability : http://stackoverflow.com/questions/10961476/what-are-the-differences-between-cuda-compute-capabilities
    IT SEEMS DEPEND ON THE HARDWARE! NOTHING CAN DO TO IMPROVE THE COMPUTE CAPABILITY!
    AFTER READING THIS https://www.tensorflow.org/versions/r0.10/get_started/os_setup#installing_from_sources AND http://stackoverflow.com/questions/38542763/how-can-i-make-tensorflow-run-on-a-gpu-with-capability-2-0, I GOT SAD NEWS THAT
    In order to build or run TensorFlow with GPU support, both NVIDIA’s Cuda Toolkit (>= 7.0) and cuDNN (>= v3) need to be installed.
    TensorFlow GPU support requires having a GPU card with NVidia Compute Capability >= 3.0.
    SO MY GPU GeForce GT 520M THAT ONLY HAS CUDA COMPUTE CAPABILITY 2.1(REF: https://en.wikipedia.org/wiki/CUDA) CAN’T BE USED FOR TENSORFLOW!!!I ONLY CAN USE CPU!!!
    I STOPPED AFTER THE 3rd EPOCH (2017-02-14 10:39) BECAUSE I HAVE GOT ANOTHER THING TO DO. HOPEFULLY CAN RESUME THIS TOMORROW.
    I DID IT AGAIN!

    START AT 2017-02-25 08:45PM AND END AT 2017-02-26 03:45AM. SO THE TRAINING PROCESS RUN FOR 7 HOURS!!! AND THE ACCURACY IS 88.15%???
    AND AT THE END I GOT THIS ERROR

    ALSO I DONT FIND ‘first_try.h5’ FILE!!!! –> SOLUTION: In the file ‘dogs-vs-cats1.py’, replace ‘model.load_weights(‘first_try.h5′)’ with ‘model.save_weights(‘first_try.h5′)’ OR LIKE THIS:

    NOW I GOT THE TRAINING FILE ‘first_try.h5’ IN ‘dogs-vs-cats-tf’ DIRECTORY!
    NOTE: I ONLY SET ‘nb_epoch = 5’ JUST TO PROVE THE .h5 FILE WOULD BE CREATED OR NOT. SO THE ACCURACY IS NOT TOO GOOD (70.15%). HERE IS THE LAST LINE ON MY TERMINAL AT THE EPOCH 5TH

    OK. NOW HOW TO USE THE TRAINING FILE FOR TESTING!!!

Compile OpenCV 3.1 And Python 2.7 With CUDA 7.5 On Ubuntu 14.04

COMPILE OPENCV 3.1 AND PYTHON 2.7 WITH CUDA
ref:http://rolflussi.blogspot.co.id/2015/09/opencv-with-cuda-on-ubuntu-1404.html
1. Create a new virtualenv with python parameter point to python2.7.

2. Check python version:

3. Check pip version:

4. Install numpy:

CHECK numpy VERSION:

IMPORTANT: I FOUND AN ERROR ‘The data should normally be NULL! in function allocate’ WHEN TRY TO TEST SIFT Holography Feature Matching (flann.knnMatch). PLS FIX THIS FIRST (SEE SOLUTION IN /media/data/MASTER/opencv/github_list_fish_rec.txt) BEFORE BUILD OPENCV AT STEP #5 BELOW! — OKAY. THIS IS ALREADY FIXED ON THE LAST COMPILE (OPENCV 3.1 WITH PYTHON 2.7)

5. We already cloned opencv 3.1.0 and opencv_contrib 3.1.0. so now, go to the build WITH CUDA and do setup:
<OLD>
THIS IS THE INITIAL CMAKE COMMAND: (DONT USE IT!)

</OLD>

<OLD>
THIS IS THE CMAKE COMMAND WITH CUDA I GOT FROM http://rolflussi.blogspot.co.id/2015/09/opencv-with-cuda-on-ubuntu-1404.html: (DONT USE IT! ‘WITH_QT’ COMMAND GAVE ME AN ERROR! MAY BE I DONT HAVE QT INSTALLED)

THIS IS THE ERROR:

</OLD>

<NEW>
THIS IS THE CMAKE COMMAND WITH CUDA AND REMOVE ‘WITH_QT’ COMMAND. THIS IS WORK!!! BUT MAKE SURE ‘build’ directory EMPTY FIRST!
NOTE: I USE ‘INSTALL_C_EXAMPLES=ON’ INSTEAD OF ‘OFF’ LIKE PREVIOUS BUILD. LET ME KNOW IF EVERYTHING WORKS (ITS CONFIRMED!!!)

</NEW>

NOTE:
PLS SEE THE NVIDIA CUDA PART ON THE ABOVE RESULT IS INCLUDED! BUILD WITH CUDA IS FAST (A FEW MINUTES)!

6. Compile opencv:
NOTE: BEFORE EXECUTING THIS, CONSIDER TO EDIT THIS FILE:

SEE BELOW HOW TO MODIFY IT!!!

NOTE:
AFTER WAITING FOR MORE THAN 1 hour AND 25 MINUTES (91% COMPLETED), THE COMPILATION IS STOPPED WITH THESE ERRORS STACK:

SOLUTION:
ref:https://github.com/Itseez/opencv/issues/5859
I USED A TEMPORARY SOLUTION: EDIT /home/teddy/opencv/build/samples/gpu/CMakeFiles/example_gpu_opengl.dir/link.txt. THEN ADD THIS: -lGL -lGLU AT THE END OF THE LINE (IN SINGLE LINE! DONT ADD AT THE NEW LINE!). SO THE FILE WOULD BE LIKE THIS:

SAVE THE FILE THEN RE-MAKE (BUT I SUGGEST TO REMOVE ‘build’ DIRECTORY, CREATE IT AGAIN LIKE STEP #5. BUT BEFORE EXECUTING STEP #6, EDIT link.txt FILE LIKE THE ABOVE! ). THIS SOLUTION IS WORKING!!!
ACTUALLY THERE IS A PERMANENT SOLUTION IS SUGGESTED IN THE SAME URL, BUT I DONT KNOW HOW TO DO IT!!! LEARN IT

OK. HERE IS THE SUCCESFULL COMPILE (MAKE)

NOTE:
SEE THE MORE COMPLETE COMPILATION (MAKE) PROCESS IN THIS FILE: /media/data/MASTER/opencv/make_opencv_cuda.txt
ITS NOT FULL COMPLETED BECAUSE I MISSED SOME DATA BUT IT WORTHS TO SEE (THERE ARE SOME WARNING!!!)
THIS COMPILATION TOOK MORE THAN 1 hour AND 30 MINUTES. COMPILATION WITH CUDA (MAY BE ALSO WITH OPENGL) MAKE IT SLOWER!!!

WARNINGS:
1.

2.

7. Assuming OpenCV 3.1 compiled without error, you can now install it on your system:
NOTE: BEFORE EXECUTING THIS COMMAND, MODIFY AGAIN THE ABOVE FILE: /home/teddy/opencv/build/samples/gpu/CMakeFiles/example_gpu_opengl.dir/link.txt OR WE’D GET THE SAME ERROR (PLS SEE THE ERROR HERE: /media/data/MASTER/opencv/opencv_cuda_make_install_error.txt ):

THIS TIME WE MUST USE SUDO BECAUSE THE FILE IS LOCKED:

THEN ADD THIS AT THE END OF THE SINGLE LINE LIKE ABOVE: -lGL -lGLU
THEN SAVE AND CLOSE
INSTALL AGAIN:

NOTE:
FOR COMPLETE PROCESS RESULT, SEE THIS FILE: /media/data/MASTER/opencv/opencv_cuda_make_install_success.txt

8.

9. If you’ve reached this step without an error, OpenCV should now be installed in /usr/local/lib/python2.7/site-packages
However, our ‘opencv_p27_cuda’ virtual environment is located in our home directory — thus to use OpenCV within our cv environment, we first need to sym-link OpenCV into the site-packages directory of the ‘opencv_p27_cuda’ virtual environment:

10. Check the installation opencv version:

11. EXECUTE SOME OPENCV EXAMPLES in /home/teddy/opencv/build/bin/ DIRECTORY:
a. Run this example (image grain):

b. Test Cuda Codec:

 

Installation of OpenCV 3.1 (Python 2.7) on Ubuntu 14.04

USE PYTHON 2.7 INSTEAD OF PYTHON 3.4 AND INSTALL OPENCV 3.1
WHY: ref:http://www.pyimagesearch.com/2015/07/27/installing-opencv-3-0-for-both-python-2-7-and-python-3-on-your-raspberry-pi-2/
SOME PYTHON PACKAGES STILL USE 2.7 VERSION
http://www.pyimagesearch.com/2015/06/22/install-opencv-3-0-and-python-2-7-on-ubuntu/
1. Create a new virtualenv with python parameter point to python2.7. ref:http://stackoverflow.com/questions/5506110/is-it-possible-to-install-another-version-of-python-to-virtualenv

2. Check python version:

2.b Just Check python version in another virtualenv (opencv):

OK. PYTHON VERSION IN ANOTHER VIRTUALENV NOT CHANGED (STILL 3.4)

3. Check pip version:

4. Install numpy:

CHECK numpy VERSION:

IMPORTANT: I FOUND AN ERROR ‘The data should normally be NULL! in function allocate’ WHEN TRY TO TEST SIFT Holography Feature Matching (flann.knnMatch). PLS FIX THIS FIRST (SEE SOLUTION IN /media/data/MASTER/opencv/github_list_fish_rec.txt) BEFORE BUILD OPENCV AT STEP #5 BELOW!

5. We already cloned opencv 3.1.0 and opencv_contrib 3.1.0. so now, go to the build and do setup:

6. Compile opencv:

7. Install:

8. If you’ve reached this step without an error, OpenCV should now be installed in /usr/local/lib/python2.7/site-packages
However, our ‘opencv_p27’ virtual environment is located in our home directory — thus to use OpenCV within our cv environment, we first need to sym-link OpenCV into the site-packages directory of the ‘opencv_p27’ virtual environment:

9. Check the installation opencv version:

 

Installation of OpenCV 3.1 (Python 3.4) on Ubuntu 14.04

Installation:

  1. lets create a virtual environment with name ‘opencv’

    A FEW VIRTUALENV COMMANDS:
    a. Leave/exit virtualenv opencv, use ‘deactivate opencv’

    b. Go to or get into virtualenv opencv, use ‘workon opencv’

    c. Remove/delete virtualenv pls use rmvirtualenv <virtualenv name>. BUT PLS DEACTIVATE FIRST BEFORE REMOVING
    for example:

     
  2. COMPILE AND INSTALL OPENCV 3 LIB FOR PYTHON 3
    ref:http://www.pyimagesearch.com/2015/07/20/install-opencv-3-0-and-python-3-4-on-ubuntu/
    http://askubuntu.com/questions/94102/what-is-the-difference-between-apt-get-update-and-upgrade
    http://milq.github.io/install-opencv-ubuntu-debian/
    1. Install prerequisites

    2. Install developer tools used to compile OpenCV 3.0:

    3. Install libraries and packages used to read various image formats from disk:

    4. Install a few libraries used to read video formats from disk: (GOT ERROR)

    SKIP???
    OK HERE IS THE SOLUTION:
    (ref:http://askubuntu.com/questions/691109/how-do-i-install-ffmpeg-and-codecs)
    Install ffmpeg and the codecs:

    Re-run ‘sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev’. SHOULD WORKS NOW!!!

    e. Install GUI libs: (ref:http://milq.github.io/install-opencv-ubuntu-debian/)

    SOLUTION: Install Lib GTK so we can use OpenCV’s GUI features:

    Re-run ‘sudo apt-get install qt5-default libvtk6-dev’

    f. Install packages that are used to optimize various functions inside OpenCV, such as matrix operations:

    g. Install documentation (doxigen):

    h. Install Parallelism and linear algebra libraries:

     

  3. We’re halfway done setting up Python. But in order to compile OpenCV 3.0 with Python 3.4+ bindings, we’ll need to install the Python 3.4+ headers and development files:
    a. sudo apt-get install python3.4-dev

    b. go into our virtualenv ‘opencv’

    c. OpenCV represents images as NumPy arrays, so we need to install NumPy into our ‘opencv’ virtual environment:

    CHECK numpy VERSION: (ITS OKAY JUST USE python IN VIRTUALENV CREATED FOR PYTHON3)

     

  4. Build and install OpenCV 3.0 with Python 3.4+ bindings
    a. deactivate opencv first (NO. DON’T DO THIS. KEEP ON THE opencv virtualenv BECAUSE WE’LL USE numpy!)

    b. Alright, our system is all setup now! Let’s pull down OpenCV from GitHub and checkout the 3.1.0 version:

    c. We’ll also need to grab the opencv_contrib repo as well (for more information as to why we need opencv_contrib, take a look at my previous OpenCV 3.0 Ubuntu install post: http://www.pyimagesearch.com/2015/06/22/install-opencv-3-0-and-python-2-7-on-ubuntu/):

    IMPORTANT: I FOUND AN ERROR ‘The data should normally be NULL! in function allocate’ WHEN TRY TO TEST SIFT Holography Feature Matching (flann.knnMatch). PLS FIX THIS FIRST (SEE SOLUTION IN /media/data/MASTER/opencv/github_list_fish_rec.txt) BEFORE BUILD OPENCV AT STEP #5 BELOW!
    d.a Time to setup the build (USE virtualenv opencv BETTER BECAUSE WE NEED numpy!!!):–> RENAMED DIR TO ‘build0’. I THINK DONT USE THIS. JUST USE d.b.

    d.b Time to setup the build (USE virtualenv opencv BETTER BECAUSE WE NEED numpy!!!):

    e. compile! (TAKE LONG TIME AND I GOT 5 GB DATA)
    make -j4
    Where the 4 can be replaced with the number of available cores on your processor to speedup the compilation time.
    To find out how many core your computer has, pls do:
    ref:http://www.howtogeek.com/howto/ubuntu/display-number-of-processors-on-linux/

    f. Assuming OpenCV 3.1 compiled without error, you can now install it on your system:

    g.

     

  5. Sym-link OpenCV 3.1
    If you’ve reached this step, OpenCV 3.1 should now be installed in /usr/local/lib/python3.4/site-packages/

    Here, our OpenCV bindings are stored under the name cv2.cpython-34m.so

    Be sure to take note of this filename, you’ll need it in just a few seconds!

    However, in order to use OpenCV 3.1 within our opencv virtual environment, we first need to sym-link OpenCV into the site-packages directory of the cv environment, like this:

    Notice how I am changing the name from cv2.cpython-34m.so to cv2.so — this is so Python can import our OpenCV bindings using the name cv2 .

    So now when you list the contents of the opencv virtual environment’s site-packages directory, you’ll see our OpenCV 3.1 bindings (the cv2.so file):

    Again, this is a very important step, so be sure that you have the cv2.so file in your virtual environment, otherwise you will not be able to import OpenCV in your Python scripts!

    5. Test out the OpenCV 3.0 and Python 3.4+ install

    As you can see, OpenCV 3.1 with Python 3.4+ bindings has been successfully installed on my Ubuntu system!

    6. EXECUTE SOME OPENCV EXAMPLES (ref:http://milq.github.io/install-opencv-ubuntu-debian/)
    a. Run this example (edge detect):

    Would open an image (fruit) with edge detect!

    b. run python samples (video capture from my laptop camera):



    7. CREATE AN EXAMPLE DEMO
    There is a sample code in /opencv/samples/cpp/example_cmake/
    To compile example.cpp successfully, we need CMakeLists.txt and Makefile
    run:

    RESULT:

    TO EXECUTE THE FILE:

    FOR MORE OPENCV TUTORIAL FOR PYTHON, PLS SEE /media/data/MASTER/opencv/opencv_python_tutorial.txt

Machine Learning with OpenCV, Keras & ImageNet

Reference: http://www.pyimagesearch.com/2016/08/10/imagenet-classification-with-python-and-keras/
François Chollet pushed three Keras models (VGG16, VGG19, and ResNet50) online — these networks are pre-trained on the ImageNet dataset, meaning that they can recognize 1,000 common object classes out-of-the-box.
we can now easily apply VGG16, VGG19, and ResNet50 using Keras and Python to our own applications.
ImageNet is actually a project aimed at labeling and categorizing images into almost 22,000 categories based on a defined set of words and phrases. At the time of this writing, there are over 14 million images in the ImageNet project.

  1. Install keras and tensorflow backend
    list the package needed
  2. Clone the deep-learning-models repository
    Then, to gain access to VGG16, VGG19, and the ResNet50 architectures and pre-trained weights, you need to clone the deep-learning-models repository from GitHub:

    Then go into the dir ‘deep-learning-models’

    Notice how we have four Python files. The resnet50.py , vgg16.py , and vgg19.py  files correspond to their respective network architecture definitions.
    The imagenet_utils  file, as the name suggests, contains a couple helper functions that allow us to prepare images for classification as well as obtain the final class label predictions from the network.
  3. Write some Python code to classify image contents utilizing Convolutional Neural Networks (CNNs) pre-trained on the ImageNet dataset.
    To start, open up a new file, name it ‘test_imagenet.py’ , and insert the following code:

     
  4. Run the python script ‘test_imagenet.py’.
    NOTE: FOR THE FIRST TIME IT’S VERY SLOW BECAUSE IT DOWNLOADED VGG16 WEIGHT FROM INTERNET (~500MB)

    I GOT AN ERROR AT ‘(inID, label) = decode_predictions(preds)[0]’
    SOLUTION: COMMENT LINE #42 in ‘test_imagenet.py’ AND ADD TWO NEW LINES LIKE THIS:

    RUN AGAIN

    SUCCESS! IT CAN RECOGNIZED A DOG ‘BEAGLE’. HERE IS THE RESULTNOTE: The last error ‘NoneType’ not related with keras. TAKE CARE OF IT LATER (SOLUTION READ: http://www.pyimagesearch.com/2016/12/26/opencv-resolving-nonetype-errors/)
    TRY ANOTHER EXAMPLE:

    NOTE: The downloaded dataset would be stored in /.keras/models/ directory. the dataset filename is ‘vgg16_weights_tf_dim_ordering_tf_kernels.h5’ and the labeled index filename is ‘imagenet_class_index.json’.
  5. MORE TEST
    I have some test for recognizing fish on some pictures. I put three samples in ‘images’ directory (/deep-learning-models/images). BUT NONE OF THEM SHOW THE CORRECT RESULT. HERE ARE THE RESULTRECOGNIZED AS ‘tench’ ???
    RECOGNIZED AS ‘electric_ray’ ???
    RECOGNIZED AS ‘hermit_crab’ ???
    I THINK I NEED TO TRAIN THESE SAMPLES FIRST BEFORE IT READY TO BE RECOGNIZED

Installation of OpenCV, Keras and Tensorflow On Ubuntu 14.04

Reference: http://www.pyimagesearch.com/2016/11/14/installing-keras-with-tensorflow-backend/
step-by-step instructions to install Keras using a TensorFlow backend for machine learning.

Keras is simply a wrapper around more complex numerical computation engines such as TensorFlow and Theano.

When it comes to Keras you have two choices for a backend engine — either TensorFlow or Theano. Theano is older than TensorFlow and was originally the only choice when selecting a backend for Keras.

So why might you want to use TensorFlow over Theano?

The short version is that TensorFlow is extremely flexible, allowing you to deploy network computation to multiple CPUs, GPUs, servers, or even mobile systems without having to change a single line of code.

This makes TensorFlow an excellent choice for training distributed deep learning networks in an architecture agnostic way, something that Theano does not (currently) provide.

Installation:

  1. Use Python virtual environments.

    You can quit the virtualenv with command ‘deactivate’

    And go back the virtualenv with command ‘workon opencv_keras_tf’

    Check python version:

     
  2. Install TensorFlow
    NOTE: Read this about CUDA compute capability : http://stackoverflow.com/questions/10961476/what-are-the-differences-between-cuda-compute-capabilities
    IT SEEMS DEPEND ON THE HARDWARE! NOTHING CAN DO TO IMPROVE THE COMPUTE CAPABILITY!
    AFTER READING THIS https://www.tensorflow.org/versions/r0.10/get_started/os_setup#installing_from_sources AND http://stackoverflow.com/questions/38542763/how-can-i-make-tensorflow-run-on-a-gpu-with-capability-2-0, I GOT SAD NEWS THAT
    In order to build or run TensorFlow with GPU support, both NVIDIA’s Cuda Toolkit (>= 7.0) and cuDNN (>= v3) need to be installed.
    TensorFlow GPU support requires having a GPU card with NVidia Compute Capability >= 3.0.
    SO MY GPU GeForce GT 520M THAT ONLY HAS CUDA COMPUTE CAPABILITY 2.1 (REF: https://en.wikipedia.org/wiki/CUDA) CAN’T BE USED FOR TENSORFLOW!!!I ONLY CAN USE CPU!!!To install TensorFlow, refer to this page: https://www.tensorflow.org/versions/r0.11/get_started/os_setup.
    Currently I have CUDA 7.5 toolkit installed

    The tensorflow page need CUDA toolkit 8.0 and CuDNN v5. I already installed them. I go to ‘Pip installation’ and choose this binary option:

    SO let’s begin:

    Install TensorFlow:

    Test the installation

     
  3. Install Keras
    Install a few Python dependencies:
    Install numpy scify

    Install scikit-learn

    Install pillow

    Install h5py

    Install keras

    Then run ‘import keras’ in python console to create keras.json file (http://stackoverflow.com/questions/40310035/how-to-change-keras-backend-wheres-the-json-file)

    keras.json file would be created in ~/.keras/ (~/.keras/keras.json file)

    Specifically, you’ll want to ensure that image_dim_ordering  is set to tf  (indicating that the TensorFlow image dimension ordering is used rather than th  for Theano).

    You’ll also want to ensure that the backend  is properly set to tensorflow  (rather thantheano ).

  4. Symlink with OpenCV
    My opencv binding file for python 3 is in /usr/local/lib/python3.4/site-packages/cv2.cpython-34m.so. I need to symlink it with the virtualenv ‘opencv_keras_tf’ like this:
    Go into this directory:

    Then symlink it (HERE I CHANGE THE FILE TO ‘cv2.so’)

    Test it

    OK. NO ERROR

LIOS On Ubuntu 14.04

Linux-Intelligent-Ocr-Solution (LIOS)
Easy-OCR solution and Tesseract trainer for GNU/Linux
Download link: https://sourceforge.net/projects/lios
Currently I got the package (.deb) is version 2.5 but I got some bugs

So I tried to install the newest version (version 3) from the source in https://github.com/Nalin-x-Linux/lios-3:

  1. Clone the repository

     
  2. Before install this python package, it’d be much better to use virtualenv to do that because we’ll install some packages. I already install virtualenv and use python 3 there. Read the tutorial http://myprojects.advchaweb.com/index.php/2016/08/24/my-ubuntu-14-04-and-apps-installation-error-and-solution/. Create a new virtualenv ‘lios’

    NOTE: if the virtualenv ‘lios’ already exists, we can go into it via ‘workon lios’ command!
    check python version

     
  3. Go to the local ‘lios-3’ directory
  4. Install

     
  5. Run the program ‘lios’ BUT I GOT AN ERROR

    Solution: Install ‘gi’ module via pip

    Run the program again but another error:

    Solution: This error occured because in python 3, the ‘print’ must be followed by parentheses! like print(‘Hello’) NOT print ‘Hello’. So modify the file in ‘/home/teddy/.virtualenvs/lios/lib/python3.4/site-packages/gi/__init__.py’ like this

    Run the program again, another error:

    Solution: This problem really made me headache. I installed pacman (NO.THIS IS FOR ARCHLINUX. REMOVE IT IN No package for ‘gi.repository’ but this link http://stackoverflow.com/questions/31324430/installing-pygobject-via-pip-in-virtualenv?rq=1 gave me a way to solve this problem. I see in ‘/usr/lib/python3/dist-packages/gi/’ directory, there is a directory ‘_gobject’ that I think I can use it so I just ‘symlink’ the dir to ‘lios’ virtual env like this:

    NOTE: I need to rename the old ‘gi’ directory I installed before so the symlink can works.
    DO THE SAME FOR THE OTHERS MODULES ‘enchant’ and ‘speechd’ LIKE THIS:

    RUN AGAIN AND THE GUI IS APPEARED BUT FOLLOWED WITH MANY ERRORS AND THE VERSION DONT CHANGE (STILL VERSION 2.0)!!! –>DON’T USE IT BECAUSE IT CAN’T BE CLOSED!!!!

    I HAVE TO KILL THE TERMINAL MANUALLY!!!
    OK. THIS PROBLEM ONLY IF I RUN ‘LIOS’ FROM VIRTUALENV. BUT I RUN IT LIKE USUAL, IT’D BE NO PROBLEM!