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

ImportError on collection of module in pylint 2.5.0 when using multiprocessing option #3524

Closed
robsan00 opened this issue Apr 27, 2020 · 14 comments

Comments

@robsan00
Copy link

robsan00 commented Apr 27, 2020

Steps to reproduce

  1. create a new & empty virtualenv only containing pyling 2.5.0 (using Python 3.6)
  2. create a folder "test" somewhere
  3. add an (empty) "__init__.py" file there
  4. add an (empty "spam.py" file there
  5. go to the parent directory of "test" and call "pylint -j 1 test" -> no error
  6. go to the parent directory of "test" and call "pylint -j 2 test" ->
Traceback (most recent call last):
  File "c:\Python36\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\Python36\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\work\venv\pylint\Scripts\pylint.exe\__main__.py", line 7, in <module>
  File "c:\work\venv\pylint\lib\site-packages\pylint\__init__.py", line 22, in run_pylint
    PylintRun(sys.argv[1:])
  File "c:\work\venv\pylint\lib\site-packages\pylint\lint\run.py", line 338, in __init__
    linter.check(args)
  File "c:\work\venv\pylint\lib\site-packages\pylint\lint\pylinter.py", line 878, in check
    files_or_modules,
  File "c:\work\venv\pylint\lib\site-packages\pylint\lint\check_parallel.py", line 101, in check_parallel
    _worker_check_single_file, files
  File "c:\Python36\lib\multiprocessing\pool.py", line 735, in next
    raise value
ImportError: Unable to find module for test\spam.py in C:\work\venv\pylint\Scripts\pylint.exe,
c:\work\venv\pylint\scripts\python36.zip,
c:\Python36\DLLs,
c:\Python36\lib,
c:\Python36,
c:\work\venv\pylint,
c:\work\venv\pylint\lib\site-packages,
c:\work\venv\pylint\lib\site-packages\astroid\brain

Current behavior

ImportError

Expected behavior

no error (for example with pylint 2.4.4)

pylint --version output

pylint 2.5.0
astroid 2.4.0
Python 3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:54:40) [MSC v.1900 64 bit (AMD64)]
@PCManticore
Copy link
Contributor

Thanks for the report! This is a regression caused by 2.5.0 which most likely was a result of #3411.

Going to investigate and provide a fix hopefully this week. In the meantime I suggest downgrading to 2.4.4 or using -j1, sorry for the hassle.

@robsan00
Copy link
Author

Already did the 2.4.4 downgrading ;-), thanks for the quick reply!

@IRDonch
Copy link

IRDonch commented Apr 27, 2020

I noticed that 2.5.0 also doesn't calculate the score in multiprocessing mode - could it be related to this bug?

toumorokoshi pushed a commit to open-telemetry/opentelemetry-python that referenced this issue Apr 27, 2020
Pinning the version of pylint as it's causing failures in our build. Related issue: pylint-dev/pylint#3524
sigmavirus24 pushed a commit to PyCQA/flake8 that referenced this issue Apr 27, 2020
sanderegg added a commit to sanderegg/osparc-services that referenced this issue Apr 28, 2020
sanderegg added a commit to sanderegg/osparc-services that referenced this issue Apr 28, 2020
sanderegg added a commit to ITISFoundation/osparc-services that referenced this issue Apr 28, 2020
* fix warning about junit family while testing
* pin pylint version due to bug pylint-dev/pylint#3524
lukaszdudek-silvair added a commit to SilvairGit/python-bluetooth-mesh that referenced this issue Apr 28, 2020
michallowasrzechonek-silvair pushed a commit to SilvairGit/python-bluetooth-mesh that referenced this issue Apr 28, 2020
@felixdivo
Copy link

Could it be that some docs need updating?

[...] should always work since the current working directory is automatically added on top of the python path

