pytype icon indicating copy to clipboard operation
pytype copied to clipboard

Can't find module 'passlib.hash'. [import-error]

Open pjz opened this issue 6 years ago • 4 comments

I have a line that says:

from passlib.hash import argon2

which works fine, but ptype says:

Can't find module 'passlib.hash'. [import-error]

pjz avatar Sep 16 '19 15:09 pjz

Looks like passlib is a third party library - how did you install it? pytype should be able to discover most pip-installed libraries.

rchen152 avatar Sep 16 '19 20:09 rchen152

It was installed with pip. You should be able to reproduce the error by doing:

python3.7 -m venv /tmp/p
/tmp/p/bin/pip install pytype
/tmp/p/bin/pip install passlib
echo "from passlib.hash import argon2" >/tmp/p/p.py
. /tmp/p/bin/activate
pytype /tmp/p/p.py

pjz avatar Sep 17 '19 15:09 pjz

Thanks! I was able to reproduce the error.

rchen152 avatar Sep 17 '19 17:09 rchen152

pytype does not report any errors on a file containing "import passlib.hash", so this doesn't seem to be a problem of the library not being found at all - it's probably a bug in load_pytd.py.

rchen152 avatar Jan 19 '21 06:01 rchen152