ERROR: Failed building wheel for mysqlclient

When install mysqlclient python module, i get error (venv) boby@sok-01:~/Downloads/django-deploy$ pip install mysqlclient==1.4.2.post1 Collecting mysqlclient==1.4.2.post1 Using cached https://files.pythonhosted.org/packages/f4/f1/3bb6f64ca7a429729413e6556b7ba5976df06019a5245a43d36032f1061e/mysqlclient-1.4.2.post1.tar.gz Building wheels for collected packages: mysqlclient Building wheel for mysqlclient (setup.py) … error ERROR: Complete output from command /home/boby/venv/bin/python3 -u -c ‘import setuptools, tokenize;__file__='”‘”‘/tmp/pip-install-bbfa8tuo/mysqlclient/setup.py'”‘”‘;f=getattr(tokenize, ‘”‘”‘open'”‘”‘, open)(__file__);code=f.read().replace(‘”‘”‘\r\n'”‘”‘, ‘”‘”‘\n'”‘”‘);f.close();exec(compile(code, __file__, ‘”‘”‘exec'”‘”‘))’ bdist_wheel -d /tmp/pip-wheel-bqlba1jk –python-tag cp36: ERROR: running bdist_wheel … Read more

pip install mysqlclient mysql_config: not found

On Ubuntu 18.04, when i install mysqlclient python module, i get error (venv) boby@sok-01:~/Downloads/django-deploy$ pip install mysqlclient==1.4.2.post1 Collecting mysqlclient==1.4.2.post1 Using cached https://files.pythonhosted.org/packages/f4/f1/3bb6f64ca7a429729413e6556b7ba5976df06019a5245a43d36032f1061e/mysqlclient-1.4.2.post1.tar.gz ERROR: Complete output from command python setup.py egg_info: ERROR: /bin/sh: 1: mysql_config: not found Traceback (most recent call last): File “”, line 1, in File “/tmp/pip-install-we5rsid9/mysqlclient/setup.py”, line 16, in metadata, options = get_config() … Read more

Running Python Application with gunicorn and nginx

Create a service file for gunicorn root@django:~# cat /etc/systemd/system/gunicorn2.service [Unit] Description=gunicorn2 daemon Requires=gunicorn2.socket After=network.target [Service] User=ubuntu Group=www-data WorkingDirectory=/home/ubuntu/myapp/wagtail2 ExecStart=/home/ubuntu/myapp/venv/bin/gunicorn \ –access-logfile – \ –workers 3 \ –bind unix:/run/gunicorn2.sock \ wagtailblog4.wsgi:application [Install] WantedBy=multi-user.target root@django:~# Here /home/ubuntu/myapp/wagtail2 = path to the folder where web application is. /home/ubuntu/myapp/venv/bin/gunicorn = is where gunicorn installed inside virtualenv. Change these path … Read more

Installing PyCharm Community Edition on Ubuntu

pycharm python editor

PyCharm Community Edition is a free python editor from JetBrains. You can download it from https://www.jetbrains.com/pycharm/download/#section=linux Download and extact the tar.gz file. Move it to a folder like tar xvf pycharm-community-2019.1.3.tar.gz mkdir ~/programs mv pycharm-community-2019.1.3 ~/programs Execute sartup script cd ~/programs/pycharm-community-2019.1.3/bin ./pycharm.sh Once pycharm started, you can go to Tools menu and create a startup … Read more

Getting started with Django Framework

Django is a python framework for developing web applications. To install Django, run pip install django To create a project, run django-admin startproject PROJECT_NAME Django come with built in development server. To start Django development server, change to the project folder and run ./manage.py runserver It will start a development web server on url http://127.0.0.1:8000/ … Read more

Creating and using virtualenv

To create a virtualenv, run virtualenv NAME_OF_VIRTUALENV On Ubuntu 18, this command will create virtualenv with Python 2.7. To create virtualenv with Python 3, run virtualenv –python=/usr/bin/python3 venv Here “venv” is my virtualenv name. To activate virtialenv, go to the folder where your virtialenv folder is present, then run source venv/bin/activate You will see name … Read more

virtualenv

Install virtualenv on Ubuntu Creating and using virtualenv virtualenv is used to create isolated python environments. With python3, you can create virtualenv with command python -m venv FOLDER_NAME Install virtualenv with setuptools easy_install virtualenv Create a folder mkdir /root/virt_env/ Create virtualenv virtualenv -p /usr/python3/bin/python3.3 /root/virt_env/virt1 –no-site-packages Activate virtualenv source /root/virt_env/virt1/bin/activate To exit a virtualenv, run … Read more

Install jupyter notebook

To install jupyter notebook on Ubuntu run pip install jupyter To start jupyter notebook, create an empty folder, change to it mkdir ~/book cd ~/book Now run jupyter notebook By default, it bind to localhost. If you want to run on a public IP, run as follows jupyter notebook –ip 198.50.234.187 –port 8888 –allow-root Example

Django Framework

Django is a Python framework. You can find more info at https://www.djangoproject.com Django Tutorials Getting started with Django Framework https://realpython.com/tutorials/django/ Create Project django-admin.py startproject Create New Application python manage.py startapp Run Server python manage.py runserver [IP:PORT] Django framework run server command start development web server on port 8000 To run server on port 80, use … Read more