Skip to content

E0401:Unable to import ... - pylint linting output #1185

Closed

Description

Environment data

  • VS Code version: 1.20.0
  • Extension version (available under the Extensions sidebar): 2018.2.1
  • OS and version: macOS Sierra version 10.12.6
  • Python version (& distribution if applicable, e.g. Anaconda): Anaconda custom (64 bit) Python 3.6.4
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): conda
  • Relevant/affected Python packages and their versions:

pylint_error

user_settings

workspace_settings

Actual behavior

This program works fine from the command line. I wrote this using the Python extension approx. 6 months ago on another mac. I recently picked up this program again and it shows me the import errors as shown in the attached screenshot. I know that it is pylint related. I am also attaching my user settings and workspace settings screenshots

Expected behavior

It should not show errors for import

Steps to reproduce:

See the screenshorts

Logs

Output for Python in the Output panel (View→Output, change the drop-down the upper-right of the Output panel to Python)

6,0,error,E0401:Unable to import 'vglabs_common'
7,0,error,E0401:Unable to import 'vglabs_anis'
8,0,error,E0401:Unable to import 'vglabs_brz'
10,0,error,E0401:Unable to import 'vglabs_inf'
11,0,error,E0401:Unable to import 'vglabs_mrp'
12,0,error,E0401:Unable to import 'vglabs_nmr'
13,0,error,E0401:Unable to import 'vglabs_op'
14,0,error,E0401:Unable to import 'vglabs_re'
15,0,error,E0401:Unable to import 'vglabs_ssk'
16,0,error,E0401:Unable to import 'vglabs_txc'
17,0,error,E0401:Unable to import 'vglabs_xrd'
##########Linting Output - pylint##########
No config file found, using default configuration
************* Module vglabs_uploader
6,0,error,E0401:Unable to import 'vglabs_common'
7,0,error,E0401:Unable to import 'vglabs_anis'
8,0,error,E0401:Unable to import 'vglabs_brz'
10,0,error,E0401:Unable to import 'vglabs_inf'
11,0,error,E0401:Unable to import 'vglabs_mrp'
12,0,error,E0401:Unable to import 'vglabs_nmr'
13,0,error,E0401:Unable to import 'vglabs_op'
14,0,error,E0401:Unable to import 'vglabs_re'
15,0,error,E0401:Unable to import 'vglabs_ssk'
16,0,error,E0401:Unable to import 'vglabs_txc'
17,0,error,E0401:Unable to import 'vglabs_xrd'
59,0,refactor,R0912:Too many branches (15/12)
107,0,refactor,R0912:Too many branches (15/12)
5,0,warning,W0611:Unused import psycopg2
XXX


Output from `Console` under the `Developer Tools` panel (toggle Developer Tools on under `Help`)

XXX

Activity

  1. DonJayamanne commented on Mar 25, 2018

    @DonJayamanne

    This is a common error that most people come across, please check stack overflow as per the issue template.
    You have not installed pylint in the same environment that contains your python packages.
    The environment selected in VS Code is displayed at the bottom left on the status bar of VS Code.
    Again, please check stack over flow and the documentation on selecting an interpreter https://code.visualstudio.com/docs/python/environments#_choosing-an-environment

  2. bruparel commented on Mar 25, 2018

    @bruparel
    Author

    Hello Don, Thanks for your quick response. I did more work on this issues last night and it may not be a VSCode Python extension issue at all. Rather, it seems like a 'pylint' issue. I took out the VSCode environment from the equation and ran pylint from command line and got the same errors. Please see below:

    bharat:~/py_work/vglabs_uploader
    → pylint vglabs_uploader.py
    No config file found, using default configuration
    ************* Module vglabs_uploader
    E: 6, 0: Unable to import 'vglabs_common' (import-error)
    E: 7, 0: Unable to import 'vglabs_anis' (import-error)
    E: 8, 0: Unable to import 'vglabs_brz' (import-error)
    E: 10, 0: Unable to import 'vglabs_inf' (import-error)
    E: 11, 0: Unable to import 'vglabs_mrp' (import-error)
    E: 12, 0: Unable to import 'vglabs_nmr' (import-error)
    E: 13, 0: Unable to import 'vglabs_op' (import-error)
    E: 14, 0: Unable to import 'vglabs_re' (import-error)
    E: 15, 0: Unable to import 'vglabs_ssk' (import-error)
    E: 16, 0: Unable to import 'vglabs_txc' (import-error)
    E: 17, 0: Unable to import 'vglabs_xrd' (import-error)
    R: 59, 0: Too many branches (15/12) (too-many-branches)
    R:107, 0: Too many branches (15/12) (too-many-branches)


    Your code has been rated at 5.25/10 (previous run: 5.25/10, +0.00)

    bharat:~/py_work/vglabs_uploader
    →

    Would you have any idea on how to configure pylint correctly? I am using Anaconda installer and there is just one conda environment. I tried installing and uninstalling pylint both using conda and pip, but the error does not go away.

    Apologies for hasty posting, I should have done the command line test before posting here.

  3. DonJayamanne commented on Mar 25, 2018

    @DonJayamanne

    Would you have any idea on how to configure pylint correctly?

    Please check their documentation or stack overflow.

  4. locked as resolved and limited conversation to collaborators on Jul 11, 2018
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