Skip to content

Clarify msys/python requirements on Windows. - #10665

Closed
zbynekwinkler wants to merge 1 commit into
servo:masterfrom
zbynekwinkler:native-windows-python
Closed

zbynekwinkler wants to merge 1 commit into
servo:masterfrom
zbynekwinkler:native-windows-python

Conversation

@zbynekwinkler

Copy link
Copy Markdown
Contributor

Attempting to address #9168.

cc @larsbergstrom


This change is Reviewable

@highfive

Copy link
Copy Markdown

Thanks for the pull request, and welcome! The Servo team is excited to review your changes, and you should hear from @larsbergstrom (or someone else) soon.

@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Apr 17, 2016
@ghost ghost assigned larsbergstrom and unassigned pcwalton Apr 17, 2016
@larsbergstrom

Copy link
Copy Markdown
Contributor

I'm going to try this out locally in the next day or two, but the last few times I've tried to run Servo with the msys python, we've had horrible errors due to various scripts expecting the mingw python instead of the msys one.

@jasonwilliams

Copy link
Copy Markdown
Contributor

Testing now in a VM

@zbynekwinkler

Copy link
Copy Markdown
Contributor Author

To prevent a misunderstanding - I was not proposing to use the msys python but the native windows python. The edits I proposed go to that end. The msys python does not even need to be installed and if the mingw python was not a dependency of gdb, it could go away as well. I figured the native windows python is going to be fully supported and the msys and mingw pythons are just too confusing.

@jasonwilliams

Copy link
Copy Markdown
Contributor

@zwn i'm just following your readme (the windows bit)

@jasonwilliams

Copy link
Copy Markdown
Contributor

@larsbergstrom @zwn
Ok so i've ran through the readme, on your commit, from a clean Windows 10 (64bit) OS

Here was the output when running ./mach build

$ ./mach build
Python virtualenv failed to execute properly: Traceback (most recent call last):
  File "C:/msys64/home/IEUser/servo/python/_virtualenv/lib/python2.7/site.py", line 703, in <module>
    main()
  File "C:/msys64/home/IEUser/servo/python/_virtualenv/lib/python2.7/site.py", line 692, in main
    aliasmbcs()
  File "C:/msys64/home/IEUser/servo/python/_virtualenv/lib/python2.7/site.py", line 515, in aliasmbcs
    import locale, codecs
  File "C:/msys64/home/IEUser/servo/python/_virtualenv/lib/python2.7/locale.py", line 19, in <module>
    import functools
ImportError: No module named functools

https://pastebin.mozilla.org/8870280

Secondly here's some readme notes which i made along the way so they can be improved:

  • Mention to add Python (and the Scripts folder) to the system path. Otherwise some users will wonder why pip doesn’t work in the next step.
  • Mention to pick the x86_64 version when installing msys2?
  • How do we adjust the path? Create a bash file?
    • Maybe mention to edit the bash_profile inside "C:\msys64\home[User]” and add... PATH=/c/Python27:/c/Python27/Scripts:${PATH} at the bottom of the script

@zbynekwinkler

Copy link
Copy Markdown
Contributor Author

@Jayflux Thanks for testing. Could you please take a look what is the value of virtualenv at
https://github.com/zwn/servo/blob/master/python/mach_bootstrap.py#L106
From the error it seems to be mixing different pythons. It is most likely calling virtualenv from msys or mingw. If that is the case, uninstalling it from msys could be the solution (that is currently missing in the readme).

@jasonwilliams

Copy link
Copy Markdown
Contributor

@zwn

$ ./mach build
C:\Python27\Scripts/virtualenv.exe
Python virtualenv failed to execute properly: Traceback (most recent call last):
  File "C:/msys64/home/IEUser/servo/python/_virtualenv/lib/python2.7/site.py", line 703, in <module>
    main()
  File "C:/msys64/home/IEUser/servo/python/_virtualenv/lib/python2.7/site.py", line 692, in main
    aliasmbcs()
  File "C:/msys64/home/IEUser/servo/python/_virtualenv/lib/python2.7/site.py", line 515, in aliasmbcs
    import locale, codecs
  File "C:/msys64/home/IEUser/servo/python/_virtualenv/lib/python2.7/locale.py", line 19, in <module>
    import functools
ImportError: No module named functools

@zbynekwinkler

Copy link
Copy Markdown
Contributor Author

