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

Warning about system python in MacOS but correctly uses virtualenv #804

Closed
tommyblue opened this issue Feb 16, 2018 · 13 comments · Fixed by #823
Closed

Warning about system python in MacOS but correctly uses virtualenv #804

tommyblue opened this issue Feb 16, 2018 · 13 comments · Fixed by #823
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug macos
Milestone

Comments

@tommyblue
Copy link

Environment data

VS Code version: 1.20.1
Python Extension version: 2018.1.0
Python Version: 3.5.4 and 2.7.10
OS and version: MacOS 10.13.3

Actual behavior

VSCode shows a warning: "Selected interpreter is macOS system python which is not recommended. Please select different interpreter" but the venv version (3.5.4) is correctly selected (see screenshot) and seems to be correctly used (the system version is 2.7.10).
screen shot 2018-02-16 at 17 54 10

Expected behavior

The warning shouldn't be shown

Steps to reproduce:

  • cd to the project folder
  • activate the virtualenv
  • code .

Logs

Output from Python output panel

##########Linting Output - flake8##########
Traceback (most recent call last):
  File "/usr/local/bin/flake8", line 11, in <module>
    load_entry_point('flake8==3.5.0', 'console_scripts', 'flake8')()
  File "/usr/local/Cellar/flake8/3.5.0/libexec/lib/python2.7/site-packages/flake8/main/cli.py", line 16, in main
    app.run(argv)
  File "/usr/local/Cellar/flake8/3.5.0/libexec/lib/python2.7/site-packages/flake8/main/application.py", line 396, in run
    self._run(argv)
  File "/usr/local/Cellar/flake8/3.5.0/libexec/lib/python2.7/site-packages/flake8/main/application.py", line 383, in _run
    self.initialize(argv)
  File "/usr/local/Cellar/flake8/3.5.0/libexec/lib/python2.7/site-packages/flake8/main/application.py", line 361, in initialize
    self.parse_preliminary_options_and_args(argv)
  File "/usr/local/Cellar/flake8/3.5.0/libexec/lib/python2.7/site-packages/flake8/main/application.py", line 133, in parse_preliminary_options_and_args
    opts, args = self.option_manager.parse_known_args(args)
  File "/usr/local/Cellar/flake8/3.5.0/libexec/lib/python2.7/site-packages/flake8/options/manager.py", line 307, in parse_known_args
    self.parser.largs.append(err.opt_str)
AttributeError: 'OptionValueError' object has no attribute 'opt_str'
##########Linting Output - pylint##########
No config file found, using default configuration
##########Linting Output - mypy##########

Output from Console window (Help->Developer Tools menu)

screen shot 2018-02-16 at 17 59 05

@MikhailArkhipov MikhailArkhipov self-assigned this Feb 16, 2018
@MikhailArkhipov MikhailArkhipov added bug Issue identified by VS Code Team member as probable bug awaiting 1-verification macos labels Feb 16, 2018
@MikhailArkhipov
Copy link

If it is annoying you, you can set disableInstallationChecks to true in settings

@tommyblue
Copy link
Author

well, thanks for the suggestion, but it's not a matter of be annoyed 😀
It's that the message is wrong, the editor acts differently from what it says

@DonJayamanne
Copy link

Please could you install the Insiders build of the extension (see here under Insiders Build).
Please install that and re-test. It may be fixed in the master branch (soon to be released).

@MikhailArkhipov
Copy link

Yes, we are working on the fix. I just meant temp workaround.

@tommyblue
Copy link
Author

@DonJayamanne unfortunately the issue persists with the insider build (2018.2.0-alpha)

@rpranshu
Copy link

why not add an interpreter menu in the IDE itself to select the interpreter from the system?

@tommyblue
Copy link
Author

@rpranshu I think you're talking of the menu you get if you click on the python version in the bottom bar.

@DonJayamanne DonJayamanne added awaiting 2-PR and removed info-needed Issue requires more information from poster labels Feb 17, 2018
@DonJayamanne
Copy link

DonJayamanne commented Feb 17, 2018

Will look into this.

@MikhailArkhipov
We need to perform the check after seeing the interpreter.

  const pythonInstaller = new PythonInstaller(serviceContainer);
    pythonInstaller.checkPythonInstallation(PythonSettings.getInstance())
        .catch(ex => console.error('Python Extension: pythonInstaller.checkPythonInstallation', ex));

    // This must be completed before we can continue.
    await interpreterManager.autoSetInterpreter();

Also shouldn't we be looking for just the Osx python installs instead of checking if the phon installation is undefined (i.e. if all interpreters in the list start with /usr/bin/python or similar then they are the OSX interpreters that aren't supported). Not sure if we're also checking the os.

@MaherBouidani
Copy link

Yes, It keeps appearing for me as well as "Linting is not installed.....install" and when I clicked on install "Linting could not be found"

@MattCraftsCode
Copy link

add this key-value line in vscode settings:

"python.pythonPath": "/usr/bin/python"

@cristtopher
Copy link

@heshiweij after add it, still appears message

@brettcannon
Copy link
Member

Please open a new issue if you're incorrectly getting the banner.

@muzi131313
Copy link

muzi131313 commented May 9, 2018

Configuring Python environments :

  1. ⇧⌘P
  2. input the words: python: s, and choose [python: Select Interpreter]
  3. select a appropriate version you need in your project

===============
if your install your python by yum, and you was not able to uninstall system's python, you can set alias in your .bash_profile:

alias python=/usr/local/bin/python3

and then: source .bash_profile
check work well or not by the command:

python -V

@microsoft microsoft locked as resolved and limited conversation to collaborators May 10, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug macos
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants