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

./mach bootstrap failure, possibly changes in python packages API #24541

Closed
hbina opened this issue Oct 24, 2019 · 8 comments
Closed

./mach bootstrap failure, possibly changes in python packages API #24541

hbina opened this issue Oct 24, 2019 · 8 comments
Labels

Comments

@hbina
Copy link
Contributor

@hbina hbina commented Oct 24, 2019

From a clean installation of Ubuntu 18.04.3

hbina@akarin:~/git/servo$ ./mach bootstrap
Traceback (most recent call last):
  File "./mach", line 103, in <module>
    main(sys.argv)
  File "./mach", line 31, in main
    sys.exit(mach_bootstrap.bootstrap_command_only(topdir))
  File "/home/hbina/git/servo/python/mach_bootstrap.py", line 227, in bootstrap_command_only
    from servo.bootstrap import bootstrap
  File "/home/hbina/git/servo/python/servo/bootstrap.py", line 11, in <module>
    import distro
ImportError: No module named distro

Simple enough, lets install module distro...

hbina@akarin:~/git/servo$ ./mach bootstrap
Traceback (most recent call last):
  File "./mach", line 103, in <module>
    main(sys.argv)
  File "./mach", line 31, in main
    sys.exit(mach_bootstrap.bootstrap_command_only(topdir))
  File "/home/hbina/git/servo/python/mach_bootstrap.py", line 234, in bootstrap_command_only
    bootstrap(context, force)
  File "/home/hbina/git/servo/python/servo/bootstrap.py", line 403, in bootstrap
    distrib, version = get_linux_distribution()
  File "/home/hbina/git/servo/python/servo/bootstrap.py", line 348, in get_linux_distribution
    distrib = six.ensure_str(distrib)
AttributeError: 'module' object has no attribute 'ensure_str'
@jdm
Copy link
Member

@jdm jdm commented Oct 24, 2019

Any difference if you remove python/_virtualenv? https://six.readthedocs.io/#six.ensure_str suggests that it should work.

@hbina
Copy link
Contributor Author

@hbina hbina commented Oct 24, 2019

Nope, still the same error.

hbina@akarin:~/git/servo$ rm -rf python/
mach_bootstrap.py      requirements-salt.txt  servo/                 tox.ini                
README.md              requirements.txt       tidy/                  _virtualenv/           
hbina@akarin:~/git/servo$ rm -rf python/_virtualenv/
hbina@akarin:~/git/servo$ ./mach bootstrap
Traceback (most recent call last):
  File "./mach", line 103, in <module>
    main(sys.argv)
  File "./mach", line 31, in main
    sys.exit(mach_bootstrap.bootstrap_command_only(topdir))
  File "/home/hbina/git/servo/python/mach_bootstrap.py", line 234, in bootstrap_command_only
    bootstrap(context, force)
  File "/home/hbina/git/servo/python/servo/bootstrap.py", line 403, in bootstrap
    distrib, version = get_linux_distribution()
  File "/home/hbina/git/servo/python/servo/bootstrap.py", line 348, in get_linux_distribution
    distrib = six.ensure_str(distrib)
AttributeError: 'module' object has no attribute 'ensure_str'
@jdm
Copy link
Member

@jdm jdm commented Oct 24, 2019

I wonder if bootstrap doesn't go through the whole virtualenv setup. What if you update your installed six package? You need six 1.12, based on https://github.com/benjaminp/six/blob/aa4e90bcd7b7bc13a71dfaebcb2021f4caaa8432/CHANGES#L13.

@hbina
Copy link
Contributor Author

@hbina hbina commented Oct 24, 2019

That seems to have solved it albeit being inconvenient.

hbina@akarin:~$ pip install -I six==1.12
Collecting six==1.12
  Cache entry deserialization failed, entry ignored
  Cache entry deserialization failed, entry ignored
  Downloading https://files.pythonhosted.org/packages/73/fb/00a976f728d0d1fecfe898238ce23f502a721c0ac0ecfedb80e0d88c64e9/six-1.12.0-py2.py3-none-any.whl
Installing collected packages: six
Successfully installed six-1.12.0
hbina@akarin:~$ cd git/servo/
hbina@akarin:~/git/servo$ ./mach bootstrap
Dependencies were already installed!
@hbina hbina closed this Oct 24, 2019
@JoshMcguigan
Copy link
Contributor

@JoshMcguigan JoshMcguigan commented Oct 27, 2019

I see the same issue (with the same resolution) on Fedora 30, after manually installing python 2. Is this something that could/should be fixed in the bootstrap scripts? I'd be happy to submit a PR but I'm not quite sure where to start.

@jdm
Copy link
Member

@jdm jdm commented Oct 27, 2019

It sounds like that's the appropriate fix, yeah. We probably want to travel the code from the Mach script in the root directory and see what's different about the bootstrap command that end up in python/servo/bootstrap.py.

@JoshMcguigan
Copy link
Contributor

@JoshMcguigan JoshMcguigan commented Oct 27, 2019

Tracing the code path from the root ./mach to python/servo/bootstrap.py, I don't see anything that would install distro or six. Perhaps it is because _activate_virtualenv isn't called in bootstrap_command_only (it is only called in bootstrap) within /python/mach_bootstrap.py?

@jdm
Copy link
Member

@jdm jdm commented Oct 27, 2019

That sounds very likely!

@JoshMcguigan JoshMcguigan mentioned this issue Oct 28, 2019
4 of 5 tasks complete
bors-servo added a commit that referenced this issue Nov 14, 2019
mach bootstrap - activate virtual env

This modifies the `./mach bootstrap` script to activate the python virtual environment, fixing issues on systems that don't have `six` and `distro` pre-installed.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #24561 (also relevant to #24541)

<!-- Either: -->
- [ ] There are tests for these changes OR
- [x] These changes do not require tests because they are in the `./mach bootstrap` script - although this may be something that could be checked in CI - Is there any interest in setting this up?
bors-servo added a commit that referenced this issue Nov 14, 2019
mach bootstrap - activate virtual env

This modifies the `./mach bootstrap` script to activate the python virtual environment, fixing issues on systems that don't have `six` and `distro` pre-installed.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #24561 (also relevant to #24541)

<!-- Either: -->
- [ ] There are tests for these changes OR
- [x] These changes do not require tests because they are in the `./mach bootstrap` script - although this may be something that could be checked in CI - Is there any interest in setting this up?
bors-servo added a commit that referenced this issue Nov 15, 2019
mach bootstrap - activate virtual env

This modifies the `./mach bootstrap` script to activate the python virtual environment, fixing issues on systems that don't have `six` and `distro` pre-installed.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #24561 (also relevant to #24541)

<!-- Either: -->
- [ ] There are tests for these changes OR
- [x] These changes do not require tests because they are in the `./mach bootstrap` script - although this may be something that could be checked in CI - Is there any interest in setting this up?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.