jon-turney added a commit to jon-turney/meson that referenced this issue Apr 28, 2020
Pin pylint version to workaround pylint-dev/pylint#3524
mlin added a commit to chanzuckerberg/miniwdl that referenced this issue Apr 29, 2020
tomdele pushed a commit to BlueBrain/snap that referenced this issue Apr 29, 2020
* fixing the function
* adding comments and explanation in docstrings
* fixing the pylint in tox due to the multiprocessing error
  pylint-dev/pylint#3524
lakhotiaharshit added a commit to microsoft/Qcodes that referenced this issue Apr 29, 2020
JJMC89 added a commit to jjmc89-bot/bsiconsbot that referenced this issue Apr 30, 2020
@svenpanne
Copy link

Is there anything one can do to help resolving this issue and/or raise its priority? It's a complete show stopper for us, and judging from the linked commits/issues for many other projects, too. The workaround of using -j1 is not an option when you already wait 8 minutes in the parallel case... 😞

@crisbal
Copy link

crisbal commented Apr 30, 2020

@svenpanne if you do no need any of the features/fixes introduced with 2.5.0 you can just pin pylint to a version which is not 2.5.0.

Basically in your requirements.txt or setup.py (or wherever you specify the dependencies) use "pylint!=2.5.0" instead of "pylint". Version 2.4.4 will be used. When a fix will come you can remove the version specification.

@knoop1975
Copy link

The suggested -j1 fix doesn't solve the problem.

@svenpanne
Copy link

@svenpanne if you do no need any of the features/fixes introduced with 2.5.0 you can just pin pylint to a version which is not 2.5.0. [...]

This is exactly what we are doing at the moment, just like tons of other projects if one looks at the linked issues. We have quite a few suppressions caused by false positives, so I thought giving 2.5.0 a try might be a good idea, but obviously it's not...

@PCManticore
Copy link
Contributor

@svenpanne I understand your pain. For context, almost all the minor releases had some issues in the past and I usually recommend to wait until a couple of patch releases before jumping to a minor version of Pylint. Usually the minor version that is going to be released does not get a lot of testing from the community and some critical issues leak into the minor release when that happens.

Regarding bumping the priority, this issue is one of my main concerns for a 2.5.1 or 2.5.2 release. But it's non trivial and I also have a day to day job, so please be a bit patient on that front. As soon as we have a fix, you'll see the notification here. If you do want to help, investigating the root cause or sending a patch is more than welcome and appreciated.

jon-turney added a commit to jon-turney/meson that referenced this issue Apr 30, 2020
Pin pylint version to workaround pylint-dev/pylint#3524
dcbaker pushed a commit to mesonbuild/meson that referenced this issue Apr 30, 2020
Pin pylint version to workaround pylint-dev/pylint#3524
@Sazpaimon
Copy link

Unfortunately pinning to 2.4 is no longer a universal solution now because Safety has now marked pylint <2.5.0 to be insecure: https://github.com/pyupio/safety-db/blob/master/data/insecure_full.json#L10823-L10833

@PCManticore
Copy link
Contributor

Hey folks, this should be fixed in both master and the 2.5 branch. Can you give it a go and let us know if pylint works for you now? If so, I'll do a 2.5.1 release tomorrow.

@PCManticore PCManticore unpinned this issue May 2, 2020
@NeilGirdhar
Copy link

Works for me! Thanks for the quick turnaround.

@robsan00
Copy link
Author

robsan00 commented May 4, 2020

@PCManticore
Using pylint at 3fffdf0, I don't get the same error, but the multi-core stuff still looks broken to me: the same error gets reported lots of times as if the same file is checked loads of times. The suite I let it run over has about 60 errors (false positives that I ignore in post-processing). Now there are about 1800 errors. The first error (the exact error including file name, line and position) was reported 42 times, for example (I am not sure that Douglas Adams / Deep Thought was thinking about that ;-)).

I can reproduce this, if I add "asdf" in the spam.py file mentioned in the "steps to reproduce" and copy this 20 times (or whatever) with a different name each time:

