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

Workspace contains pipfile but attempt to run 'pipenv --venv' failed #2968

Closed
kylemart opened this issue Oct 20, 2018 · 9 comments
Closed

Workspace contains pipfile but attempt to run 'pipenv --venv' failed #2968

kylemart opened this issue Oct 20, 2018 · 9 comments
Assignees

Comments

@kylemart
Copy link

kylemart commented Oct 20, 2018

Environment data

  • VS Code version: 1.28.2 (7f3ce96ff4729c91352ae6def877e59c561f4850)
  • Extension version (available under the Extensions sidebar): 2018.9.1
  • OS and version: macOS 10.14
  • Python version (& distribution if applicable, e.g. Anaconda): 3.7.0
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): pipenv

Actual behavior

Upon opening a project folder with an existing virtual environment, I get the following error message:

Workspace contains pipfile but attempt to run 'pipenv --venv' failed with 'Traceback (most recent call last):
  File "/usr/local/bin/pipenv", line 7, in <module>
    from pipenv import cli
  File "/usr/local/lib/python3.7/site-packages/pipenv/__init__.py", line 23, in <module>
    from .cli import cli
  File "/usr/local/lib/python3.7/site-packages/pipenv/cli/__init__.py", line 3, in <module>
    from .command import cli
  File "/usr/local/lib/python3.7/site-packages/pipenv/cli/command.py", line 7, in <module>
    import crayons
  File "/usr/local/lib/python3.7/site-packages/pipenv/patched/crayons.py", line 49, in <module>
    is_powershell = "powershell" in shellingham.detect_shell()[0]
  File "/usr/local/lib/python3.7/site-packages/pipenv/vendor/shellingham/__init__.py", line 22, in detect_shell
    shell = get_shell(pid, max_depth=max_depth)
  File "/usr/local/lib/python3.7/site-packages/pipenv/vendor/shellingham/posix/__init__.py", line 54, in get_shell
    mapping = _get_process_mapping()
  File "/usr/local/lib/python3.7/site-packages/pipenv/vendor/shellingham/posix/__init__.py", line 15, in _get_process_mapping
    mapping = impl.get_process_mapping()
  File "/usr/local/lib/python3.7/site-packages/pipenv/vendor/shellingham/posix/ps.py", line 18, in get_process_mapping
    'ps', '-ww', '-o', 'pid=', '-o', 'ppid=', '-o', 'args=',
  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 376, in check_output
    **kwargs).stdout
  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 468, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['ps', '-ww', '-o', 'pid=', '-o', 'ppid=', '-o', 'args=']' returned non-zero exit status 1.'. Make sure pipenv is on the PATH.

Expected behavior

No error message.

Steps to reproduce:

  1. Create directory.
  2. Run pipenv install in the directory.
  3. Open the directory in VS Code.
@kylemart
Copy link
Author

kylemart commented Oct 20, 2018

Also, I'm using zsh.

For reference, here is the result of running echo $PATH from the terminal:

~
❯ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/VMware Fusion.app/Contents/Public:/Library/TeX/texbin:/usr/local/share/dotnet:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Applications/Xamarin Workbooks.app/Contents/SharedSupport/path-bin

Here is the result of running which pipenv:

~
❯ which pipenv
/usr/local/bin/pipenv

@brettcannon
Copy link
Member

How are you adding /usr/local/bin to your PATH?

It's possible that because we are not running commands through your personal shell (see #2363). If we implemented #2139 that would also have helped in this situation.

@brettcannon brettcannon added bug Issue identified by VS Code Team member as probable bug info-needed Issue requires more information from poster area-terminal labels Oct 22, 2018
@brettcannon brettcannon self-assigned this Oct 22, 2018
@kylemart
Copy link
Author

kylemart commented Oct 22, 2018

To be honest, I'm not certain. It's not set in my .zshrc, nor any other zsh-related configuration files that I know of. Do you have any recommendations for figuring that out?

EDIT: Right now I'm somewhat haphazardly scanning my system with egrep: sudo egrep -rn '^export PATH=.*(:/usr/local/bin|/usr/local/bin:).*$' /.

EDIT2: Thanks for following up with this, by the way!

@brettcannon
Copy link
Member

It looks to be a more fundamental issue with pipenv. Looking closer to that traceback shows you are executing pipenv, it just is unhappy with the response from that ps call. So I don't think this is being caused by the extension if it's able to find pipenv as we are not doing anything magic that would make it such that finding pipenv fail.

But to double-check, can you run pipenv --venv in the terminal from within VS Code to see if it succeeds there?

@kylemart
Copy link
Author

Launched the terminal in VS Code and ran the requested command. Here's what I got:

❯ pipenv --venv
/Users/kylemart/.local/share/virtualenvs/outfitter_scraper-G2oeZHlZ

@kylemart
Copy link
Author

Also, here's a screenshot of the developer tools window for reference:
screen shot 2018-10-23 at 4 52 13 pm

@brettcannon
Copy link
Member

And just to make sure, this is on the latest version of pipenv? Basically I'm straining in finding a way to know how this is the extension's fault since the failure is in pipenv itself since pipenv is the one calling ps.

@brettcannon brettcannon removed area-terminal bug Issue identified by VS Code Team member as probable bug labels Oct 24, 2018
@kylemart
Copy link
Author

kylemart commented Oct 24, 2018

I believe so.

❯ pipenv --version
pipenv, version 2018.10.13

I attempted to update pipenv, but it would seem 2018.10.13 is the latest version.

@brettcannon brettcannon removed the info-needed Issue requires more information from poster label Oct 25, 2018
@brettcannon
Copy link
Member

I just tested this on my macOS 10.13.6 machine and I can't reproduce. So either this is specific to Mojave and pipenv or it's an environment issue that won't be resolved until we deal with #2363.

Either way, without a way to reproduce I'm out of ideas on how to solve this or know how we could be causing it based on the fact it's failing in pipenv in a call to ps. If you're up for it, please try opening an issue on pipenv's issue tracker and see what they think. They might have a suggestion as to what's going on (which might include telling us what I can't think of 😉 ).

@lock lock bot locked as resolved and limited conversation to collaborators Nov 23, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants