Migrate a Python application into a Docker container
To avoid repetition, for overview and language agnostic examples on application migration to containers see Migrate your application into a Docker container Update your application Exclude downloadable libraries Add a Python-specific .gitignore file to…
Integrate Anaconda into Pyenv
If you use Pyenv to install multiple Python versions side-by-side and installed Anaconda to create virtual environments for each of your projects, install pyenv-virtualenv to integrate them. Anaconda without the pyenv-virtualenv integration overwrites…
Install multiple Python versions with Pyenv
Pyenv is a Python version manager. It is recommended, because it does not depend on Python, (written in Bash) and using it we can install and utilize multiple Python versions without affecting the Python version used by MacOS. The Pyenv source code is at…
Use virtual environments with Anaconda
Anaconda (conda) can create a python bubble for you with no preinstalled packages. You can create a Python virtual environment for each of your projects to isolate them and only install the required packages. When we distribute our code, we should…
Exception: invalid literal for int() with base 10: ‘7.0’
Python cannot convert a floating-point string to an integer in one step. When you get the error message Exception: invalid literal for int() with base 10: ‘7.0’ Convert the string to float first
Python alternate module names for pip install
To install some Python modules we need to use alternate names in the pip install command Module name Install command googleapiclient pip install google-api-python-client
ModuleNotFoundError: No module named ‘googleapiclient’
When we start to use a Python module, we need to install it on our workstation, and on the server, or in the Docker container where the application will run. ModuleNotFoundError: No module named ‘googleapiclient’ Usually, we install the…
Install Python 3 on MacOS
The MacOS comes with an old version of Python 2. For new software development Python 3 is the recommended version. Replacing the original Python 2 with Python 3 can cause instability in the MacOS. There are multiple ways to install Python 3 and keep…
Read and Update Google Sheet data with Python
In this example we will use python to read data from Google Sheets and update another one using the Google API. Enable the Google API Navigate to https://console.developers.google.com/ Log in with your Google account Click the Create Project link Enter a…
Blue-green deployment in AWS ECS Fargate with CodeDeploy
We will use CodeDeploy to automate the application deployment in our AWS ECS Fargate cluster. Create an AIM role for CodeDeploy to assume the ECS service role In the AWS console navigate IAM and click the Roles link Click the Create role button Click the…