pythonwindowsvirtualenvpython-venv

Virtual Environment calling global installation of Python instead of venv-specifc version


I'm having an issue where for some reason the virtual environments that I'm creating are accessing my system-wide installations of Python and pip when they shouldn't be.

Here's my fairly simple workflow just make sure I'm not missing anything obvious (Windows 10, Python 3.8.2):

python -m venv venv
venv\Scripts\activate.bat

My path is now prepended by (venv), as you'd expect. However,

pip list

lists all of the system-wide pip packages I have instead of just the ones that should be in that venv.

pyvenv.cfg indicates that

include-system-site-packages = false

When I open the interpreter using

python

In the virtual environment,

sys.executable    

Returns the path on my C drive and

print(pip.__file__)

Does the same. I suspect they should instead be pointing to the interpreter and pip in the virtual environment but don't know how to make that happen.

Edit: 4/27/20, Still dealing with this issue, I have tried:

I'm really at a loss here, would appreciate any help.


Solution

  • To anyone looking at this later on, I eventually realized that the problem was only occurring in a specific folder. Making virtual environments elsewhere on my computer seems to work fine. Why this is the case? I have no idea. I'm curious, but not enough to spend another second on this problem. So there you go.