Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vagrant not installing pip during provision

Here is my bootstrap.sh:

#!/usr/bin/env bash

apt-get update
apt-get install -y apache2
apt-get install python-pip

if ! [ -L /var/www ]; then
  rm -rf /var/www
  ln -fs /vagrant /var/www
fi

Here is my Vagrantfile:

Vagrant.configure("2") do |config|
  config.vm.box = "hashicorp/precise64"
  config.vm.provision :shell, path: "bootstrap.sh"
end

I ran

vagrant reload --provision
vagrant ssh

but when I type pip it returns

The program 'pip' is currently not installed. You can install it by typing: sudo apt-get install python-pip

I verified I was able to

sudo apt-get install library

in the ssh terminal, so I am not sure what is wrong.

Any help would be appreciated.

like image 452
testing Avatar asked Feb 04 '16 02:02

testing


People also ask

Why is my pip install not working?

A “pip: command not found” error occurs when you fail to properly install the package installer for Python (pip) needed to run Python on your computer. To fix it, you will either need to re-install Python and check the box to add Python to your PATH or install pip on your command line.

How do I enable pip installation?

Step 1: Download the get-pip.py (https://bootstrap.pypa.io/get-pip.py) file and store it in the same directory as python is installed. Step 2: Change the current path of the directory in the command line to the path of the directory where the above file exists. Step 4: Now wait through the installation process. Voila!

Does pip automatically install dependencies?

Pip relies on package authors to stipulate the dependencies for their code in order to successfully download and install the package plus all required dependencies from the Python Package Index (PyPI). But if packages are installed one at a time, it may lead to dependency conflicts.

Does pip install globally by default?

If you're in an active virtual environment, then the command installs pip into that environment. Otherwise, it installs pip globally on your system. The --upgrade option ensures that the pip version is the same as the one declared in ensurepip .


1 Answers

Try replacing apt-get install python-pip with apt-get -y install python-pip as Chris already said in the comments.

like image 147
Jeewes Avatar answered Oct 22 '22 09:10

Jeewes