Issue
I am using Vim within an activated Python virtual environment i.e. I have run
python3 -m pip venv env
. env/bin/activate
However when I am editing a Python file, then Ale is complaining about import errors for third party packages. These are definitely installed inside the virtual environment.
Investigation
Upon further investigation I noticed the following issue. Running inside Vim
:py3 import sys, site; print('Version:', sys.version); print('Executable:', sys.executable); print('Site Packages:', site.getsitepackages())
gives the output
Version: 3.5.2 (default, Nov 12 2018, 13:43:14)
[GCC 5.4.0 20160609]
Executable: /home/rob/Documents/misc/benchmarks/env/bin/python3
Site Packages: ['/home/rob/Documents/misc/benchmarks/env/lib/python3.5/site-packages', '/home/rob/Documents/misc/benchmarks/env/local/lib/python3.5/dist-packages', '/home/rob/Documents/misc/benchmarks/env/lib/python3/dist-packages', '/home/rob/Documents/misc/benchmarks/env/lib/python3.5/dist-packages']
The issue here is that I am using Python3.6. Hence the above site packages don't even exist. This is indicated, as while it says the Python version is 3.5.2, if I run
/home/rob/Documents/misc/benchmarks/env/bin/python3 --version
it gives
Python 3.6.8
Question
Hence the version and executable are not matching up within Vim. Is there a way to fix this and will it fix my false import errors with Ale?
pythonthreedll
andpythonthreehome
helps. – Ralf Jan 30 '19 at 21:22