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

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

Closed
thernstig opened this issue Feb 14, 2019 · 3 comments
Closed

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

thernstig opened this issue Feb 14, 2019 · 3 comments

Comments

@thernstig
Copy link

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.

@ghost ghost added the triage-needed Needs assignment to the proper sub-team label Feb 14, 2019
@DonJayamanne
Copy link

Duplicate of #4394

@DonJayamanne DonJayamanne marked this as a duplicate of #4394 Feb 14, 2019
@ghost ghost removed the triage-needed Needs assignment to the proper sub-team label Feb 14, 2019
@thernstig
Copy link
Author

@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?

@ericarnold-granular
Copy link

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

@lock lock bot locked as resolved and limited conversation to collaborators Mar 21, 2019
@karrtikr karrtikr changed the title Python install extension pipenv shell command doesn't work when installing tools Mar 19, 2021
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

3 participants