question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Pylint uses startup Python interpreter/enviroment even if costum interpreter/enviroment is set

See original GitHub issue

Issue Report Checklist

  • Searched the issues page for similar reports
  • Read the relevant sections of the Spyder Troubleshooting Guide and followed its advice
  • Reproduced the issue after updating with conda update spyder (or pip, if not using Anaconda)
  • Could not reproduce inside jupyter qtconsole (if console-related)
  • Tried basic troubleshooting (if a bug/error)
    • Restarted Spyder
    • Reset preferences with spyder --reset
    • Reinstalled the latest version of Anaconda
    • Tried the other applicable steps from the Troubleshooting Guide
  • Completed the Problem Description, Steps to Reproduce and Version sections below

Problem Description

If Spyder is installed and opened from an enviroment in which a module is not installed and then a costum interpreter of another enviroment is set in which this module is installed, it can be imported, but Pylint does not find the module (“E0401 (import-error): Unable to import ‘foo’.”). Pylint seems to always take the enviroment that was used at startup.

What steps reproduce the problem?

  1. Open Spyder in env A (without module foo)
  2. Change to interpreter of env B (with module foo)
  3. Analyze Python file with “import foo”

What is the expected output? What do you see instead?

No import error expected. Pylint raises error E0401 (import-error).

Paste Traceback/Error Below (if applicable)


PASTE TRACEBACK HERE

Versions

  • Spyder version: 5.0.0
  • Python version: 3.9.5
  • Qt version: 5.9.7
  • PyQt version: 5.9.2
  • Operating System name/version: Windows 10

Dependencies


# Mandatory:
atomicwrites >=1.2.0          :  1.4.0 (OK)
chardet >=2.0.0               :  4.0.0 (OK)
cloudpickle >=0.5.0           :  1.6.0 (OK)
cookiecutter >=1.6.0          :  1.7.2 (OK)
diff_match_patch >=20181111   :  20200713 (OK)
intervaltree >=3.0.2          :  3.1.0 (OK)
IPython >=7.6.0               :  7.22.0 (OK)
jedi =0.17.2                  :  0.17.2 (OK)
jsonschema >=3.2.0            :  3.2.0 (OK)
keyring >=17.0.0              :  23.0.1 (OK)
nbconvert >=4.0               :  6.0.7 (OK)
numpydoc >=0.6.0              :  1.1.0 (OK)
paramiko >=2.4.0              :  2.7.2 (OK)
parso =0.7.0                  :  0.7.0 (OK)
pexpect >=4.4.0               :  4.8.0 (OK)
pickleshare >=0.4             :  0.7.5 (OK)
psutil >=5.3                  :  5.8.0 (OK)
pygments >=2.0                :  2.9.0 (OK)
pylint >=1.0                  :  2.7.4 (OK)
pyls >=0.36.2;<1.0.0          :  0.36.2 (OK)
pyls_black >=0.4.6            :  0.4.6 (OK)
pyls_spyder >=0.3.2           :  0.3.2 (OK)
qdarkstyle =3.0.2             :  3.0.2 (OK)
qstylizer >=0.1.10            :  0.1.10 (OK)
qtawesome >=0.5.7             :  1.0.2 (OK)
qtconsole >=5.0.3             :  5.0.3 (OK)
qtpy >=1.5.0                  :  1.9.0 (OK)
rtree >=0.8.3                 :  0.9.7 (OK)
setuptools >=39.0.0           :  52.0.0.post20210125 (OK)
sphinx >=0.6.6                :  4.0.1 (OK)
spyder_kernels >=2.0.1;<2.1.0 :  2.0.1 (OK)
textdistance >=4.2.0          :  4.2.1 (OK)
three_merge >=0.1.1           :  0.1.1 (OK)
watchdog >=0.10.3;<2.0.0      :  1.0.2 (OK)
zmq >=17                      :  20.0.0 (OK)

# Optional:
cython >=0.21                 :  None (NOK)
matplotlib >=2.0.0            :  3.3.4 (OK)
numpy >=1.7                   :  1.20.2 (OK)
pandas >=1.1.1                :  1.2.4 (OK)
scipy >=0.17.0                :  1.6.2 (OK)
sympy >=0.7.3                 :  1.8 (OK)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:16 (16 by maintainers)

github_iconTop GitHub Comments

2reactions
mwawracommented, Jun 6, 2021

Pylint-venv is know available on conda-forge.

2reactions
mwawracommented, Jun 3, 2021

Hello, no experience with building conda packages so far. Anyway, conda package in conda-forge is on the way… PR#15165

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python Interpreter not matching between Language ... - GitHub
It looks like when we use the configured Python interpreter to execute a command (ie. which pylint ) it does not add the...
Read more >
Settings Reference for Python - Visual Studio Code
Indicates whether to automatically activate the environment you select using the Python: Select Interpreter command when a new terminal is created.
Read more >
Configure a Python interpreter | PyCharm Documentation
You can create several Python interpreters based on the same Python executable. This is helpful when you need to create different virtual ...
Read more >
Interpreter independent isolated/virtual environments
Hi all, I would like to propose adding a way to run isolated/virtual environments completely independently of the interpreter.
Read more >
(False) import error warning with global PyLint in virtual ...
The reason is probably that the global installed PyLint cannot see the packages inside the virtual environment. The chosen Python interpreter in ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found