![]() |
Python venv and PIP version issue - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Python venv and PIP version issue (/thread-39464.html) |
Python venv and PIP version issue - JanOlvegg - Feb-21-2023 My work computer runs windows and I do not have admin rights. The computer however does allow install of Python using the company's package manager. The package manager installs python into c:\program files and updates the path. It also installs PIP into c:\program files. If I update PIP using pip install --upgrade pip, the new version of pip is installed into my local appdata directory. According to documentation, this appears to be normal because on windows, pip installs packages to the appdata by default. I did however I did notice that I had to update the path variable to favor the appdata directory first or the older global verison of pip gets run instead. When I create a new virtual environment using python -m venv <myproject>\.venv, the older version of pip in program files is copied over to the virtual environment instead of the newer version in appdata. This is despite that the older PIP is later in the path. Is this some sort of bug or is there a way around this? My current workaround is to run pip again in the virtual environment, which seems to install the pip into the virtual environment. RE: Python venv and PIP version issue - snippsat - Feb-21-2023 (Feb-21-2023, 08:06 PM)JanOlvegg Wrote: When I create a new virtual environment using python -m venv <myproject>\.venv, the older version of pip in program files is copied over to the virtual environment instead of the newer version in appdata. This is despite that the older PIP is later in the path. Is this some sort of bug or is there a way around this?This is noraml and i don't know if there is a fix. # Before λ pip -V pip 23.0.1 from C:\python310\lib\site-packages\pip (python 3.10) # Make G:\all_flask λ python -m venv test_env G:\all_flask λ cd test_env\ G:\all_flask\test_env λ G:\all_flask\test_env\Scripts\activate # In venv old version (test_env) G:\all_flask\test_env λ pip -V pip 22.0.4 from G:\all_flask\test_env\lib\site-packages\pip (python 3.10) (test_env) G:\all_flask\test_envSo many time i leave it at old version(lazy) in venv as there rarely any issue. To get the new version in venv,same as outside. (test_env) G:\all_flask\test_env λ python -m pip install --upgrade pip Requirement already satisfied: pip in g:\all_flask\test_env\lib\site-packages (22.0.4) Collecting pip Using cached pip-23.0.1-py3-none-any.whl (2.1 MB) Installing collected packages: pip Attempting uninstall: pip Found existing installation: pip 22.0.4 Uninstalling pip-22.0.4: Successfully uninstalled pip-22.0.4 Successfully installed pip-23.0.1 (test_env) G:\all_flask\test_env λ pip -V pip 23.0.1 from G:\all_flask\test_env\lib\site-packages\pip (python 3.10) RE: Python venv and PIP version issue - JanOlvegg - Feb-22-2023 Thank you for the verification. I will update the steps to ensure that pip upgrade is part of the process. One reason to use the upgrade is because the I had an issue with install which weren't fixed until I upgraded. |