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

Using up-arrow in Python terminal for conda env does not show last command #49980

Closed
jn7dt opened this issue May 16, 2018 · 9 comments
Closed
Assignees
Labels
info-needed Issue requires more information from poster *not-reproducible Issue cannot be reproduced by VS Code Team member as described terminal Integrated terminal issues

Comments

@jn7dt
Copy link

jn7dt commented May 16, 2018

(Copied from vscode-python)

Environment data

  • VS Code version: 1.23.1
  • Extension version (available under the Extensions sidebar): 2018.4.0
  • OS and version: Windows 10 1709 (Build 16299.309)
  • Python version (& distribution if applicable, e.g. Anaconda): 3.6.4 Anaconda (64-bit)
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): conda
  • Relevant/affected Python packages and their versions:

Actual behavior

  • last command is not displayed in integrated terminal when up-arrow is pressed within Python REPL

Expected behavior

  • last command would be displayed

Steps to reproduce:

  1. Ctrl + Shift + P -> Python: Create Terminal create_python_terminal
  2. (in terminal window) type "python" to start REPL terminal_start_activate_env
  3. (enter any command, for example:) test = 'testing' up_arrow_nothing
  4. press up-arrow to display last command (nothing happens)

Starting REPL with Ctrl + Shift + P -> Python: Start REPL and then continuing with steps 3 and 4 results in the same issue.

@vscodebot
Copy link

vscodebot bot commented May 16, 2018

(Experimental duplicate detection)
Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:

@vscodebot vscodebot bot added the terminal Integrated terminal issues label May 16, 2018
@Tyriar
Copy link
Member

Tyriar commented May 16, 2018

Works for me when I launch a powershell terminal and run python in it, which I think is what the Python extension does https://github.com/Microsoft/vscode-python/blob/master/src/client/common/terminal/service.ts#L58-L76, not sure what that stripe_page stuff is doing though.

@brettcannon can you reproduce?

@Tyriar Tyriar added the info-needed Issue requires more information from poster label May 16, 2018
@brettcannon
Copy link
Member

@Tyriar nope. Either this is some crazy readline issue, or it's the OP's Python install.

@jn7dt
Copy link
Author

jn7dt commented May 16, 2018

The "&cmd /k 'activate stripe_page & powershell'" is activating the conda virtualenv (stripe_page in this case).

You are right that in a normal integrated powershell terminal, the up-arrow works as expected within the Python REPL. However, I believe that calls the Python env on my system path rather than the virtual/conda env. Using the Python extension to start a terminal or REPL uses the virtual/conda env that I have selected. See version difference here when simply running "python" from powershell, and where up-arrow displays last command:
image

EDIT: Should opening a powershell terminal and running python act the same as the Python: Create Terminal or Python: Start REPL commands, in that it should use my designated virtual/conda env within the Python extension? Is there some user config setting that may be messed up somewhere for me?

@brettcannon
Copy link
Member

@jn7dt no, running python3 from a standard terminal is not the same as Python: Create Terminal as the latter activates the conda environment as you noticed.

This is quickly sounding like there's an issue in your conda env in that readline or something is not installed and that's causing your REPL to not have history available (or somehow the way we have to activate your conda environment, but until conda natively supports PowerShell we don't have any other options either).

@jn7dt
Copy link
Author

jn7dt commented May 16, 2018

@brettcannon That could be the case, I can investigate that. However, running the same command to activate the env ("&cmd /k activate stripe_page") in an external powershell window works fine with all the terminal functionality expected. Maybe the strangest thing, on review, is that the same workflow in external and integrated terminals produces different results.

@jn7dt
Copy link
Author

jn7dt commented May 16, 2018

Running a couple tests, I wonder if the issue is related to the syntax of the command activating the environment.

  • Manually running &cmd /k activate stripe_page (replicating activation in an external terminal window), activates the environment correctly and the up-arrow/down-arrow functionality works
  • That makes me think something about the extension's use of quotation marks and addition of "& powershell" (&cmd /k "activate stripe_page & powershell") is interfering with something.

If other people are not experiencing issues then it is probably something related to my setup . I don't want to waste more of your time with it in that case. You can close this issue and I'll try to resolve on my end.

Thanks the responses @Tyriar and @brettcannon!

@brettcannon
Copy link
Member

@jn7dt if you're not running that specific PowerShell call then that shouldn't drop you into a PowerShell prompt but instead cmd. If that's not the case then we can discuss changing how to we execute this on the extension over on vscode-python.

@Tyriar Tyriar added the *not-reproducible Issue cannot be reproduced by VS Code Team member as described label Jun 25, 2018
@vscodebot
Copy link

vscodebot bot commented Jun 25, 2018

We closed this issue because we are unable to reproduce the problem with the steps you describe. Chances are we've already fixed your problem in a recent version of VS Code. If not, please ask us to reopen the issue and provide us with more detail. Our issue reporting guidelines might help you with that.

Happy Coding!

@vscodebot vscodebot bot closed this as completed Jun 25, 2018
@vscodebot vscodebot bot locked and limited conversation to collaborators Aug 9, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
info-needed Issue requires more information from poster *not-reproducible Issue cannot be reproduced by VS Code Team member as described terminal Integrated terminal issues
Projects
None yet
Development

No branches or pull requests

3 participants