richa verma
richa verma

Reputation: 287

How can I upgrade pip version in cloud foundry for python buildpack

I am trying to host a django application on cloud foundry. I am getting error: "You are using pip version 9.0.1, however version 19.2.3 is available. You should consider upgrading via the 'pip install --upgrade pip' command."

Now, how can I upgrade pip version for my application in cloud foundry environment

I tried mentioning buildpack in manifest.yml from: https://github.com/cloudfoundry/python-buildpack

Manifest.yml file

---
 applications:
 - name: app
   command: python manage.py runserver
   buildpack: https://github.com/cloudfoundry/python-buildpack.git

Upvotes: 1

Views: 3012

Answers (1)

Daniel Mikusa
Daniel Mikusa

Reputation: 15041

pip is already installed if you are using Python 2 >=2.7.9 or Python 3 >=3.4 downloaded from python.org or if you are working in a Virtual Environment created by virtualenv or pyvenv. Just make sure to upgrade pip.

https://pip.pypa.io/en/stable/installing/#do-i-need-to-install-pip

The version of Pip is tied to the version of Python you are telling the Python buildpack to install. If you don't care about the version of Pip, simply ignore this message. It's just a warning. If you want/need a newer Pip version just install a newer version of Python.

For example, when I install Python 3.6.9, I see:

You are using pip version 18.1, however version 19.3 is available.

You can control the version of Python by adding a file runtime.txt to the root of your application (i.e. where you're running cf push or where you set path or cf push -p). Inside that file, put the version you want or a wildcard like python-3.6.x. Wildcards are highly recommended so that the buildpack will automatically update your Python version.

You can see the versions of Python available for a specific buildpack here -> https://buildpacks.cloudfoundry.org/#/buildpacks/python/v1.6.37 (note: this goes to a specific version cause that's the only way I can link, pick the version of the buildpack you're using).


Side node:

Don't do this: buildpack: https://github.com/cloudfoundry/python-buildpack.git or cf push -b https://github.com/cloudfoundry/python-buildpack.git.

This points your app to use the master branch of the Python buildpack. This is not a stable version. It can and will change frequently. While it doesn't happen often, it can even occasionally have bugs or issues.

What you want to do is either use the platform provided buildpack, which is usually python_buildpack (or something like that, run cf buildpacks to get the name, or reference a URL that has the version in it, like https://github.com/cloudfoundry/python-buildpack.git#v1.6.37. This will point you to a specific tagged release which is stable. You can reference any branch or tag on the Python buildpack repo using this syntax.

Upvotes: 3

Related Questions