(python3) C:\work\pylint_test>pylint -j 0 -E test
************* Module test.spam10
test\spam10.py:1:0: E0602: Undefined variable 'fdd' (undefined-variable)
************* Module test.spam12
test\spam12.py:1:0: E0602: Undefined variable 'fdd' (undefined-variable)
************* Module test.spam15
test\spam15.py:1:0: E0602: Undefined variable 'fdd' (undefined-variable)
************* Module test.spam1
test\spam1.py:1:0: E0602: Undefined variable 'fdd' (undefined-variable)
************* Module test.spam13
test\spam13.py:1:0: E0602: Undefined variable 'fdd' (undefined-variable)
************* Module test.spam14
test\spam14.py:1:0: E0602: Undefined variable 'fdd' (undefined-variable)
test\spam10.py:1:0: E0602: Undefined variable 'fdd' (undefined-variable)
************* Module test.spam17
test\spam17.py:1:0: E0602: Undefined variable 'fdd' (undefined-variable)
test\spam12.py:1:0: E0602: Undefined variable 'fdd' (undefined-variable)
************* Module test.spam18
test\spam18.py:1:0: E0602: Undefined variable 'fdd' (undefined-variable)
************* Module test.spam11
test\spam11.py:1:0: E0602: Undefined variable 'fdd' (undefined-variable)
************* Module test.spam16
test\spam16.py:1:0: E0602: Undefined variable 'fdd' (undefined-variable)
test\spam15.py:1:0: E0602: Undefined variable 'fdd' (undefined-variable)
************* Module test.spam19
test\spam19.py:1:0: E0602: Undefined variable 'fdd' (undefined-variable)
test\spam1.py:1:0: E0602: Undefined variable 'fdd' (undefined-variable)
************* Module test.spam2
test\spam2.py:1:0: E0602: Undefined variable 'fdd' (undefined-variable)
test\spam14.py:1:0: E0602: Undefined variable 'fdd' (undefined-variable)
************* Module test.spam3
test\spam3.py:1:0: E0602: Undefined variable 'fdd' (undefined-variable)
test\spam12.py:1:0: E0602: Undefined variable 'fdd' (undefined-variable)
test\spam18.py:1:0: E0602: Undefined variable 'fdd' (undefined-variable)
************* Module test.spam5
test\spam5.py:1:0: E0602: Undefined variable 'fdd' (undefined-variable)
test\spam10.py:1:0: E0602: Undefined variable 'fdd' (undefined-variable)
test\spam17.py:1:0: E0602: Undefined variable 'fdd' (undefined-variable)
************* Module test.spam4
test\spam4.py:1:0: E0602: Undefined variable 'fdd' (undefined-variable)
test\spam13.py:1:0: E0602: Undefined variable 'fdd' (undefined-variable)
************* Module test.spam20
test\spam20.py:1:0: E0602: Undefined variable 'fdd' (undefined-variable)
test\spam11.py:1:0: E0602: Undefined variable 'fdd' (undefined-variable)
************* Module test.spam6
test\spam6.py:1:0: E0602: Undefined variable 'fdd' (undefined-variable)
test\spam16.py:1:0: E0602: Undefined variable 'fdd' (undefined-variable)
************* Module test.spam7
test\spam7.py:1:0: E0602: Undefined variable 'fdd' (undefined-variable)
test\spam15.py:1:0: E0602: Undefined variable 'fdd' (undefined-variable)
test\spam19.py:1:0: E0602: Undefined variable 'fdd' (undefined-variable)
************* Module test.spam8
test\spam8.py:1:0: E0602: Undefined variable 'fdd' (undefined-variable)
test\spam1.py:1:0: E0602: Undefined variable 'fdd' (undefined-variable)
test\spam2.py:1:0: E0602: Undefined variable 'fdd' (undefined-variable)
************* Module test.spam9
test\spam9.py:1:0: E0602: Undefined variable 'fdd' (undefined-variable)

