How to install Python packages with pipenv, venv or virtualenv package manager

You can find GitHub repository in https://github.com/python-projects-kenanhancer/python_demo

  • Pyenv – Python Runtime Version Manager
  • Pipenv – Python Package Manager and Virtual environment manager
  • Venv – Virtual environment manager
  • Virtualenv – Virtual environment manager

Installing Python Runtime Versions via Pyenv

In order to test different Python Runtime versions, I have installed some versions.

$ pyenv install 3.10.2

python-build: use openssl@1.1 from homebrew
python-build: use readline from homebrew
Downloading Python-3.10.2.tar.xz...
-> https://www.python.org/ftp/python/3.10.2/Python-3.10.2.tar.xz
Installing Python-3.10.2...
python-build: use tcl-tk from homebrew
python-build: use readline from homebrew
python-build: use zlib from xcode sdk
Installed Python-3.10.2 to /Users/kenanhancer/.pyenv/versions/3.10.2

I have 4 Python runtime versions(3.10.2, 3.10.3, 3.10.4, 3.10.5) in my machine.

$ pyenv versions

  system
  3.10.2
  3.10.3
  3.10.4
* 3.10.5 (set by /Users/kenanhancer/.pyenv/version)
Continue reading

How to install Java with Jabba

Runtime version managers make developers life easier. So, I tested different Java version managers. But, Jabba is the easiest one for me.

You can read previously posted How to install java articles.

Installing Jabba

Click Jabba link to see more detailed information about Jabba

$ curl -sL https://github.com/shyiko/jabba/raw/master/install.sh | bash && . ~/.jabba/jabba.sh

Make sure to source jabba.sh in your environment if you skip it:

$ [ -s "$JABBA_HOME/jabba.sh" ] && source "$JABBA_HOME/jabba.sh"

If you don't have JAVA_HOME environment variable, run the following code:

$ echo 'export JAVA_HOME=$HOME/.jabba/jdk/openjdk@1.14.0-1/Contents/Home' >> ~/.bash_profile
$ echo 'export JAVA_HOME=$HOME/.jabba/jdk/openjdk@1.14.0-1/Contents/Home' >> ~/.bashrc
$ echo 'export JAVA_HOME=$HOME/.jabba/jdk/openjdk@1.14.0-1/Contents/Home' >> ~/.zshrc
Continue reading

How to install Java with brew and jenv

jenv is a tool that helps you switch between different java versions in your development machine. But, Jenv doesn't install Java for you.

Use your platform appropriate package manager to install Java. On macOS, brew is recommended.

Install Java with Homebrew

First, ensure that you have Homebrew installed in your system. Homebrew is a package manager for Mac OS. So if you want to learn more details about it, visit my blog below.

I also posted how to install Java JDK manually in the following post.

Actually I already mentioned how to install Java JDK in the above post, but I will shortly show one more time

$ brew tap adoptopenjdk/openjdk
$ brew search jdk

==> Formulae
openjdk                                                                              openjdk@11

==> Casks
adoptopenjdk
adoptopenjdk12
adoptopenjdk13-openj9
adoptopenjdk14-openj9-jre-large
adoptopenjdk9
adoptopenjdk10
adoptopenjdk12-jre
adoptopenjdk13-openj9-jre
adoptopenjdk14-openj9-large
jdk-mission-control
adoptopenjdk11
adoptopenjdk12-openj9
adoptopenjdk13-openj9-jre-large
adoptopenjdk8
oracle-jdk
adoptopenjdk11-jre
adoptopenjdk12-openj9-jre
adoptopenjdk13-openj9-large
adoptopenjdk8-jre
oracle-jdk-javadoc
adoptopenjdk11-openj9
adoptopenjdk12-openj9-jre-large
adoptopenjdk14
adoptopenjdk8-openj9
sapmachine-jdk
adoptopenjdk11-openj9-jre
adoptopenjdk12-openj9-large
adoptopenjdk14-jre
adoptopenjdk8-openj9-jre
adoptopenjdk11-openj9-jre-large
adoptopenjdk13
adoptopenjdk14-openj9
adoptopenjdk8-openj9-jre-large
adoptopenjdk11-openj9-large
adoptopenjdk13-jre
adoptopenjdk14-openj9-jre
adoptopenjdk8-openj9-large
$ brew cask install adoptopenjdk
$ java --version

