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.

Running scripts with `/usr/bin/env` and `2021.11.5.post0` fails to find correct python

See original GitHub issue

Issue description

This is another regression of the recent release. The problem is running scripts using a she-bang + /usr/bin/env python to reference python. For example:

#!/usr/bin/env python

import sys

print(sys.version)

Running this as executable with the recent stable version of pipenv yields what is expected:

> pipenv --version
pipenv, version 2021.5.29
> pipenv run ./test.py
3.7.9 (default, Nov 16 2020, 11:56:37)
[Clang 12.0.0 (clang-1200.0.32.21)]

With the new version, it keeps the “default” environment (here 2.7 on a mac)

> pipenv --version
pipenv, version 2021.11.5.post0
> pipenv run ./test.py
2.7.17 (default, Dec 23 2019, 21:25:34)
[GCC 4.2.1 Compatible Apple LLVM 11.0.0 (clang-1100.0.33.16)]

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:17
  • Comments:5

github_iconTop GitHub Comments

9reactions
danielpoonwjcommented, Nov 5, 2021

I think it might be because pipenv run does not add the virtual env to $PATH.

This was what I got running in a python:3.8-buster docker container.

2021.11.5.post0

$ pipenv run printenv
PATH=/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

2021.5.29

$ pipenv run printenv
PATH=/root/.local/share/virtualenvs/app-4PlAip0Q/bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

Regardless, this definitely looks like a regression and is causing some issues for me too.

6reactions
wjmelementscommented, Nov 5, 2021

We are experiencing the same issue. Seems the PATH is broken for pipenv run. Screen Shot 2021-11-05 at 12 27 11 PM

Your deployment broke our CI. Since this breaking change made it into your release, I want to see integration tests verifying the PATH. @frostming

Read more comments on GitHub >

github_iconTop Results From Across the Web

2021-December.txt - Python mailing list
I navigated to c:\programData|Anaconda3\Scripts> and typed in 'pip install geopandas'. It ran but failed at fiona. I tried import geopandas ...
Read more >
篠田 将彦 / CI・CD, DevOps, TDD auf Twitter: „Pipenv の新ver ...
Running scripts with `/usr/bin/env` and `2021.11.5.post0` fails to find correct python · Issue... Issue description This is another ...
Read more >
nonetype' object is not callable decorator - maes.gallery
To solve this error: Python nonetype object is not iterable, ... little Python script to set ViewportCapture settings - here's the code: DEBUG...
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