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 the PATH, and places itself to the front before pyenv would be able to handle the Python command calls. pyenv-virtualenv seamlessly combines …
Tag Archives: Python
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 https://github.com/pyenv/pyenv Install Pyenv We will use Homebrew to install Pyenv Install …
Continue reading “Install multiple Python versions with Pyenv”
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 specify the list of referenced Python packages including their versions in the requirements.txt file. …
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 module with the pip install MODULE_NAME command, but when we try it for the googleapiclient we …
Continue reading “ModuleNotFoundError: No module named ‘googleapiclient’”
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 Python 2 pn the Mac. This is the most recommended process: …
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 project name, you can have 12 free project. Click the API panel Click the …
Continue reading “Read and Update Google Sheet data with Python”
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 CodeDeploy link Select CodeDeploy ECS Keep the default setting Enter …
Continue reading “Blue-green deployment in AWS ECS Fargate with CodeDeploy”
Install a Python package
To install a Python package on Macintosh Download the Python package to your workstation, Unpack the package, Open a terminal window, Start sudo, sudo -i Change to the directory of the package, Install the package. pip install PACKAGE_NAME If you don’t install the package in sudo mode, you will get “Permission denied” errors during the …