(python3) C:\work\pylint_test>pylint -j 1 -E test
************* Module test.spam1
test\spam1.py:1:0: E0602: Undefined variable 'fdd' (undefined-variable)
************* Module test.spam10
test\spam10.py:1:0: E0602: Undefined variable 'fdd' (undefined-variable)
************* Module test.spam11
test\spam11.py:1:0: E0602: Undefined variable 'fdd' (undefined-variable)
************* Module test.spam12
test\spam12.py:1:0: E0602: Undefined variable 'fdd' (undefined-variable)
************* Module test.spam13
test\spam13.py:1:0: E0602: Undefined variable 'fdd' (undefined-variable)
************* Module test.spam14
test\spam14.py:1:0: E0602: Undefined variable 'fdd' (undefined-variable)
************* Module test.spam15
test\spam15.py:1:0: E0602: Undefined variable 'fdd' (undefined-variable)
************* Module test.spam16
test\spam16.py:1:0: E0602: Undefined variable 'fdd' (undefined-variable)
************* Module test.spam17
test\spam17.py:1:0: E0602: Undefined variable 'fdd' (undefined-variable)
************* Module test.spam18
test\spam18.py:1:0: E0602: Undefined variable 'fdd' (undefined-variable)
************* Module test.spam19
test\spam19.py:1:0: E0602: Undefined variable 'fdd' (undefined-variable)
************* Module test.spam2
test\spam2.py:1:0: E0602: Undefined variable 'fdd' (undefined-variable)
************* Module test.spam20
test\spam20.py:1:0: E0602: Undefined variable 'fdd' (undefined-variable)
************* Module test.spam3
test\spam3.py:1:0: E0602: Undefined variable 'fdd' (undefined-variable)
************* Module test.spam4
test\spam4.py:1:0: E0602: Undefined variable 'fdd' (undefined-variable)
************* Module test.spam5
test\spam5.py:1:0: E0602: Undefined variable 'fdd' (undefined-variable)
************* Module test.spam6
test\spam6.py:1:0: E0602: Undefined variable 'fdd' (undefined-variable)
************* Module test.spam7
test\spam7.py:1:0: E0602: Undefined variable 'fdd' (undefined-variable)
************* Module test.spam8
test\spam8.py:1:0: E0602: Undefined variable 'fdd' (undefined-variable)
************* Module test.spam9
test\spam9.py:1:0: E0602: Undefined variable 'fdd' (undefined-variable)

The test\spam10.py:1:0: E0602: Undefined variable 'fdd' (undefined-variable) error is reported 3 times, for example.

@PCManticore
Copy link
Contributor

Please open a separate issue with reproduction steps as the original issue was solved and the root cause for your issue might be different.

leouieda added a commit to fatiando/pooch that referenced this issue May 7, 2020
Version 2.5.0 introduced a bug with the multiprocessing option. This
happens often enough that we should have pylint pinned and only upgrade
when we choose to do it. See pylint-dev/pylint#3524
leouieda added a commit to fatiando/verde that referenced this issue May 7, 2020
Version 2.5.0 introduced a bug with the multiprocessing option. This
happens often enough that we should have pylint pinned and only upgrade
when we choose to do it. See pylint-dev/pylint#3524
leouieda added a commit to fatiando/boule that referenced this issue May 7, 2020
Version 2.5.0 introduced a bug with the multiprocessing option. This
happens often enough that we should have pylint pinned and only upgrade
when we choose to do it. See pylint-dev/pylint#3524
leouieda added a commit to fatiando/pooch that referenced this issue May 7, 2020
Version 2.5.0 introduced a bug with the multiprocessing option. This
happens often enough that we should have pylint pinned and only upgrade
when we choose to do it. See pylint-dev/pylint#3524
leouieda added a commit to fatiando/boule that referenced this issue May 7, 2020
Version 2.5.0 introduced a bug with the multiprocessing option. This
happens often enough that we should have pylint pinned and only upgrade
when we choose to do it. See pylint-dev/pylint#3524
tomdele added a commit to BlueBrain/snap that referenced this issue May 14, 2020
* Fixing the iter_connection with unique_node_ids

* fixing the function
* adding comments and explanation in docstrings
* fixing the pylint in tox due to the multiprocessing error
  pylint-dev/pylint#3524

* Change node_id to node ID in doc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants