Travis CI, pip, and pygame - pygame

I am trying to setup a project with Travis CI. Project also uses pygame. I had multiple attempts to set it up - but it seem to be failing.
The closest I got was following:
.travis.yml:
language: python
python:
- "2.7"
install:
- pip install -r requirements.txt
before_install:
- sudo apt-get update
- sudo apt-get build-dep python-pygame
- sudo apt-get install mercurial
script:
- nosetests tests/*.py
requirements.txt:
Twisted==13.2.0
coverage==3.7.1
nose==1.3.0
hg+http://bitbucket.org/pygame/pygame
wsgiref==0.1.2
zope.interface==4.1.0
Travis CI downloads the pygame package, but the installation hangs:
https://travis-ci.org/ruslanosipov/space/builds/19142164#L390
Any hint?

Solution was as follows:
Create separate .travis_requirements.txt without the pygame.
Change .travis.yml as follows:
language: python
python:
- "2.7"
before_install:
- sudo apt-get update -qq
- sudo apt-get build-dep -qq python-pygame
- sudo apt-get install -qq python-pygame
install:
- pip install -r .travis_requirements.txt
script:
- nosetests tests/*.py
virtualenv:
system_site_packages: true
Main change is using "system_site_packages" setting and installing pygame via apt-get.

Related

how to kill process holding the apt lock

I'm updating apt and installing mysql-client at run time to a ubuntu 18.04 aws instance.
My shell command are like,
- apt-get update
- apt-get install -y mysql-client
- apt-get install -y unzip
But 'apt-get install -y mysql-client' hang and lock apt. Therefor 'apt-get install -y unzip' get fail. So to proceed this, I have to manually kill the process and unclock the apt from following commands.
Step 01. ps -ef | grep apt
Step 02. kill -9
Step 03. sudo dpkg --configure -a
Step 04. Yes the below message
restarts will be done for you automatically so you can avoid being asked questions on each library upgrade. │ Restart services during package upgrades without asking?
Step 05. apt-get install -y mysql-client
My question is how I implement following from shell script or is there a any way to install mysql-client at run time?
Try to set DEBIAN_FRONTEND=noninteractive and the -q parameter to avoid apt from opening interactive prompts.
e.g:
DEBIAN_FRONTEND=noninteractive apt-get install -yq mysql-client

how to install pyaudio module in google cloud shell?

Error:
raise AttributeError("Could not find PyAudio; check installation")
AttributeError: Could not find PyAudio; check installation
I tried all of these commands:
sudo pip install pyaudio,
sudo apt-get install python-pyaudio ,
sudo pip install pyaudio ,
sudo pip install --upgrade pyaudio.
First, undo what you have done.
Then try to install it following their documentation for Debian based versions:
$ sudo apt install portaudio19-dev python-all-dev
followed by
$ sudo apt install python-pyaudio for python 2 version
OR
$ sudo apt install python-pyaudio for python 3 version.

Installing ansible 2.6 or older

With 2.6.2, ansible started ignoring config files in world writable dirs, rendering many windows/vagrant setups useless. I try to install Ansible 2.6 or older.
System:
Ubuntu 14.04.5 LTS (GNU/Linux 3.13.0-132-generic x86_64)
The propvision.sh states
# Add Ansible Repository & Install Ansible
sudo add-apt-repository -y ppa:ansible/ansible
sudo apt-get update
sudo apt-get install -y ansible && sudo touch /root/ansible_ready
I adapted it to
sudo apt-get install -y ansible=2.6.0 && sudo touch /root/ansible_ready
^^^^^^
but that version was not found. How can I obtain 2.5 or 2.6? I am quite unexperienced with linux and the concept of installing something not by a doubleclick.
For installation of Ansible version 2.6 on Trusty Tahr 14.04 (LTS), proceed with the follow commands:
sudo apt update
sudo apt install -y software-properties-common
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 93C4A3FD7BB9C367
Add apt source list:
sudo tee -a /etc/apt/sources.list.d/ansible-2.6.list << EOF
deb http://ppa.launchpad.net/ansible/ansible-2.6/ubuntu trusty main
deb-src http://ppa.launchpad.net/ansible/ansible-2.6/ubuntu trusty main
EOF
Update apt and install Ansible:
sudo apt update
sudo apt install -y ansible

installing mysql connector for python 3 in raspberry pi

I am new at using raspberry pi.
I have a python 3.4 program that connects to a database on hostinger server.
I want to install mysql connector in raspberry pi.I searched a lot but I was not able to find answers . any help would be appreciated
Before you install, it is important to run update and upgrade;
sudo apt-get update
sudo apt-get upgrade
Either install connector for Python 2;
sudo apt-get -y install python-mysql.connector
Or install connector for Python 3;
sudo apt-get -y install python3-mysql.connector
I found no way to install mysql-connector-python that I used with windows.
for python 3.4 I used the command
sudo python3 -m pip install pymysql
for python 2.7 you can use following commands
sudo apt-get install python-mysqldb
or
sudo apt-get install python-pip
pip install pymysql
Just use $sudo apt-get install python3-mysqldb and it works on pi-3.

How should MySQL be installed in a Django application?

I am developing a project based on Django and MySQL on Ubuntu. I am a little confused about how MySQL should be installed. Should it be installed into the virtual environment or should it be installed into the system:
(a) To install MySQL in the virtual environment (python2Venv is the directory of the virtual environment):
$ sudo apt-get install libmysqlclient-dev
$ source <python2Venv>/bin/activate
(python2Venv)$ pip install MySQL-python
(b) However, according to the installation guide about MySQL, I have to do (https://help.ubuntu.com/12.04/serverguide/mysql.html):
$ sudo apt-get install mysql-python
$ sudo apt-get install mysql-server
Questions:
Is the above steps correct? Are both (a) and (b) necessary, or one of them is enough (maybe with additional setups)?
Fisrt, there is no mysql-python under Ubuntu/Debian repositories, the package is python-mysqldb and is an interface to the Mysql Server for python, is the driver for python and is needed to your Django project to work with Mysql.
Under pypi repository is named MySQL-python
Second, there is no reason to install a Mysql Server in a Python virtualenv, the Python virtualenv is for Python libraries/modules/frameworks, Mysql Server is not that.
So you can install the Mysql Server in your Ubuntu system by the official repository
apt-get install mysql-server
And then you can install all that python libraries that you need in your special python virtualenv for your Django project.
source ~/.virtualenv/<project-name>/bin/activate
pip install Django
pip install MySQL-python
to install mysql server:
sudo apt-get install mysql-server
now to install mysql-python in virtual env:
pip install MySQL-python
note: both pip install MySQL-python & apt-get install python-mysqldb are same.
MySQL driver for Python (mysql-python) needs libmysqlclient-dev. You can get it with:
sudo apt-get update
sudo apt-get install libmysqlclient-dev
If python-dev is not installed, you may have to install it too:
sudo apt-get install python-dev
Now you can install MySQL driver:
pip install mysql-python
Here is a complete installation guide for setting up Django to use MySQL on a virtualenv:
http://codex.themedelta.com/how-to-install-django-with-mysql-in-a-virtualenv-on-linux/