Skip to content

Error on local lint check #564

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

Closed
kevinsung opened this issue Feb 16, 2022 · 5 comments
Closed

Error on local lint check #564

kevinsung opened this issue Feb 16, 2022 · 5 comments

Comments

@kevinsung
Copy link
Contributor

Environment

  • Qiskit Nature version: 218c7f9
  • Python version: 3.8.8
  • Operating system: RHEL 8.5

What is happening?

Errors when running make lint.

How can we reproduce the issue?

make lint

python -m pylint -rn --ignore=gauopen qiskit_nature test tools
************* Module qiskit_nature.drivers.second_quantization.gaussiand.gaussian_log_result
qiskit_nature/drivers/second_quantization/gaussiand/gaussian_log_result.py:208:40: I1101: Module 'math' has no 'factorial' member, but source is unavailable. Consider adding this module to extension-pkg-allow-list if you want to perform analysis based on run-time introspection of living objects. (c-extension-no-member)
qiskit_nature/drivers/second_quantization/gaussiand/gaussian_log_result.py:248:31: I1101: Module 'math' has no 'sqrt' member, but source is unavailable. Consider adding this module to extension-pkg-allow-list if you want to perform analysis based on run-time introspection of living objects. (c-extension-no-member)
qiskit_nature/drivers/second_quantization/gaussiand/gaussian_log_result.py:298:31: I1101: Module 'math' has no 'sqrt' member, but source is unavailable. Consider adding this module to extension-pkg-allow-list if you want to perform analysis based on run-time introspection of living objects. (c-extension-no-member)
************* Module qiskit_nature.problems.second_quantization.lattice.lattices.hyper_cubic_lattice
qiskit_nature/problems/second_quantization/lattice/lattices/hyper_cubic_lattice.py:16:0: E0611: No name 'pi' in module 'math' (no-name-in-module)
************* Module qiskit_nature.problems.second_quantization.lattice.lattices.triangular_lattice
qiskit_nature/problems/second_quantization/lattice/lattices/triangular_lattice.py:16:0: E0611: No name 'pi' in module 'math' (no-name-in-module)

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

make: *** [Makefile:43: lint] Error 2

What should happen?

No error.

Any suggestions?

No response

@mrossinek
Copy link
Member

The CI is checking make lint for Python versions 3.7 through 3.10 on Ubuntu, Mac OS and Windows. So I assume that this is some problem in your local setup. Especially, given the fact that your pylint appears to be unable to resolve imports from the builtin math module.

Please try ensuring that your development tools are up-to-date:

python -m pip install -U -c constraints.txt -r requirements-dev.txt

If the error persists, please provide more details:

  • make sure that your virtual environment is active
  • pip list
  • maybe add some sanity output check to the make lint target like printing which python etc.

@kevinsung
Copy link
Contributor Author

Thanks, I did run python -m pip install -U -c constraints.txt -r requirements-dev.txt and make sure my virtual environment was active and verify that make lint is using the correct python.

Output of pip list:

