Skip to content

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

Closed

Description

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

Activity

  1. MikhailArkhipov commented on Feb 16, 2018

    @MikhailArkhipov

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

  2. tommyblue commented on Feb 16, 2018

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

  3. DonJayamanne commented on Feb 16, 2018

    @DonJayamanne

    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).

  4. MikhailArkhipov commented on Feb 17, 2018

    @MikhailArkhipov

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

  5. tommyblue commented on Feb 17, 2018

    @tommyblue
    Author

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

  6. rpranshu commented on Feb 17, 2018

    @rpranshu

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

  7. tommyblue commented on Feb 17, 2018

    @tommyblue
    Author

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

  8. DonJayamanne commented on Feb 17, 2018

    @DonJayamanne

    Will look into this.

    Mikhail Arkhipov (@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.

  9. MaherBouidani commented on Mar 5, 2018

    @MaherBouidani

    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"

  10. MattCraftsCode commented on Apr 19, 2018

    @MattCraftsCode

    add this key-value line in vscode settings:

    "python.pythonPath": "/usr/bin/python"
    
  11. cristtopher commented on Apr 23, 2018

    @cristtopher

    @heshiweij after add it, still appears message

  12. brettcannon commented on Apr 23, 2018

    @brettcannon
    Member

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

  13. muzi131313 commented on May 9, 2018

    @muzi131313

    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
    
  14. locked as resolved and limited conversation to collaborators on May 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugIssue identified by VS Code Team member as probable bugmacos

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions