-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Description
I use Anaconda to manage everything related to Python. Thus, I have a Conda environment where I installed mypy
, keras
and numpy
.
My PYTHONPATH reads:
/home/user/workspace/project/:/home/user/workspace/project/python/:
My MYPYPATH is just a copy of this, created by:
export MYPYPATH="$PYTHONPATH"
My minimum working example reads:
#!/usr/bin/env python
import keras
import numpy
print("Hello World!")
When I execute mypy module-test.py
I get:
module-test.py:3: error: Cannot find module named 'keras'
module-test.py:3: note: See https://mypy.readthedocs.io/en/latest/running_mypy.html#missing-imports
module-test.py:4: error: No library stub file for module 'numpy'
module-test.py:4: note: (Stub files are from https://github.com/python/typeshed)
Note that mypy
does not complain about numpy
. However, numpy
should not be installed system-wide:
$ apt search numpy | egrep -i insta
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
Now I wonder why mypy
finds numpy
but not keras
and how to resolve this. Since I am using several Conda environments, manually tweaking MYPYPATH is not an option.
Metadata
Metadata
Assignees
Labels
No labels