Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broken packaging for Windows through pip #1310

Closed
doraskayo opened this issue Jan 16, 2017 · 4 comments
Closed

Broken packaging for Windows through pip #1310

doraskayo opened this issue Jan 16, 2017 · 4 comments
Labels
OS:windows Winodows OS specific issues

Comments

@doraskayo
Copy link

doraskayo commented Jan 16, 2017

The current pip distribution turns makes Meson's Python scripts unable to run in Windows.

Reproduction steps:

  • Get Windows. (I use Windows 10, version 1607)
  • Install Python 3.x (I currently have v3.6.0:41df79263a11) and make sure you tick the "Add to PATH" checkbox.
  • Open the command prompt (cmd.exe) and run pip3 install meson
  • When it finishes installing, try to run meson.py -h

* You may have to restart at some point in the process, Windows is weird like that.

Expected results:
Meson should run and show its syntax.

Actual results:
You get the following error:

Unable to create process using 'c:\users\my user\appdata\local\programs\python\python36\python.exe "C:\Users\My User\AppData\Local\Programs\Python\Python36\Scripts\meson.py"  -h'

The reason:
If I look at the installed Meson Python scripts, I see that the shebang line is the following:

#!c:\users\my user\appdata\local\programs\python\python36\python.exe

While it should be:

#!/usr/bin/env python3

Changing this value back fixes the problem and allows me to run "meson.py -h" without any issue.

EDIT:

Apparently the issue actually comes from the fact that there is a space in the path to python.exe. Adding quotations around the path is another way to fix it, like so:

#"!c:\users\my user\appdata\local\programs\python\python36\python.exe"
@nirbheek
Copy link
Member

We don't have any special requirements, so ideally we should be able to look at some other project that is using pip on Windows successfully and do what they're doing.

@doraskayo
Copy link
Author

doraskayo commented Jan 16, 2017

I investigated this issue a bit further, and it seems the problem comes from the space in the shebang. (see my edit for more information)

Apparently the issue (or a similar issue) was reported (pypa/setuptools#398) and closed without resolution by pointing to a new issue (pypa/pip#2783). At some point later a pull request landed (pypa/setuptools#616) and was documented to be part of setuptools 24.3.1 even though it actually landed in setuptools 25.1.2, at the same time as the release notes for 24.3.1 were updated. Weird so far. Anyway, this pull request claimed to have fixed the original reported issue (pypa/setuptools#398), yet didn't actually mention the new issue that was opened. As long as it's fixed, I guess.

So then I checked my setuptools version:

C:\Users\My User\Desktop>pip3 show setuptools
Name: setuptools
Version: 28.8.0

28.8.0 > 25.1.2 > 24.3.1, right? Yet... I can still reproduce the bug.

So I ran pip3 install -U setuptools and now I got:

C:\Users\My User\Desktop>pip3 show setuptools
Name: setuptools
Version: 33.1.0

33.1.0 > 28.8.0 > 25.1.2 > 24.3.1, right? Well, I can STILL reproduce the bug.

The weirdest part? These guys claim it works for them! I honestly have no idea at this point. Can someone else confirm that they can reproduce it?

@doraskayo
Copy link
Author

doraskayo commented Jan 16, 2017

Another update, the bug can't be reproduced with this command:

pip3 install git+https://github.com/mesonbuild/meson.git@0.37.1

But it can still be reproduced it with this command:

pip3 install meson

@jpakkane, it's probably the version of setuptools that you use for packaging.

Edit:

Sorry, it's not the packaging. If I download meson-0.37.1.tar.gz from PyPi's repository website and install it manually by extracting it and using python setup.py install, I can't reproduce the bug. So...

Final conclusion: The bug is in either pip's or setuptools's codepaths, and triggers only when pip is used to install the package from the PyPi repository. It does not trigger when installing from either a local source, a remote git repository or a local copy downloaded directly from the repository website.

@nirbheek nirbheek added the OS:windows Winodows OS specific issues label Feb 15, 2017
@scivision
Copy link
Member

I'm not sure when this was fixed, but I have been pip install meson on Windows and other platforms for many months without an issue, including using as install_requires = meson from other packages. I think this was fixed by setuptools et al some time in the past.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OS:windows Winodows OS specific issues
Projects
None yet
Development

No branches or pull requests

3 participants