Installation fails in Cygwin 64 bit

When I try a pip install requests in Cygwin 64 bit the installation fails.

Here's the end of the log file:

```
  Downloading from URL https://pypi.python.org/packages/source/r/requests/requests-1.2.3.tar.gz#md5=adbd3f18445f7fe5e77f65c502e264fb (from https://pypi.python.org/simple/requests/)
  Running setup.py egg_info for package requests

Cleaning up...

  Removing temporary dir /cygdrive/d/home/greger/cygwin/projects/myproject/build...
No files/directories in /cygdrive/d/home/greger/cygwin/projects/myproject/build/requests/pip-egg-info (from PKG-INFO)

Exception information:
Traceback (most recent call last):
  File "/cygdrive/d/home/greger/cygwin/projects/myproject/lib/python2.7/site-packages/pip/basecommand.py", line 134, in main
    status = self.run(options, args)
  File "/cygdrive/d/home/greger/cygwin/projects/myproject/lib/python2.7/site-packages/pip/commands/install.py", line 236, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "/cygdrive/d/home/greger/cygwin/projects/myproject/lib/python2.7/site-packages/pip/req.py", line 1139, in prepare_files
    req_to_install.assert_source_matches_version()
  File "/cygdrive/d/home/greger/cygwin/projects/myproject/lib/python2.7/site-packages/pip/req.py", line 394, in assert_source_matches_version
    version = self.installed_version
  File "/cygdrive/d/home/greger/cygwin/projects/myproject/lib/python2.7/site-packages/pip/req.py", line 390, in installed_version
    return self.pkg_info()['version']
  File "/cygdrive/d/home/greger/cygwin/projects/myproject/lib/python2.7/site-packages/pip/req.py", line 357, in pkg_info
    data = self.egg_info_data('PKG-INFO')
  File "/cygdrive/d/home/greger/cygwin/projects/myproject/lib/python2.7/site-packages/pip/req.py", line 293, in egg_info_data
    filename = self.egg_info_path(filename)
  File "/cygdrive/d/home/greger/cygwin/projects/myproject/lib/python2.7/site-packages/pip/req.py", line 330, in egg_info_path
    raise InstallationError('No files/directories in %s (from %s)' % (base, filename))
InstallationError: No files/directories in /cygdrive/d/home/greger/cygwin/projects/myproject/build/requests/pip-egg-info (from PKG-INFO)
```

Don't know if that is a problem with the installation package, or cygwin itself. But thought I'd try here first. 

If I try to use easy_install it just leaves all the files in the tmp-dir.  And if I from there try to do a python setup.py install, and then try to import requests from the python shell, it just exits without and output.


Hmm, I can't reproduce this. =( But I wonder if you're using a Windows virtualenv with a Windows interpreter in Cygwin. It's not clear (to me) how well that would work.


You are right, I did try through VirtualEnv and with VirtualenvWrapper. Tried again now from just regular cygwin prompt, and here's the log, again:

```
  Downloading from URL https://pypi.python.org/packages/source/r/requests/requests-1.2.3.tar.gz#md5=adbd3f18445f7fe5e77f65c502e264fb (from https://pypi.python.org/simple/requests/)
  Running setup.py egg_info for package requests

Cleaning up...

  Removing temporary dir /tmp/pip_build_greger...
No files/directories in /tmp/pip_build_greger/requests/pip-egg-info (from PKG-INFO)

Exception information:
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/pip-1.4.1-py2.7.egg/pip/basecommand.py", line 134, in main
    status = self.run(options, args)
  File "/usr/lib/python2.7/site-packages/pip-1.4.1-py2.7.egg/pip/commands/install.py", line 236, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "/usr/lib/python2.7/site-packages/pip-1.4.1-py2.7.egg/pip/req.py", line 1139, in prepare_files
    req_to_install.assert_source_matches_version()
  File "/usr/lib/python2.7/site-packages/pip-1.4.1-py2.7.egg/pip/req.py", line 394, in assert_source_matches_version
    version = self.installed_version
  File "/usr/lib/python2.7/site-packages/pip-1.4.1-py2.7.egg/pip/req.py", line 390, in installed_version
    return self.pkg_info()['version']
  File "/usr/lib/python2.7/site-packages/pip-1.4.1-py2.7.egg/pip/req.py", line 357, in pkg_info
    data = self.egg_info_data('PKG-INFO')
  File "/usr/lib/python2.7/site-packages/pip-1.4.1-py2.7.egg/pip/req.py", line 293, in egg_info_data
    filename = self.egg_info_path(filename)
  File "/usr/lib/python2.7/site-packages/pip-1.4.1-py2.7.egg/pip/req.py", line 330, in egg_info_path
    raise InstallationError('No files/directories in %s (from %s)' % (base, filename))
InstallationError: No files/directories in /tmp/pip_build_greger/requests/pip-egg-info (from PKG-INFO)
```


Tested again in a clean installed Cygwin64 bit, same error. 
It does work in 32 bit version of Cygwin, though. 


That's truly bizarre. It looks like pip is being installed as part of Cygwin, so you shouldn't have any 32/64 bit problems, but I kinda have to believe you are.


I did install pip with easy_install , so the problem might lay there. Still a bit weird, since pip has no problem installing lots of other packages. 


I was under the impression pip was broken on Windows but I'm probably stuck in the past.


Pip works fine on Windows, and in my experience is fine in Cygwin too. Except for this.


same here the requests not install behind cygwin


I'm getting the same behavior as the OP:  "pip install requests" works on 32 bit cygwin, but fails on 64 bit cygwin with messages about "no files/directories".

