question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[REQUEST] Don't use env in the script's shebang

See original GitHub issue

Is your feature request related to a problem? Please describe. Currently you are using the python interpreter that is found first in the user’s path.

https://github.com/aristocratos/bpytop/blob/73eb150abe3150082488acd00f3968f330c2dc89/bpytop.py#L1

As a python developer who often changes (conda) environments, this won’t work. So I had to change the shebang to make it use a fixed interpreter (system’s interpreter on Ubuntu 18.04).

Describe the solution you’d like I think in this specific case it might be better to hardcode a specific interpreter here, for example /usr/bin/python3 on newer distros with a python version >= 3.6 or another interpreter. If we agree on this, I can add some automation in the Makefile to adapt this during installation and create a PR.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:17 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
dehessellecommented, Aug 20, 2020

I understand your arguments @wAuner, but I believe that you are the corner case here. If your development work requires you to constantly change your environment (this is what @aristocratos meant with “your own choices”), run bpytop in a new terminal with an untouched environment or setup an alias alias btop='/usr/bin/python3 <where your bpytop is>'.

I think even a system tool is allowed to expect an environment with working interpreter lookups.

edit: ninja’d, editing for clarity

0reactions
janxkocicommented, Nov 22, 2021

Sorry for reviving an old issue - I was searching issues for “conda” to see if it was mentioned, before suggesting to add conda as an installation option.

Anyway, I use conda for R, not python, so if some app suddenly breaks when I change the conda environment, I would be quite puzzled. I install your program as an “app”, not running it as some script. The name gives away how it was made, but for a user it still should not be affected by stuff like changing dev env, imho.

On the other hand - I installed bpytop with conda into the base env and it works even in sub-environments (just like other programs I use) so in my case I don’t see the issue. I was just trying to “translate” this issue from the point of view of an “app user”.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I use environment variables in my shebang?
The general solution is to write a small shell wrapper. Name the Python script foo.py , and put the shell script next to...
Read more >
Script with env shebang hangs on Linux - Stack Overflow
We can see here that the argument to env is being interpreted as an environment variable. We also know that "node --unhandled-rejections=strict" ...
Read more >
Make Linux/Unix Script Portable With #!/usr/bin/env ... - nixCraft
Learn how to make Linux/Unix script portable with #!/usr/bin/env shebang to execute script using the interpreter such as bash, perl, python.
Read more >
On env Shebangs - Scripting OS X
The /usr/bin/env shebang provides a means for system portability. It has many valid use cases. However, you don't just magically gain ...
Read more >
Use shebang if installing locally? #639 - TypeStrong/ts-node
I have been searching for a way to use a shebang with locally installed ts-node but also in a portable way, so that...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found