Package                       Version   Editable project location
----------------------------- --------- --------------------------------------
alabaster                     0.7.12
argon2-cffi                   21.3.0
argon2-cffi-bindings          21.2.0
astroid                       2.6.1
asttokens                     2.0.5
attrs                         21.4.0
autopage                      0.5.0
Babel                         2.9.1
backcall                      0.2.0
black                         21.12b0
bleach                        4.1.0
certifi                       2021.10.8
cffi                          1.15.0
charset-normalizer            2.0.12
click                         8.0.3
cliff                         3.10.0
cmd2                          2.3.3
coverage                      6.3.1
cycler                        0.11.0
ddt                           1.4.4
debugpy                       1.5.1
decorator                     4.4.2
defusedxml                    0.7.1
dill                          0.3.4
discover                      0.4.0
docutils                      0.17.1
dulwich                       0.20.32
entrypoints                   0.4
executing                     0.8.2
extras                        1.0.0
fixtures                      3.0.0
fonttools                     4.29.1
future                        0.18.2
h5py                          3.6.0
idna                          3.3
imagesize                     1.3.0
importlib-metadata            4.11.1
importlib-resources           5.4.0
ipykernel                     6.9.1
ipython                       8.0.1
ipython-genutils              0.2.0
ipywidgets                    7.6.5
isort                         5.10.1
jedi                          0.18.1
Jinja2                        3.0.3
joblib                        1.1.0
jsonschema                    4.4.0
jupyter-client                7.1.2
jupyter-core                  4.9.2
jupyter-sphinx                0.3.2
jupyterlab-pygments           0.1.2
jupyterlab-widgets            1.0.2
kiwisolver                    1.3.2
lazy-object-proxy             1.7.1
MarkupSafe                    2.0.1
matplotlib                    3.5.1
matplotlib-inline             0.1.3
mccabe                        0.6.1
mistune                       0.8.4
mpmath                        1.2.1
mypy                          0.931
mypy-extensions               0.4.3
nbclient                      0.5.11
nbconvert                     6.4.2
nbformat                      5.1.3
nbsphinx                      0.8.8
nest-asyncio                  1.5.4
networkx                      2.5.1
notebook                      6.4.8
numpy                         1.22.2
packaging                     21.3
pandocfilters                 1.5.0
parso                         0.8.3
pathspec                      0.9.0
pbr                           5.8.1
pexpect                       4.8.0
pickleshare                   0.7.5
Pillow                        9.0.1
pip                           21.3.1
platformdirs                  2.5.0
ply                           3.11
prettytable                   3.1.0
prometheus-client             0.13.1
prompt-toolkit                3.0.28
psutil                        5.9.0
ptyprocess                    0.7.0
pure-eval                     0.2.2
pycparser                     2.21
pyenchant                     3.2.2
Pygments                      2.11.2
pylatexenc                    2.10
pylint                        2.9.0
pyparsing                     3.0.7
pyperclip                     1.8.2
pyrsistent                    0.18.1
python-constraint             1.4.0
python-dateutil               2.8.2
python-subunit                1.4.0
pytz                          2021.3
PyYAML                        6.0
pyzmq                         22.3.0
qiskit-aer                    0.10.3
qiskit-nature                 0.4.0     /home/kevinsung/projects/qiskit-nature
qiskit-sphinx-theme           1.8.7
qiskit-terra                  0.20.0    /home/kevinsung/projects/qiskit-terra
reno                          3.5.0
requests                      2.27.1
retworkx                      0.11.0
scikit-learn                  1.0.2
scipy                         1.8.0
Send2Trash                    1.8.0
setuptools                    60.5.0
six                           1.16.0
snowballstemmer               2.2.0
Sphinx                        4.4.0
sphinx-autodoc-typehints      1.13.1
sphinx-gallery                0.10.1
sphinx-panels                 0.6.0
sphinxcontrib-applehelp       1.0.2
sphinxcontrib-devhelp         1.0.2
sphinxcontrib-htmlhelp        2.0.0
sphinxcontrib-jsmath          1.0.1
sphinxcontrib-qthelp          1.0.3
sphinxcontrib-serializinghtml 1.1.5
sphinxcontrib-spelling        7.3.2
stack-data                    0.2.0
stestr                        3.2.1
stevedore                     3.5.0
symengine                     0.8.1
sympy                         1.9
terminado                     0.13.1
testpath                      0.5.0
testtools                     2.5.0
threadpoolctl                 3.1.0
tokenize-rt                   4.2.1
toml                          0.10.2
tomli                         1.2.3
tornado                       6.1
traitlets                     5.1.1
tweedledum                    1.1.1
typing_extensions             4.1.1
urllib3                       1.26.8
voluptuous                    0.12.2
wcwidth                       0.2.5
webencodings                  0.5.1
wheel                         0.37.1
widgetsnbextension            3.5.2
wrapt                         1.12.1
zipp                          3.7.0

@mrossinek
Copy link
Member

Looks like you're running into this issue: pylint-dev/pylint#5704

You can:

  • downgrade setuptools to something <60
  • upgrade to Python 3.9

@kevinsung
Copy link
Contributor Author

I see. How does the CI get around it? Does it use an older setuptools? Should that be specified in the requirements?

@manoelmarques
Copy link
Contributor

The CI uses the setuptools that is already in the pre-installed conda distribution that each Github Actions VM has.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants