Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines
Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.
REPEAT: Do NOT report bugs for outdated packages!
https://wiki.archlinux.org/title/Bug_reporting_guidelines
Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.
REPEAT: Do NOT report bugs for outdated packages!
FS#59568 - [powerline] Powerline breaks when in virtual environments
Attached to Project:
Community Packages
Opened by Chris Scutcher (cscutcher) - Wednesday, 08 August 2018, 13:45 GMT
Last edited by Jiachen Yang (farseerfc) - Wednesday, 12 September 2018, 10:27 GMT
Opened by Chris Scutcher (cscutcher) - Wednesday, 08 August 2018, 13:45 GMT
Last edited by Jiachen Yang (farseerfc) - Wednesday, 12 September 2018, 10:27 GMT
|
DetailsDescription:
Powerline doesn't function when running inside of a Python virtual environment. Results in the following error; Traceback (most recent call last): File "/usr/bin/powerline", line 22, in <module> from powerline.lib.encoding import get_preferred_output_encoding ImportError: No module named powerline.lib.encoding Traceback (most recent call last): File "/usr/bin/powerline", line 22, in <module> from powerline.lib.encoding import get_preferred_output_encoding ImportError: No module named powerline.lib.encoding I believe this is because the main `powerline` command uses a `#!/usr/bin/env python` which resolves to the virtualenv python which in turn does not have access to the powerline libraries. This does not affect the other required powerline commands which all use `#!/usr/bin/python` instead. > head -n1 /usr/bin/powerline-* ==> /usr/bin/powerline-config <== #!/usr/bin/python ==> /usr/bin/powerline-daemon <== #!/usr/bin/python ==> /usr/bin/powerline-lint <== #!/usr/bin/python ==> /usr/bin/powerline-render <== #!/usr/bin/python This seems to affect powerline-2.6-2 and above. Prior to this version the main `powerline` script is not a python script with a shebang but instead a compiled executable and so does not suffer interference from the virtualenv. Affects: * powerline-2.6-2 * powerline-2.6-3 It might also affect powerline2 but I haven't had a chance to check. I suspect the cause might be something to do with the recent Python 3.7 upgrade in which case it's doubtful this would affect powerline2. Steps to reproduce: * Install powerline-2.6-3 * Activate a virtual environment that doesn't have access to system packages and does not have powerline installed. Workaround: A quick workaround can be achieved by editing the shebang line for `/usr/bin/powerline` to `#!/usr/bin/python` which will ensure that when ones shell, vim or whatever runs powerline inside a virtualenv it gets the system python (and packages) rather than that of the virtualenv. Cause: I'm not entirely sure what caused the change in behaviour. I believe setuptools is normally responsible for changing the shebangs from `#!/usr/bin/env python` (as they are in the source https://github.com/powerline/powerline/blob/2.6/scripts/powerline-config#L1) to `#!/usr/bin/python`. Powerline also has some special behaviour in it's `setup.py` which affects the `powerline` script/executable (https://github.com/powerline/powerline/blob/2.6/setup.py). It tries to compile a binary executable version of `powerline` and if that fails falls back to a sh script (if socat, sed and sh can be found by which) or a straight python script otherwise (which seems to be the case since pkg version 2). So based on that I'd say the change in behaviour is due to the failed compilation of the binary, perhaps in turn caused by the upgrade to Python 3.7. However even if this is the case, I can't understand why the same logic that converts the shebang for the other powerline scripts doesn't come into play for the python version of the powerline script that is included when the compilation fails. Possible fixes: * Get the executable version of powerline compiling again. * Manually tweak the shebang in the PKGBUILD. |
This task depends upon
Closed by Jiachen Yang (farseerfc)
Wednesday, 12 September 2018, 10:27 GMT
Reason for closing: Fixed
Additional comments about closing: From 2.7-2 we now explicitly install the binary version of powerpill and fail if there is any error during compiling of the binary. hope this will catch the problem in the future.
Wednesday, 12 September 2018, 10:27 GMT
Reason for closing: Fixed
Additional comments about closing: From 2.7-2 we now explicitly install the binary version of powerpill and fail if there is any error during compiling of the binary. hope this will catch the problem in the future.
I'm an experienced Python developer but a novice when it comes to Arch packaging so even if nobody has time to look at this bug, any tips diagnosing the compilation of the package would be appreciated. I've tried running makepkg locally and end up with a different output than is currently published in pkg version 3 (I end up with the "sh" script rather than the executable or python versions). What's the best way to ensure I have a consistent environment with whatever builds the packages? Couldn't see an answer scanning the wiki. Is there a different script, docker or something?
Thanks for any help!
```
for v in 2.3-4 2.3-5 2.3-6 2.4-1 2.5-1 2.5-2 2.5-3 2.5-4 2.5.2-1 2.6-1 2.6-2 2.6-3 2.7-1;do echo $v; tar -Oxf =(curl -s https://archive.archlinux.org/packages/p/powerline/powerline-$v-x86_64.pkg.tar.xz) usr/bin/powerline | file -b -;done
2.3-4
ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=6ce37b77567ba057d930fae77973c47705fbd4df, stripped
2.3-5
ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=6ce37b77567ba057d930fae77973c47705fbd4df, stripped
2.3-6
ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=6ce37b77567ba057d930fae77973c47705fbd4df, stripped
2.4-1
ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=6ce37b77567ba057d930fae77973c47705fbd4df, stripped
2.5-1
ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=74f7ecbce4c986c12eb9976c609a507d666d04e3, stripped
2.5-2
ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=dc2f49f119e75a908b6e91a79e44cbc64b85c977, stripped
2.5-3
ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=dc2f49f119e75a908b6e91a79e44cbc64b85c977, stripped
2.5-4
ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=8a4c39985af3a9730c002c7f37f3f52232a439a7, stripped
2.5.2-1
ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=8a4c39985af3a9730c002c7f37f3f52232a439a7, stripped
2.6-1
ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=9d689860d500bc131ed10298937183b55cfb7f8f, stripped
2.6-2
Python script, ASCII text executable
2.6-3
Python script, ASCII text executable
2.7-1
ELF 64-bit LSB shared object x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=7b881f0bd97107907ee4820ae4cee93ce19dec0a, stripped
```
I will look into how a rebuild may cause the binary compiling step to fail and check for this in latter release.
Cheers
Chris