Possibly unrelated, but installation-relevant & equally mysterious:  64 bit cygwin wget fails to verify certs for https URLs, while 32 bit cygwin wget succeeds.  (Certs are identical on each install, and running the 32 bit wget inside a 64 bit installation [including /usr/ssl/certs directory] works, too.)  Anyway, what I'm saying is that installing python stuff under 64 bit cygwin has been a pain in the butt, and I'm keen to hear solutions.  


This sounds like an issue with pip itself.


I like the way you think @kennethreitz. :P

It sounds more to me, however, that 64 bit cygwin is broken (maybe).


Same thing here. Very interested if someone finds a solution.


Have any details you can add @tanzaho ?


I get the following when run on cygwin64 and trying to pip install the module : 
Downloading requests-1.2.3.tar.gz (348kB): 348kB downloaded
  Running setup.py egg_info for package requests
Cleaning up...
No files/directories in /home/tanzaho/.virtualenvs/django_wordiz/build/requests/pip-egg-info (from PKG-INFO)


I'm a bit new to running python setup scripts, especially under 64 bit cygwin in Windows 8.  But firewall issues forced me to download the requests-1.2.3.tar.gz file by hand (I couldn't use pip or easy_install without timeouts).  I gunzipped and untarred the file and then went in to the directory and ran:

> python setup.py install

by hand, and it doesn't output anything and returns to the prompt.  Nothing is created in any of the cygwin /usr/lib/python*/site-packages directories.  So I think that the process for running the above command is broken rather than it being a connectivity problem or a problem with pip itself.  So, you probably don't need to reproduce any network problems to reproduce this problem.  Just try to do the above and see if you get the same thing when installing from the command line in a cygwin terminal.

Would like to see this fixed too, as pip and easy_install aren't options for me to install libraries.

Also, I get core dumps if I try to execute the command above with "python3" or "python3.2" instead of "python".


> Also, I get core dumps if I try to execute the command above

@mikewn could you provide those? I'm wondering if this isn't an issue in the way Python is built for Windows now. I don't have a windows box to test with though. (Also I didn't know anyone was willing to subject themselves to the horror of Windows 8 ;))


@sigmavirus24 I have Windows 8. =) Strongly considering moving to Linux on that machine though. Anyway, off-topic.

It's worth noting that this is absolutely not reproducible on 32-bit Cygwin on Windows 7, which strongly points to a problem with Cygwin.


@sigmavirus24 - here's the dump.  Basically running python3 or python3.2 both yield stack dumps for python 3.2.  And no, this isn't my personal box that I'm running Windows 8 on.  :)

https://gist.github.com/mikewn/6688148


Does the script, perchance, call a subprocess that uses the UUID module in Python?  It turns out that the UUID module in Cygwin64 Python is [currently segfaulting](http://permalink.gmane.org/gmane.comp.python.ipython.devel/11239), which might be causing mysterious failures.


The install script doesn't but urllib3 does use the uuid module for 
`multipart/form-data`. Since everything is "compiled" upon install if it tries 
to even import it then this could certainly be the issue. We could go back to 
the environment flag to prevent compilation of bytecode but we had our heads 
handed to us for that.


This is really an upstream problem for CPython and the Cygwin folks in my mind, so I'm not sure this is on you.  I'll post a clean uuid patch against the current Python release on Cygwin on here for the self-starters.  


Just a confirmation that I can install requests correctly with my UUID-patch Python.  I just successfully completed a python setup.py install and the test suite passes.  I'm putting together a patch for the Cygwin folks, I'll post back here when it's ready.


Thanks @ahmadia! I'll close this when you let us know the outcome. Otherwise I want it to be easy to find


Until the patch lands in Cygwin's official repository, you will need to hotfix your existing Python.  You can do with the following simple [patch from Evgeny Sologubov](http://bugs.python.org/file31377/uuid.patch) which short-circuits the uuid module from attempting to load further libraries after the uuid routines have been located.

Apply the following patch to the uuid.py module in /usr/lib/python2.7

```
diff -r 4a318a45c4c3 Lib/uuid.py
--- a/Lib/uuid.py   Mon Aug 19 13:07:18 2013 -0400
+++ b/Lib/uuid.py   Mon Aug 19 21:41:08 2013 +0400
@@ -429,6 +429,8 @@
             _uuid_generate_random = lib.uuid_generate_random
         if hasattr(lib, 'uuid_generate_time'):
             _uuid_generate_time = lib.uuid_generate_time
+            if _uuid_generate_random is not None:
+                break  # found everything we were looking for

     # The uuid_generate_* functions are broken on MacOS X 10.5, as noted
     # in issue #8621 the function generates the same sequence of values
```


Since there's a solution here, I'm actually tempted to close this. How do you feel @Lukasa ?


Here's a two-liner to hotfix CPython from your Cygwin shell until the patch lands in Cygwin-apps (assuming you've got wget installed):

```
wget http://bugs.python.org/file31377/uuid.patch 
patch -d /usr/lib/python2.7 -p2 < uuid.patch 
```

+1 on closing this issue.


@Lukasa ?


Oh man I meant to write on this and I didn't. I think we should keep it open until cygwin fixes itself. Based on the pain we had with header keys after that issue got closed, I suspect people don't look at closed issues.


@Lukasa sometimes people don't even look at open ones =P. Either way you're correct. I wonder if we might want a special tag for this kind of issue (where there's a problem we cannot resolve but has some kind of fix available.


I'm amazed with this process/progress! Awesome work!