openjdk 14.0.1 2020-04-14
OpenJDK Runtime Environment AdoptOpenJDK (build 14.0.1+7)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 14.0.1+7, mixed mode, sharing)
Continue reading

How to install Ansible with brew or pip

You can install Ansible quickly in your system with Homebrew( or PIP(Package manager for Python)

Install Ansible with Homebrew

If you are using macOS, then you can use Homebrew.

First, ensure that you have Homebrew installed in your system. Homebrew is a package manager for Mac OS. So if you want to learn more details about it, visit previous post below.

Run the following commands in your terminal without $ sign.

$ brew update
$ brew install ansible

Checking Ansible version

$ ansible --version

ansible 2.9.7
  config file = None
  configured module search path = ['/Users/kenanhancer/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/kenanhancer/.pyenv/versions/3.8.2/lib/python3.8/site-packages/ansible
  executable location = /Users/kenanhancer/.pyenv/versions/3.8.2/bin/ansible
  python version = 3.8.2 (default, May  6 2020, 12:47:50) [Clang 11.0.3 (clang-1103.0.32.59)]

Install Ansible with PIP

Ensure that you have Python and PIP in your system. Check the following page about Python installation.

$ pip install ansible
$ ansible --version

Updating Ansible

$ pip install --upgrade ansible

Installing specific Ansible version

$ pip install ansible==2.2.2.0
$ pip install ansible==2.0.1.0

How to install Python with pyenv runtime version manager

I am using different programming languages like C#, Java, Node.js etc and need to manage runtime versions in my local. So, I like to use runtime version managers.

For example, there are some runtime version managers in Node.js community like nvm or n. I am very happy to use both of two package managers 🙂

Let's say I work for one Node.js project in dev machine with Node v8.0.0 but other project needs Node v6.0.0

In order to handle, different versions in same machine, we may use runtime version managers.

I just want to find a way to switch between different Python version so that found pyenv runtime version manager.

Pyenv installation

Click pyenv link for more detailed installation.

Installing pyenv with Homebrew

First, ensure that you have Homebrew installed in your system. Homebrew is a package manager for Mac OS. So if you want to learn more details about it, visit my blog below.

Run the following commands in your terminal. But, just copy commands without $ sign.

$ brew update
$ brew install pyenv

Setting PATH

Run the following command for advanced configuration.

$ echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n  eval "$(pyenv init -)"\nfi' >> ~/.bash_profile

Run the following command for basic configuration.

$ echo 'PATH=$(pyenv root)/shims:$PATH' >> ~/.bash_profile

and restart your terminal manually or run the following command to restart automatically.

$ exec "$SHELL"

Upgrading pyenv

$ brew upgrade pyenv

Uninstall pyenv

$ rm -rf $(pyenv root)
$ brew uninstall pyenv

Pyenv commands

List all Python versions installed in system

$ pyenv versions

  system
  3.7.3
* 3.8.2 (set by /Users/kenanhancer/.pyenv/version)

Show current active Python version in system

$ pyenv version

3.8.2 (set by /Users/kenanhancer/.pyenv/version)
Continue reading

Homebrew package manager for Mac OS and Linux

Homebrew is a package manager for Mac OS and Linux. You can find more details in http://brew.sh . You can install and uninstall software that you need easily from Command Line Interface(CLI).

There are more than 8500 packages and casks(GUI installation packages) in Homebrew.

Homebrew Cask is the installation and management of GUI macOS applications such as Atom and Google Chrome.

I also posted Chocolatey Package Manager for Windows. Reach out from the following link.

Continue reading