Install Python In Cygwin

Active9 months ago

I have Python 3 installed on Cygwin. However, I am unable to install Python 3 packages via pip. Is there a way to do this?

David Y. StephensonDavid Y. Stephenson

1)While installing cygwin, make sure you install the python/python-setuptools from the list. This will install 'easy_install' package. 2) Type the following command. If you are new to virtualenv, Fabric or pip is, Alex Clemesha’s excellent “Tools of the Modern Python Hacker” is a must-read. In short: virtualenv lets you switch seamlessly between isolated Python environments, Fabric automates remote deployment, while pip takes care of installing required packages and dependencies.

2413 gold badges14 silver badges31 bronze badges

6 Answers

1)While installing cygwin, make sure you install the python/python-setuptools from the list. This will install 'easy_install' package.

2) Type the following command:

You must replace a.b with your python version which can be 2.7 or 3.4 or whatever else.

DomainsFeatured
7981 gold badge12 silver badges26 bronze badges
moovonmoovon
1,5851 gold badge11 silver badges10 bronze badges

If you have more than one python installation, then you need to install pip (and probably also setuptools) for each installation separately.
To do so, you can first download ez_setup.py and run it with python3:

That should install setuptools, and also create an easy_install script for your python version, e.g. /usr/bin/easy_install-3.2, which you can use to install pip:

This will install pip into your python3 site packages directory, and again create a script /usr/bin/pip-3.2, which you can use to install packages for this python version.

Alternatively you can follow the install instructions from here and here.

matamata
52.1k7 gold badges118 silver badges131 bronze badges

I think the alternative install instructions linked by mata are simplest:

Install Python-dev In Cygwin

To install pip, securely download get-pip.py.

Then run the following (which may require administrator access):

svicksvick
185k42 gold badges304 silver badges425 bronze badges

Since OP specifically talks about Python3, I think we need to specify that just in case the user already have Python2 installed, which is very likely.

BTW. There are several forks of apt-cyg, but the best maintained is that of kou1okada, you'll love it.

EDIT: 2018-11-15

Because I started out not using virtualenv, I recently had to refresh my Cygwin Python3 installation, and realized a few things in the process that should have been obvious, but can easily be forgotten.

  • When installing and using Python3 on Cygwin (and probably on most other *nix distros), only install the basic Python3 interpreter as a Cygwin package. From then on, only use the pip installer.

  • After you have installed or updated any python3 packages using pip, your Cygwin package manager will complain that your package is 'Incomplete'. That is because pip has replaced/updated the files in that package. Check with: cygcheck.exe -c |grep Incomplete.
    Do not re-install those packages with Cygwin.

So what I did, was clear out all python3 related Cygwin packages, except the Python3 itself. Then I re-installed the only one needed: python3-setuptools.

That should have also have re-installed all the setuptools dependencies with the latest updates.

From now on, do yourself a favor and start using a virtual environment.

not2qubitnot2qubit
5,3002 gold badges45 silver badges74 bronze badges

On windows, you can use pip to install packages. If you have multiple python installations under cygwin, give the full python path e.g. Python 2

Python 3

In case you dont have pip installed install it using below command

Install Python In Cygwin

or

Nitin_k29Nitin_k29

I just learned, inspired from https://www.scivision.co/install-pip-in-cygwin/ and the answer before, that instead of using pip, you just have to use pip2 for python2 or pip3 for python 3 in cygwin on windows. Wondered about this the whole day...

DanielWDanielW

Not the answer you're looking for? Browse other questions tagged pythonpython-3.xcygwinpip or ask your own question.

Active5 years, 4 months ago

The Question

What is the correct way to install Python 3.0 alongside Python 2.x using Cygwin?

Notes

I already have a working copy of Cygwin, and Python 2.x is installed within Cygwin (/lib/python2.x, not c:python2.x).

Also, I would like to be able to call python 3 separately (and only intentionally) by leaving python pointing to Python 2.x to preserve existing dependencies. I would like to use python30 or some alternative.

Any pointers to guides on the subject would be much appreciated. I cannot seem to find one either at the cygwin site or python.org.

brad
bradbrad
31.2k21 gold badges64 silver badges83 bronze badges

5 Answers

The standard make install target of the Python 3.0 sources doesn't install a python binary. Instead, make install prints at the end

So don't worry.

If you easily want to remove the entire installation, do something like configure --prefix=/usr/local/py3

Martin v. LöwisMartin v. Löwis
102k14 gold badges172 silver badges220 bronze badges

As of yesterday (Wed 25 July 2012), Python 3.2.3 is included in the standard Cygwin installer. Just run Cygwin's setup.exe again (download it from cygwin.com again if you need to), and you should be able to select and install it like any other package.

This will install as python3, leaving any existing 2.x install in place:

me_andme_and
11.2k6 gold badges49 silver badges85 bronze badges

To use Python 3 in a non-intrusive manner, if you don't have one already, create a file called '.bash_profile' in your user home directory.

Set up an alias pointing at your Python 3 install. On my Windows machine this looks like so:

Run Python In Cygwin

Adjust the path according to where your install is located, and if on Windows, be careful to ensure you're using UNIX line breaks or you will get a message such as 'bash: $'r': command not found'.

You should now be able to use the 'python3' command, and you haven't modified the version of Python that came with Cygwin.

SteveSteveInstall Python In Cygwin
7,5265 gold badges34 silver badges58 bronze badges

Over in the Perl world, I always install my own, with a prefix:

I never want to deal with whatever perl came with my OS, as I don't want to install libraries for it and potentially mess up scripts that were written in the OS.

I do the same thing for Cygwin, as it's much nicer for me to be able to install my own modules and not worry that Cygwin update will trash them.

If and when I learn Python (I'd like to), I intend to do the same thing.

This way I can upgrade individual applications from one version to another independently.

For really serious applications (like a major web app), I might even do a self-contained installation owned by a user dedicated to the app.

skiphoppyskiphoppy
40.4k61 gold badges157 silver badges205 bronze badges

instead of invoking python from the command line just invoke python3 like so:

Install Python 3.6 In Cygwin

Lucifer
26.8k17 gold badges77 silver badges128 bronze badges

Cygwin Python Ide

umbregachoongumbregachoong
1441 gold badge5 silver badges21 bronze badges

Install Python On Linux

Not the answer you're looking for? Browse other questions tagged pythonwindowscygwin or ask your own question.