@Jayflux So that is right. Could you please delete the C:/msys64/home/IEUser/servo/python/_virtualenv/ directory and try one more time? The directory will be recreated in a clean state on the next run of mach build.

@jasonwilliams

Copy link
Copy Markdown
Contributor

@zwn same..

$ ./mach build
C:\Python27\Scripts/virtualenv.exe
Python virtualenv failed to execute properly: Traceback (most recent call last):
  File "C:/msys64/home/IEUser/servo/python/_virtualenv/lib/python2.7/site.py", line 703, in <module>
    main()
  File "C:/msys64/home/IEUser/servo/python/_virtualenv/lib/python2.7/site.py", line 692, in main
    aliasmbcs()
  File "C:/msys64/home/IEUser/servo/python/_virtualenv/lib/python2.7/site.py", line 515, in aliasmbcs
    import locale, codecs
  File "C:/msys64/home/IEUser/servo/python/_virtualenv/lib/python2.7/locale.py", line 19, in <module>
    import functools
ImportError: No module named functools

@metajack

Copy link
Copy Markdown
Collaborator

This seems like a python installation problem. functools is in the standard library. There are, as I recall, three versions of Python involved on windows, and I don't recall which one should be the one involved here. It looks like you are calling virtualenv with the standard Python. @larsbergstrom is that correct?

I'll have a Windows machine for testing in a day or so, and I'll be sure to run through these instructions very carefully. I'm guessing it will just take a few people running into problems before we get them reliable.

@larsbergstrom

Copy link
Copy Markdown
Contributor

@metajack We've had troubles getting the native Windows python to work with mach & the various tools. Vlad and I sunk a lot of time into poking at it and asked folks on the Gecko side for tips, but were never able to get it working, due to differences in expectations about paths e.g., inside of the virtualenv structure.

Maybe we could make it work in conjunction with the other python patch that removes usage of virtualenv in mach? But then I'm worried we'll end up on some other fragile path.

It's really not a good situation, and I don't have a great answer.

@jasonwilliams

Copy link
Copy Markdown
Contributor

@larsbergstrom there's a patch to remove virtualenv?
Is that ticketed? i think its worth doing, it seems like virtualenv is causing us a world of pain

@larsbergstrom

Copy link
Copy Markdown
Contributor

@Jayflux #11060

@larsbergstrom

Copy link
Copy Markdown
Contributor

@metajack Did you run through these instructions to see if they're correct w.r.t. your new setup?

@metajack

Copy link
Copy Markdown
Collaborator

I believe the docs are in pretty good shape. The only thing I can remember that I did that isn't listed is setting my system environment variables in Windows to add C:\Python2.7 and C:\Python2.7\Scripts.

I suspect these alternate instructions are correct, and achieve the same thing as removing/renaming the python binaries.

It would be nice to hoist the PATH modification up into Windows though, since we'll need that for native MSVC builds.

@larsbergstrom

Copy link
Copy Markdown
Contributor

@metajack Specifically, we don't need to do easy_install-2.7 pip virtualenv anymore?

@metajack

Copy link
Copy Markdown
Collaborator

I'd have to do a clean install to verify that. I can't remember if the default Python27 dir included Scripts/virtualenv.exe and Scripts/pip.exe.

Those appear to have been added to standard python distros sometime late in the 2.7 series. If so, that may explain why we had different results if we did it at different enough times to straddle that change.

@zeusintuivo

Copy link
Copy Markdown
Contributor

I have researched and documented an effective way to have windows environments set up for 32 and 64 bits in Windows 7. I assume this will work in all windowses.
Please see documentation I posted in this ticket. #12356

@bors-servo

Copy link
Copy Markdown
Contributor

☔ The latest upstream changes (presumably #12578) made this pull request unmergeable. Please resolve the merge conflicts.

@highfive highfive added the S-needs-rebase There are merge conflict errors. label Jul 25, 2016
@larsbergstrom

Copy link
Copy Markdown
Contributor

Once we land MSVC support (#11756), I suspect that we are going to remove the complicated msys/mingw build path, as all it gets us is slightly better Rust variable name dumping in gdb, at the cost of very complicated build and test configurations. So, I am going to close this in favor of trying to move away from msys/mingw.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-awaiting-review There is new code that needs to be reviewed. S-needs-rebase There are merge conflict errors.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants