Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing new versions of Python on Cygwin does not install Pip?

Tags:

python

pip

cygwin

While I am aware of the option of installing Pip from source, I'm trying to avoid going down that path so that updates to Pip will be managed by Cygwin's package management.

I've recently learned that the latest versions of Python include Pip. However, even though I have recently installed the latest versions of Python from the Cygwin repos, Bash doesn't recognize a valid Pip install on the system.

896/4086 MB RAM 0.00 0.00 0.00 1/12 Tue, Jun 16, 2015 ( 3:53:22am CDT) [0 jobs] [ethan@firetail: +2] ~ $ python -V Python 2.7.10 892/4086 MB RAM 0.00 0.00 0.00 1/12 Tue, Jun 16, 2015 ( 3:53:27am CDT) [0 jobs] [ethan@firetail: +2] ~ $ python3 -V Python 3.4.3 883/4086 MB RAM 0.00 0.00 0.00 1/12 Tue, Jun 16, 2015 ( 3:53:34am CDT) [0 jobs] [ethan@firetail: +2] ~ $ pip bash: pip: command not found 878/4086 MB RAM 0.00 0.00 0.00 1/12 Tue, Jun 16, 2015 ( 3:53:41am CDT) [0 jobs] [ethan@firetail: +2] ~ $ pip2 bash: pip2: command not found 876/4086 MB RAM 0.00 0.00 0.00 1/12 Tue, Jun 16, 2015 ( 3:53:42am CDT) [0 jobs] [ethan@firetail: +2] ~ $ pip3 bash: pip3: command not found 

Note that the installed Python 2.7.10 and Python 3.4.3 are both recent enough that they should include Pip.

Is there something that I might have overlooked? Could there be a new install of Pip that isn't in the standard binary directories referenced in the $PATH? If the Cygwin packages of Python do in fact lack an inclusion of Pip, is that something that's notable enough to warrant a bug report to the Cygwin project?

like image 649
redyoshi49q Avatar asked Jun 16 '15 09:06

redyoshi49q


People also ask

Why does Python not install pip?

One of the most common problems with running Python tools like pip is the “not on PATH” error. This means that Python cannot find the tool you're trying to run in your current directory. In most cases, you'll need to navigate to the directory in which the tool is installed before you can run the command to launch it.

Does installing Python also install pip?

PIP is automatically installed with Python 2.7.9+ and Python 3.4+ and it comes with the virtualenv and pyvenv virtual environments.

How do I install Python packages in Cygwin?

Ensure python is installed in cygwin. Type python on the terminal of cygwin and it should launch the python shell. If it doesn't launch the setup file for cygwin and select python from the package list and install.


2 Answers

cel self-answered this question in a comment above. For posterity, let's convert this helpfully working solution into a genuine answer.

Unfortunately, Cygwin currently fails to:

  • Provide pip, pip2, or pip3 packages.
  • Install the pip and pip2 commands when the python package is installed.
  • Install the pip3 command when the python3 package is installed.

It's time to roll up our grubby command-line sleeves and get it done ourselves.

What's the Catch?

Since no pip packages are currently available, the answer to the specific question of "Is pip installable as a Cygwin package?" is technically "Sorry, son."

That said, pip is trivially installable via a one-liner. This requires manually re-running said one-liner to update pip but has the distinct advantage of actually working. (Which is more than we usually get in Cygwin Land.)

pip3 Installation, Please

To install pip3, the Python 3-specific version of pip, under Cygwin:

$ python3 -m ensurepip 

This assumes the python3 Cygwin package to have been installed, of course.

pip2 Installation, Please

To install both pip and pip2, the Python 2-specific versions of pip, under Cygwin:

$ python -m ensurepip 

This assumes the python Cygwin package to have been installed, of course.

like image 76
Cecil Curry Avatar answered Sep 21 '22 21:09

Cecil Curry


  1. Download a helper package:

    • For Python 2.x install the python-setuptools package.
    • For Python 3.x install the python3-setuptools package.
  2. Run the script:

    • For Python 2.7 run: easy_install-2.7 pip
    • For Python 3.4 run: easy_install-3.4 pip
like image 31
moovon Avatar answered Sep 18 '22 21:09

moovon