Skip to content

pipenv shell command doesn't work when installing tools #4404

Closed

Description

Environment data

  • VS Code version: 1.31.1
  • Extension version (available under the Extensions sidebar): 2019.1.0
  • OS and version: Ubuntu 16.04
  • Python version (& distribution if applicable, e.g. Anaconda): 2.7.12
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): pipenv
  • Relevant/affected Python packages and their versions: rope

Expected behavior

I do not have rope installed. When I right-click some code and select "Extract method" it asks me to install rope. I select yes, and get the following output:

test@dev:~/code$ pipenv shell
pipenv install rope --dev
Loading .env environment variables...
Launching subshell in virtual environment...
test@dev:~/code$  . /home/test/code/.venv/bin/activate
(code) test@dev:~/code$

It seems to run both pipenv shell and activate. Also, pipenv install rope--dev is executed before pipenv shell has been activated. Related to this, if you close a terminal (trashcan) and open it again and start writing quickly, the text you enter end up on the same line as "pipenv shell". E.g. I often open terminal and quickly write git ts. What happens is that it looks like: git tspipenv shell. I think this might be related in some sense.

Activity

  1. ghost added
    triage-neededNeeds assignment to the proper sub-team
    on Feb 14, 2019
  2. DonJayamanne commented on Feb 14, 2019

    @DonJayamanne

    Duplicate of #4394

  3. ghost removed
    triage-neededNeeds assignment to the proper sub-team
    on Feb 14, 2019
  4. thernstig commented on Feb 15, 2019

    @thernstig
    Author

    Don Jayamanne (@DonJayamanne) Thanks for pointing it out. Was hard to find an issue due to the minimalistic information in the original :)

    I realize I kind of baked two questions into this issue, but what about this part:

    If you close a terminal (trashcan) and open it again and start writing quickly, the text you enter end up on the same line as "pipenv shell". E.g. I often open terminal and quickly write git ts. What happens is that it looks like: git tspipenv shell. I think this might be related in some sense.

    I am assuming that even though it is reverted to activate, this might still be a problem?

  5. ericarnold-granular commented on Feb 21, 2019

    @ericarnold-granular

    Is this the same thing that causes debugging to be broken when trying to launch the app directly? This is the debug def I have for our Flask app

                "name": "Flask",
                "type": "python",
                "request": "launch",
                "port": 9876,
                "module": "flask",
                "env": {
                    "FLASK_APP": "sales_aggr_svc.server",
                    "FLASK_ENV": "development",
                    "FLASK_DEBUG": "0",
                    "DEBUG": "true"
                },
                "args": [
                    "run"
                ],
                "jinja": true
    

    When I try to run it I get this:

    eric@eric-XPS-15-9560:~/sales-aggr-svc$ pipenv shell
    cd /sales-aggr-svc ; env "FLASK_APP=sales_aggr_svc.server" "FLASK_ENV=development" "FLASK_DEBUG=0" "DEBUG=true" "PYTHONIOENCODING=UTF-8" "PYTHONUNBUFFERED=1" /home/eric/.local/share/virtualenvs/sales-aggr-svc-0a-no2Bc/bin/python /home/eric/.vscode/extensions/ms-python.python-2019.1.0/pythonFiles/ptvsd_launcher.py --default --client --host localhost --port 9876 -m flask run 
    Launching subshell in virtual environment...
     . /home/eric/.local/share/virtualenvs/sales-aggr-svc-0a-no2Bc/bin/activate
    eric@eric-XPS-15-9560:~/sales-aggr-svc$  . /home/eric/.local/share/virtualenvs/sales-aggr-svc-0a-no2Bc/bin/activate
    (sales-aggr-svc) eric@eric-XPS-15-9560:~/sales-aggr-svc$ 
    

    Eventually it pops up a "Timeout waiting for debugger connection" dialog and the debugger stops.

    Oddly enough, if I point the Python interpreter at a different project, then then it sources the activate file first (which puts it in a pipenv shell) and runs the main command after that, which allows the debugger to connect. That only works if the projects have the same dependencies though.

    eric@eric-XPS-15-9560:~/sales-aggr-svc$ source /home/eric/.local/share/virtualenvs/enrollments-svc-G11ZWuBp/bin/activate
    (enrollments-svc) eric@eric-XPS-15-9560:~/sales-aggr-svc$ cd /sales-aggr-svc ; env "FLASK_APP=sales_aggr_svc.server" "FLASK_ENV=development" "FLASK_DEBUG=0" "DEBUG=true" "PYTHONIOENCODING=UTF-8" "PYTHONUNBUFFERED=1" /home/eric/.local/share/virtualenvs/enrollments-svc-G11ZWuBp/bin/python /home/eric/.vscode/extensions/ms-python.python-2019.1.0/pythonFiles/ptvsd_launcher.py --default --client --host localhost --port 9876 -m flask run
    
  6. locked as resolved and limited conversation to collaborators on Mar 21, 2019
  7. changed the title [-]Python install extension [/-] [+]`pipenv shell` command doesn't work when installing tools[/+] on Mar 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions