DEV Community

Cover image for How to install Homebrew, Pyenv, Pipenv in WSL (Windows) Ubuntu 20.04
Gokul Y
Gokul Y

Posted on

4 1

How to install Homebrew, Pyenv, Pipenv in WSL (Windows) Ubuntu 20.04

Why homebrew? :

Homebrew Installation :

  • Follow the steps mentioned in the below script
$/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Enter fullscreen mode Exit fullscreen mode

output and follow next steps :

image

install homebrew dependencies for Ubuntu (If needed) :

$sudo apt-get install build-essential procps curl file git
Enter fullscreen mode Exit fullscreen mode

Test installation by running below command:

$brew install hello
Enter fullscreen mode Exit fullscreen mode

Pyenv installation

Why pyenv ? :

  • pyenv lets you to switch between python versions in ubuntu.

Install python build dependencies for ubuntu :

$sudo apt-get update; sudo apt-get install make build-essential libssl-dev zlib1g-dev \
libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm \
libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev

Enter fullscreen mode Exit fullscreen mode

then run

$curl https://pyenv.run | bash

Enter fullscreen mode Exit fullscreen mode

Below lines should be available in .bashrc

export PATH="$HOME/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
Enter fullscreen mode Exit fullscreen mode

Restart Shell (If needed) :

$exec $SHELL
Enter fullscreen mode Exit fullscreen mode

or

Run below in windows command prompt :


wsl --shutdown 
& login into ubuntu again

Enter fullscreen mode Exit fullscreen mode

PIPENV Installation

Why pipenv? :

  • pipenv is used to create virtual environment, similar to venv,virtualenv,conda,etc.

Install pipenv using homebrew :

$brew install pipenv

Enter fullscreen mode Exit fullscreen mode

output:
image


References :

  1. https://brew.sh/
  2. https://docs.brew.sh/Homebrew-on-Linux
  3. https://github.com/pyenv/pyenv/wiki#suggested-build-environment
  4. https://github.com/pyenv/pyenv-installer
  5. https://pipenv.pypa.io/en/latest/
  6. Cover Photo by Hitesh Choudhary on Unsplash

Image of Timescale

Timescale – the developer's data platform for modern apps, built on PostgreSQL

Timescale Cloud is PostgreSQL optimized for speed, scale, and performance. Over 3 million IoT, AI, crypto, and dev tool apps are powered by Timescale. Try it free today! No credit card required.

Try free

Top comments (1)

Collapse
 
joevdotme profile image
Joseph Violago

Thanks for the post! You helped me catch my mistake in not installing my apt-get dependencies.

You should also mention the step to add brew to ~/.profile/~/.bash_profile (which initializes a bunch of homebrew env vars):

Follow the Next steps instructions to add Homebrew to your PATH and to your bash shell profile script, either ~/.profile on Debian/Ubuntu or ~/.bash_profile on CentOS/Fedora/Red Hat.

test -d ~/.linuxbrew && eval "$(~/.linuxbrew/bin/brew shellenv)"
test -d /home/linuxbrew/.linuxbrew && eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
test -r ~/.bash_profile && echo "eval \"\$($(brew --prefix)/bin/brew shellenv)\"" >>~/.bash_profile
echo "eval \"\$($(brew --prefix)/bin/brew shellenv)\"" >>~/.profile
Enter fullscreen mode Exit fullscreen mode

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Immerse yourself in a wealth of knowledge with this piece, supported by the inclusive DEV Community—every developer, no matter where they are in their journey, is invited to contribute to our collective wisdom.

A simple “thank you” goes a long way—express your gratitude below in the comments!

Gathering insights enriches our journey on DEV and fortifies our community ties. Did you find this article valuable? Taking a moment to thank the author can have a significant impact.

Okay