I am having a click
project which don’t use/need Django anywhere but while running prospector
as part of static analysis throws this strange error
Command
prospector -I __init__.py --strictness veryhigh --max-line-length 120 src/
Error
Line: 1
pylint: django-not-available / Django is not available on the PYTHONPATH
There was no reference of django anywhere in the project/code . I am fairly new to python, Am i missing something obivious here ?
python-version : 3.7
pip list
apipkg 1.5
asn1crypto 1.2.0
astroid 2.3.2
atomicwrites 1.3.0
attrs 19.3.0
auger-python 0.1.35
bitmath 1.3.3.1
boto3 1.10.14
botocore 1.13.14
bravado 9.2.0
bravado-core 4.9.1
certifi 2019.9.11
cffi 1.13.2
chardet 3.0.4
click 6.7
colorama 0.4.1
coloredlogs 10.0
coverage 4.5.4
cryptography 2.3.1
deb-pkg-tools 4.5
docutils 0.15.2
dodgy 0.1.9
entrypoints 0.3
execnet 1.7.1
executor 21.3
fasteners 0.15
filelock 3.0.12
flake8 3.7.9
flake8-polyfill 1.0.2
funcsigs 1.0.2
future 0.18.2
humanfriendly 4.18
hvac 0.7.1
idna 2.5
importlib-metadata 0.23
isort 4.3.21
jmespath 0.9.4
jsonpointer 2.0
jsonschema 3.1.1
lazy-object-proxy 1.4.3
mando 0.6.4
mccabe 0.6.1
mock 3.0.5
monotonic 1.5
more-itertools 7.2.0
murl 0.5.1
packaging 19.2
pep8 1.7.1
pep8-naming 0.4.1
pip 19.3.1
pluggy 0.13.0
property-manager 2.3.1
prospector 1.1.7
py 1.8.0
pycodestyle 2.5.0
pycparser 2.19
pydocstyle 4.0.1
pyflakes 2.1.1
pylint 2.4.3
pylint-celery 0.3
pylint-django 2.0.10
pylint-flask 0.6
pylint-plugin-utils 0.6
pyparsing 2.4.4
pyrsistent 0.15.5
pytest 5.2.2
pytest-cache 1.0
pytest-cov 2.8.1
pytest-pep8 1.0.6
python-dateutil 2.6.1
python-debian 0.1.33
python-memcached 1.59
pytz 2019.3
PyYAML 5.1.2
radon 4.0.0
raven 6.9.0
requests 2.19.1
requirements-detector 0.6
rfc3987 1.3.8
customcli 0.1.dev27+g2b07461.d20191114
s3transfer 0.2.1
setoptconf 0.2.0
setuptools 41.6.0
simplejson 3.16.0
six 1.12.0
snowballstemmer 2.0.0
strict-rfc3339 0.7
swagger-spec-validator 2.4.3
toml 0.10.0
tox 3.14.0
tryagain 1.0
typed-ast 1.4.0
urllib3 1.23
verboselogs 1.7
virtualenv 16.7.7
wcwidth 0.1.7
webcolors 1.10
wheel 0.33.6
wrapt 1.11.2
zipp 0.6.0
2
Answers
After some investigation, Propector supports Django, Celery and Flask, which means it automatically installs the Pylint plugins needed for it to support these frameworks.
Is it possible you have specified to use pylint-django? In order for pylint-django to inspect Django code it requires Django to be installed, prospector docs states it doesn’t normally automatically detect your project’s dependencies, but it states you can turn them off using:
Let me know if this helps.
As I said in my comments I think there is a bug with prospector and requirement-detector.
I was able to reproduce the problem by just installing prospector 1.1.7 in an empty virtualenv:
Then creating a dummy code:
When running prospector I got the same error:
Since prospector issue 245 and pylint django PR 137 Django became an extra dependency of pylint-django.
But running it without django installed still return a message:
My guess is prospector catch that message and return it when ran directly i.e with dependency automatic detection.
This seems like an bug/integration problem between the two libraries for me, but a confirmation from a contributor/maintainer from one the project is required.
Otherwise @Thaveedu a workaround is to disable the dependency automatic detection since in your case you probably don’t care about django, flask or celery anyway: