Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues creating and activating a virtualenv in git bash #1818

Closed
asottile opened this issue May 5, 2020 · 4 comments · Fixed by #1924
Closed

Issues creating and activating a virtualenv in git bash #1818

asottile opened this issue May 5, 2020 · 4 comments · Fixed by #1924

Comments

@asottile
Copy link
Contributor

asottile commented May 5, 2020

Issue

PATH (and maybe VIRTUAL_ENV?) seems to be set incorrectly on windows when using git bash, this worked with virtualenv 16.x

Environment

Provide at least:

  • OS: windows 10
  • pip list of the host python where virtualenv is installed:
$ virtualenv --version
virtualenv 20.0.20 from c:\python37\lib\site-packages\virtualenv\__init__.py

$ python --version --version
Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 22:22:05) [MSC v.1916 64 bit (AMD64)]

$ pip freeze
appdirs==1.4.3
colorama==0.4.3
distlib==0.3.0
filelock==3.0.12
importlib-metadata==1.6.0
packaging==20.3
pluggy==0.13.1
py==1.8.1
pyparsing==2.4.7
six==1.14.0
toml==0.10.0
tox==3.14.6
virtualenv==20.0.20
zipp==3.1.0

Output of the virtual environment creation

Make sure to run the creation with -vvv --with-traceback:

$ virtualenv venv -vvv
87 setup logging to NOTSET [DEBUG report:42]
94 find interpreter for spec PythonSpec(path=c:\python37\python.exe) [INFO builtin:44]
94 proposed PythonInfo(spec=CPython3.7.3.final.0-64, exe=c:\python37\python.exe, platform=win32, version='3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 22:22:05) [MSC v.1916 64 bit (AMD64)]', encoding_fs_io=utf-8-cp1252) [INFO builtin:50]
94 accepted PythonInfo(spec=CPython3.7.3.final.0-64, exe=c:\python37\python.exe, platform=win32, version='3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 22:22:05) [MSC v.1916 64 bit (AMD64)]', encoding_fs_io=utf-8-cp1252) [DEBUG builtin:52]
99 symlink on filesystem does work [DEBUG info:47]
99 filesystem is not case-sensitive [DEBUG info:28]
162 create virtual environment via CPython3Windows(dest=C:\Users\Anthony\AppData\Local\Temp\x\venv, clear=False, global=False) [INFO session:52]
162 create folder C:\Users\Anthony\AppData\Local\Temp\x\venv\Lib\site-packages [DEBUG _sync:21]
163 create folder C:\Users\Anthony\AppData\Local\Temp\x\venv\Scripts [DEBUG _sync:21]
163 write C:\Users\Anthony\AppData\Local\Temp\x\venv\pyvenv.cfg [DEBUG pyenv_cfg:34]
163     home = c:\python37 [DEBUG pyenv_cfg:38]
163     implementation = CPython [DEBUG pyenv_cfg:38]
163     version_info = 3.7.3.final.0 [DEBUG pyenv_cfg:38]
163     virtualenv = 20.0.20 [DEBUG pyenv_cfg:38]
163     include-system-site-packages = false [DEBUG pyenv_cfg:38]
163     base-prefix = c:\python37 [DEBUG pyenv_cfg:38]
163     base-exec-prefix = c:\python37 [DEBUG pyenv_cfg:38]
163     base-executable = c:\python37\python.exe [DEBUG pyenv_cfg:38]
164 symlink c:\python37\python.exe to C:\Users\Anthony\AppData\Local\Temp\x\venv\Scripts\python.exe [DEBUG _sync:40]
164 symlink c:\python37\pythonw.exe to C:\Users\Anthony\AppData\Local\Temp\x\venv\Scripts\pythonw.exe [DEBUG _sync:40]
165 symlink c:\python37\python3.dll to C:\Users\Anthony\AppData\Local\Temp\x\venv\Scripts\python3.dll [DEBUG _sync:40]
165 symlink c:\python37\python37.dll to C:\Users\Anthony\AppData\Local\Temp\x\venv\Scripts\python37.dll [DEBUG _sync:40]
166 symlink c:\python37\vcruntime140.dll to C:\Users\Anthony\AppData\Local\Temp\x\venv\Scripts\vcruntime140.dll [DEBUG_sync:40]
166 symlink c:\python37\DLLs\libcrypto-1_1-x64.dll to C:\Users\Anthony\AppData\Local\Temp\x\venv\Scripts\libcrypto-1_1-x64.dll [DEBUG _sync:40]
169 symlink c:\python37\DLLs\libssl-1_1-x64.dll to C:\Users\Anthony\AppData\Local\Temp\x\venv\Scripts\libssl-1_1-x64.dll [DEBUG _sync:40]
169 symlink c:\python37\DLLs\pyexpat.pyd to C:\Users\Anthony\AppData\Local\Temp\x\venv\Scripts\pyexpat.pyd [DEBUG _sync:40]
170 symlink c:\python37\DLLs\select.pyd to C:\Users\Anthony\AppData\Local\Temp\x\venv\Scripts\select.pyd [DEBUG _sync:40]
170 symlink c:\python37\DLLs\sqlite3.dll to C:\Users\Anthony\AppData\Local\Temp\x\venv\Scripts\sqlite3.dll [DEBUG _sync:40]
171 symlink c:\python37\DLLs\tcl86t.dll to C:\Users\Anthony\AppData\Local\Temp\x\venv\Scripts\tcl86t.dll [DEBUG _sync:40]
171 symlink c:\python37\DLLs\tk86t.dll to C:\Users\Anthony\AppData\Local\Temp\x\venv\Scripts\tk86t.dll [DEBUG _sync:40]
172 symlink c:\python37\DLLs\unicodedata.pyd to C:\Users\Anthony\AppData\Local\Temp\x\venv\Scripts\unicodedata.pyd [DEBUG _sync:40]
172 symlink c:\python37\DLLs\winsound.pyd to C:\Users\Anthony\AppData\Local\Temp\x\venv\Scripts\winsound.pyd [DEBUG _sync:40]
172 symlink c:\python37\DLLs\_asyncio.pyd to C:\Users\Anthony\AppData\Local\Temp\x\venv\Scripts\_asyncio.pyd [DEBUG _sync:40]
173 symlink c:\python37\DLLs\_bz2.pyd to C:\Users\Anthony\AppData\Local\Temp\x\venv\Scripts\_bz2.pyd [DEBUG _sync:40]
173 symlink c:\python37\DLLs\_ctypes.pyd to C:\Users\Anthony\AppData\Local\Temp\x\venv\Scripts\_ctypes.pyd [DEBUG _sync:40]
174 symlink c:\python37\DLLs\_ctypes_test.pyd to C:\Users\Anthony\AppData\Local\Temp\x\venv\Scripts\_ctypes_test.pyd [DEBUG _sync:40]
174 symlink c:\python37\DLLs\_decimal.pyd to C:\Users\Anthony\AppData\Local\Temp\x\venv\Scripts\_decimal.pyd [DEBUG _sync:40]
174 symlink c:\python37\DLLs\_elementtree.pyd to C:\Users\Anthony\AppData\Local\Temp\x\venv\Scripts\_elementtree.pyd [DEBUG _sync:40]
175 symlink c:\python37\DLLs\_hashlib.pyd to C:\Users\Anthony\AppData\Local\Temp\x\venv\Scripts\_hashlib.pyd [DEBUG _sync:40]
175 symlink c:\python37\DLLs\_lzma.pyd to C:\Users\Anthony\AppData\Local\Temp\x\venv\Scripts\_lzma.pyd [DEBUG _sync:40]
176 symlink c:\python37\DLLs\_msi.pyd to C:\Users\Anthony\AppData\Local\Temp\x\venv\Scripts\_msi.pyd [DEBUG _sync:40]
176 symlink c:\python37\DLLs\_multiprocessing.pyd to C:\Users\Anthony\AppData\Local\Temp\x\venv\Scripts\_multiprocessing.pyd [DEBUG _sync:40]
177 symlink c:\python37\DLLs\_overlapped.pyd to C:\Users\Anthony\AppData\Local\Temp\x\venv\Scripts\_overlapped.pyd [DEBUG _sync:40]
177 symlink c:\python37\DLLs\_queue.pyd to C:\Users\Anthony\AppData\Local\Temp\x\venv\Scripts\_queue.pyd [DEBUG _sync:40]
177 symlink c:\python37\DLLs\_socket.pyd to C:\Users\Anthony\AppData\Local\Temp\x\venv\Scripts\_socket.pyd [DEBUG _sync:40]
178 symlink c:\python37\DLLs\_sqlite3.pyd to C:\Users\Anthony\AppData\Local\Temp\x\venv\Scripts\_sqlite3.pyd [DEBUG _sync:40]
178 symlink c:\python37\DLLs\_ssl.pyd to C:\Users\Anthony\AppData\Local\Temp\x\venv\Scripts\_ssl.pyd [DEBUG _sync:40]
179 symlink c:\python37\DLLs\_testbuffer.pyd to C:\Users\Anthony\AppData\Local\Temp\x\venv\Scripts\_testbuffer.pyd [DEBUG _sync:40]
179 symlink c:\python37\DLLs\_testcapi.pyd to C:\Users\Anthony\AppData\Local\Temp\x\venv\Scripts\_testcapi.pyd [DEBUG _sync:40]
180 symlink c:\python37\DLLs\_testconsole.pyd to C:\Users\Anthony\AppData\Local\Temp\x\venv\Scripts\_testconsole.pyd [DEBUG _sync:40]
180 symlink c:\python37\DLLs\_testimportmultiple.pyd to C:\Users\Anthony\AppData\Local\Temp\x\venv\Scripts\_testimportmultiple.pyd [DEBUG _sync:40]
180 symlink c:\python37\DLLs\_testmultiphase.pyd to C:\Users\Anthony\AppData\Local\Temp\x\venv\Scripts\_testmultiphase.pyd [DEBUG _sync:40]
181 symlink c:\python37\DLLs\_tkinter.pyd to C:\Users\Anthony\AppData\Local\Temp\x\venv\Scripts\_tkinter.pyd [DEBUG _sync:40]
183 create virtualenv import hook file C:\Users\Anthony\AppData\Local\Temp\x\venv\Lib\site-packages\_virtualenv.pth [DEBUG api:95]
183 create C:\Users\Anthony\AppData\Local\Temp\x\venv\Lib\site-packages\_virtualenv.py [DEBUG api:98]
184 ============================== target debug ============================== [DEBUG session:54]
184 debug via 'C:\Users\Anthony\AppData\Local\Temp\x\venv\Scripts\python.exe' 'c:\python37\lib\site-packages\virtualenv\create\debug.py' [DEBUG creator:187]
184 {
  "sys": {
    "executable": "C:\\Users\\Anthony\\AppData\\Local\\Temp\\x\\venv\\Scripts\\python.exe",
    "_base_executable": null,
    "prefix": "C:\\Users\\Anthony\\AppData\\Local\\Temp\\x\\venv",
    "base_prefix": "c:\\python37",
    "real_prefix": null,
    "exec_prefix": "C:\\Users\\Anthony\\AppData\\Local\\Temp\\x\\venv",
    "base_exec_prefix": "c:\\python37",
    "path": [
      "C:\\Users\\Anthony\\AppData\\Local\\Temp\\x\\venv\\Scripts\\python37.zip",
      "c:\\python37\\DLLs",
      "c:\\python37\\lib",
      "c:\\python37",
      "C:\\Users\\Anthony\\AppData\\Local\\Temp\\x\\venv",
      "C:\\Users\\Anthony\\AppData\\Local\\Temp\\x\\venv\\lib\\site-packages"
    ],
    "meta_path": [
      "<class '_virtualenv._Finder'>",
      "<class '_frozen_importlib.BuiltinImporter'>",
      "<class '_frozen_importlib.FrozenImporter'>",
      "<class '_frozen_importlib_external.PathFinder'>"
    ],
    "fs_encoding": "utf-8",
    "io_encoding": "cp1252"
  },
  "version": "3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 22:22:05) [MSC v.1916 64 bit (AMD64)]",
  "makefile_filename": "c:\\python37\\Lib\\config\\Makefile",
  "os": "<module 'os' from 'c:\\\\python37\\\\lib\\\\os.py'>",
  "site": "<module 'site' from 'c:\\\\python37\\\\lib\\\\site.py'>",
  "datetime": "<module 'datetime' from 'c:\\\\python37\\\\lib\\\\datetime.py'>",
  "math": "<module 'math' (built-in)>",
  "json": "<module 'json' from 'c:\\\\python37\\\\lib\\\\json\\\\__init__.py'>"
} [DEBUG session:55]
250 add seed packages via FromAppData(download=False, pip=latest, setuptools=latest, wheel=latest, via=copy, app_data_dir=C:\Users\Anthony\AppData\Local\pypa\virtualenv\seed-app-data\v1.0.1) [INFO session:59]
250 Attempting to acquire lock 2233124906992 on C:\Users\Anthony\AppData\Local\pypa\virtualenv\seed-app-data\v1.0.1\3.7\wheels.lock [DEBUG filelock:270]
251 Lock 2233124906992 acquired on C:\Users\Anthony\AppData\Local\pypa\virtualenv\seed-app-data\v1.0.1\3.7\wheels.lock[INFO filelock:274]
252 get bundled wheel c:\python37\lib\site-packages\virtualenv\seed\embed\wheels\pip-20.1-py2.py3-none-any.whl [DEBUG acquire:60]
253 get bundled wheel c:\python37\lib\site-packages\virtualenv\seed\embed\wheels\setuptools-46.1.3-py3-none-any.whl [DEBUG acquire:60]
253 get bundled wheel c:\python37\lib\site-packages\virtualenv\seed\embed\wheels\wheel-0.34.2-py2.py3-none-any.whl [DEBUG acquire:60]
261 install wheel from wheel C:\Users\Anthony\AppData\Local\pypa\virtualenv\seed-app-data\v1.0.1\3.7\wheels\wheel-0.34.2-py2.py3-none-any.whl via CopyPipInstall [DEBUG via_app_data:47]
261 install setuptools from wheel C:\Users\Anthony\AppData\Local\pypa\virtualenv\seed-app-data\v1.0.1\3.7\wheels\setuptools-46.1.3-py3-none-any.whl via CopyPipInstall [DEBUG via_app_data:47]
261 install pip from wheel C:\Users\Anthony\AppData\Local\pypa\virtualenv\seed-app-data\v1.0.1\3.7\wheels\pip-20.1-py2.py3-none-any.whl via CopyPipInstall [DEBUG via_app_data:47]
262 build install image to C:\Users\Anthony\AppData\Local\pypa\virtualenv\seed-app-data\v1.0.1\3.7\image\CopyPipInstall\pip-20.1-py2.py3-none-any of pip-20.1-py2.py3-none-any.whl [DEBUG base:57]
262 copy directory C:\Users\Anthony\AppData\Local\pypa\virtualenv\seed-app-data\v1.0.1\3.7\image\CopyPipInstall\wheel-0.34.2-py2.py3-none-any\wheel to C:\Users\Anthony\AppData\Local\Temp\x\venv\Lib\site-packages\wheel [DEBUG _sync:48]
262 copy C:\Users\Anthony\AppData\Local\pypa\virtualenv\seed-app-data\v1.0.1\3.7\image\CopyPipInstall\setuptools-46.1.3-py3-none-any\easy_install.py to C:\Users\Anthony\AppData\Local\Temp\x\venv\Lib\site-packages\easy_install.py [DEBUG _sync:48]
263 copy directory C:\Users\Anthony\AppData\Local\pypa\virtualenv\seed-app-data\v1.0.1\3.7\image\CopyPipInstall\setuptools-46.1.3-py3-none-any\pkg_resources to C:\Users\Anthony\AppData\Local\Temp\x\venv\Lib\site-packages\pkg_resources [DEBUG _sync:48]
277 copy directory C:\Users\Anthony\AppData\Local\pypa\virtualenv\seed-app-data\v1.0.1\3.7\image\CopyPipInstall\wheel-0.34.2-py2.py3-none-any\wheel-0.34.2.dist-info to C:\Users\Anthony\AppData\Local\Temp\x\venv\Lib\site-packages\wheel-0.34.2.dist-info [DEBUG _sync:48]
283 copy directory C:\Users\Anthony\AppData\Local\pypa\virtualenv\seed-app-data\v1.0.1\3.7\image\CopyPipInstall\setuptools-46.1.3-py3-none-any\setuptools to C:\Users\Anthony\AppData\Local\Temp\x\venv\Lib\site-packages\setuptools [DEBUG _sync:48]
285 copy C:\Users\Anthony\AppData\Local\pypa\virtualenv\seed-app-data\v1.0.1\3.7\image\CopyPipInstall\wheel-0.34.2-py2.py3-none-any\wheel-0.34.2.virtualenv to C:\Users\Anthony\AppData\Local\Temp\x\venv\Lib\site-packages\wheel-0.34.2.virtualenv [DEBUG _sync:48]
288 generated console scripts wheel-3.7.exe wheel3.exe wheel.exe [DEBUG base:53]
353 copy directory C:\Users\Anthony\AppData\Local\pypa\virtualenv\seed-app-data\v1.0.1\3.7\image\CopyPipInstall\setuptools-46.1.3-py3-none-any\setuptools-46.1.3.dist-info to C:\Users\Anthony\AppData\Local\Temp\x\venv\Lib\site-packages\setuptools-46.1.3.dist-info [DEBUG _sync:48]
361 copy C:\Users\Anthony\AppData\Local\pypa\virtualenv\seed-app-data\v1.0.1\3.7\image\CopyPipInstall\setuptools-46.1.3-py3-none-any\setuptools-46.1.3.virtualenv to C:\Users\Anthony\AppData\Local\Temp\x\venv\Lib\site-packages\setuptools-46.1.3.virtualenv [DEBUG _sync:48]
365 generated console scripts easy_install-3.7.exe easy_install.exe easy_install3.exe [DEBUG base:53]
535 copy directory C:\Users\Anthony\AppData\Local\pypa\virtualenv\seed-app-data\v1.0.1\3.7\image\CopyPipInstall\pip-20.1-py2.py3-none-any\pip to C:\Users\Anthony\AppData\Local\Temp\x\venv\Lib\site-packages\pip [DEBUG _sync:48]
2011 copy directory C:\Users\Anthony\AppData\Local\pypa\virtualenv\seed-app-data\v1.0.1\3.7\image\CopyPipInstall\pip-20.1-py2.py3-none-any\pip-20.1.dist-info to C:\Users\Anthony\AppData\Local\Temp\x\venv\Lib\site-packages\pip-20.1.dist-info [DEBUG _sync:48]
2032 copy C:\Users\Anthony\AppData\Local\pypa\virtualenv\seed-app-data\v1.0.1\3.7\image\CopyPipInstall\pip-20.1-py2.py3-none-any\pip-20.1.virtualenv to C:\Users\Anthony\AppData\Local\Temp\x\venv\Lib\site-packages\pip-20.1.virtualenv [DEBUG _sync:48]
2034 generated console scripts pip.exe pip-3.7.exe pip3.7.exe pip3.exe [DEBUG base:53]
2034 Attempting to release lock 2233124906992 on C:\Users\Anthony\AppData\Local\pypa\virtualenv\seed-app-data\v1.0.1\3.7\wheels.lock [DEBUG filelock:315]
2035 Lock 2233124906992 released on C:\Users\Anthony\AppData\Local\pypa\virtualenv\seed-app-data\v1.0.1\3.7\wheels.lock [INFO filelock:318]
2035 add activators for Bash, Batch, Fish, PowerShell, Python, Xonsh [INFO session:65]
2058 write C:\Users\Anthony\AppData\Local\Temp\x\venv\pyvenv.cfg [DEBUG pyenv_cfg:34]
2058    home = c:\python37 [DEBUG pyenv_cfg:38]
2058    implementation = CPython [DEBUG pyenv_cfg:38]
2058    version_info = 3.7.3.final.0 [DEBUG pyenv_cfg:38]
2058    virtualenv = 20.0.20 [DEBUG pyenv_cfg:38]
2058    include-system-site-packages = false [DEBUG pyenv_cfg:38]
2058    base-prefix = c:\python37 [DEBUG pyenv_cfg:38]
2058    base-exec-prefix = c:\python37 [DEBUG pyenv_cfg:38]
2058    base-executable = c:\python37\python.exe [DEBUG pyenv_cfg:38]
2058 created virtual environment CPython3.7.3.final.0-64 in 1975ms
  creator CPython3Windows(dest=C:\Users\Anthony\AppData\Local\Temp\x\venv, clear=False, global=False)
  seeder FromAppData(download=False, pip=latest, setuptools=latest, wheel=latest, via=copy, app_data_dir=C:\Users\Anthony\AppData\Local\pypa\virtualenv\seed-app-data\v1.0.1)
  activators BashActivator,BatchActivator,FishActivator,PowerShellActivator,PythonActivator,XonshActivator [WARNING __main__:21]

Here's the activation:

$ set -x; . venv/Scripts/activate; set +x
+ . venv/Scripts/activate
++ '[' venv/Scripts/activate = /usr/bin/bash ']'
++ deactivate nondestructive
++ unset -f pydoc
++ '[' -z '' ']'
++ '[' -z '' ']'
++ '[' -n /usr/bin/bash ']'
++ hash -r
++ '[' -z '' ']'
++ unset VIRTUAL_ENV
++ '[' '!' nondestructive = nondestructive ']'
++ VIRTUAL_ENV='C:\Users\Anthony\AppData\Local\Temp\x\venv'
++ export VIRTUAL_ENV
++ _OLD_VIRTUAL_PATH='/c/Users/Anthony/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/mingw64/bin:/usr/bin:/c/Users/Anthony/bin:/c/Python37/Scripts:/c/Python37:/c/WINDOWS/system32:/c/WINDOWS:/c/WINDOWS/System32/Wbem:/c/WINDOWS/System32/WindowsPowerShell/v1.0:/c/WINDOWS/System32/OpenSSH:/cmd:/mingw64/bin:/usr/bin:/c/Program Files (x86)/Windows Live/Shared:/c/Users/Anthony/.cargo/bin:/c/Users/Anthony/AppData/Local/Microsoft/WindowsApps:/usr/bin/vendor_perl:/usr/bin/core_perl'
++ PATH='C:\Users\Anthony\AppData\Local\Temp\x\venv/Scripts:/c/Users/Anthony/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/mingw64/bin:/usr/bin:/c/Users/Anthony/bin:/c/Python37/Scripts:/c/Python37:/c/WINDOWS/system32:/c/WINDOWS:/c/WINDOWS/System32/Wbem:/c/WINDOWS/System32/WindowsPowerShell/v1.0:/c/WINDOWS/System32/OpenSSH:/cmd:/mingw64/bin:/usr/bin:/c/Program Files (x86)/Windows Live/Shared:/c/Users/Anthony/.cargo/bin:/c/Users/Anthony/AppData/Local/Microsoft/WindowsApps:/usr/bin/vendor_perl:/usr/bin/core_perl'
++ export PATH
++ '[' -z '' ']'
++ '[' -z '' ']'
++ _OLD_VIRTUAL_PS1='\[\033]0;$TITLEPREFIX:$PWD\007\]\n\[\033[32m\]\u@\h \[\033[35m\]$MSYSTEM \[\033[33m\]\w\[\033[36m\]`__git_ps1`\[\033[0m\]\n$ '
++ '[' x '!=' x ']'
+++ basename 'C:\Users\Anthony\AppData\Local\Temp\x\venv'
++ PS1='(venv) \[\033]0;$TITLEPREFIX:$PWD\007\]\n\[\033[32m\]\u@\h \[\033[35m\]$MSYSTEM \[\033[33m\]\w\[\033[36m\]`__git_ps1`\[\033[0m\]\n$ '
++ export PS1
++ alias pydoc
++ true
++ '[' -n /usr/bin/bash ']'
++ hash -r
+ set +x

here's the oddness:

$ which pip
/tmp/x/\Users\Anthony\AppData\Local\Temp\x\venv/Scripts/pip
(venv)
$ echo "$PATH"
C:\Users\Anthony\AppData\Local\Temp\x\venv/Scripts:/c/Users/Anthony/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/mingw64/bin:/usr/bin:/c/Users/Anthony/bin:/c/Python37/Scripts:/c/Python37:/c/WINDOWS/system32:/c/WINDOWS:/c/WINDOWS/System32/Wbem:/c/WINDOWS/System32/WindowsPowerShell/v1.0:/c/WINDOWS/System32/OpenSSH:/cmd:/mingw64/bin:/usr/bin:/c/Program Files (x86)/Windows Live/Shared:/c/Users/Anthony/.cargo/bin:/c/Users/Anthony/AppData/Local/Microsoft/WindowsApps:/usr/bin/vendor_perl:/usr/bin/core_perl
(venv)
$ python -c 'import os; print(os.environ["PATH"])'
C;C:\Users\Anthony\AppData\Local\Temp\x\venv\Scripts;C:\Users\Anthony\bin;C:\Program Files\Git\mingw64\bin;C:\Program F
iles\Git\usr\local\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\mingw64\bin;C:\Pr
ogram Files\Git\usr\bin;C:\Users\Anthony\bin;C:\Python37\Scripts;C:\Python37;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\
System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;C:\Program Files\Git\cmd;C:\Progra
m Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Program Files (x86)\Windows Live\Shared;C:\Users\Anthony\.cargo
\bin;C:\Users\Anthony\AppData\Local\Microsoft\WindowsApps;C:\Program Files\Git\usr\bin\vendor_perl;C:\Program Files\Git
\usr\bin\core_perl

this seemed to break pip install aiohttp and then python -c import aiohttp:

$ pip install aiohttp
Collecting aiohttp
  Using cached aiohttp-3.6.2-cp37-cp37m-win_amd64.whl (649 kB)
Collecting yarl<2.0,>=1.0
  Using cached yarl-1.4.2-cp37-cp37m-win_amd64.whl (125 kB)
Collecting async-timeout<4.0,>=3.0
  Using cached async_timeout-3.0.1-py3-none-any.whl (8.2 kB)
Collecting multidict<5.0,>=4.5
  Using cached multidict-4.7.5-cp37-cp37m-win_amd64.whl (48 kB)
Collecting chardet<4.0,>=2.0
  Using cached chardet-3.0.4-py2.py3-none-any.whl (133 kB)
Collecting attrs>=17.3.0
  Using cached attrs-19.3.0-py2.py3-none-any.whl (39 kB)
Collecting idna>=2.0
  Using cached idna-2.9-py2.py3-none-any.whl (58 kB)
Installing collected packages: idna, multidict, yarl, async-timeout, chardet, attrs, aiohttp
Successfully installed aiohttp-3.6.2 async-timeout-3.0.1 attrs-19.3.0 chardet-3.0.4 idna-2.9 multidict-4.7.5 yarl-1.4.2
(venv)
$ python -c 'import aiohttp'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'aiohttp'
$ ls venv/Lib/site-packages/
__pycache__/                    attr/                     multidict/                  setuptools-46.1.3.dist-info/
_virtualenv.pth                 attrs-19.3.0.dist-info/   multidict-4.7.5.dist-info/  setuptools-46.1.3.virtualenv
_virtualenv.py                  chardet/                  pip/                        wheel/
aiohttp/                        chardet-3.0.4.dist-info/  pip-20.1.dist-info/         wheel-0.34.2.dist-info/
aiohttp-3.6.2.dist-info/        easy_install.py           pip-20.1.virtualenv         wheel-0.34.2.virtualenv
async_timeout/                  idna/                     pkg_resources/              yarl/
async_timeout-3.0.1.dist-info/  idna-2.9.dist-info/       setuptools/                 yarl-1.4.2.dist-info/
@saytosid
Copy link
Contributor

I am happy to work on this issue :) Haven't contributed in a long time 🙂

saytosid pushed a commit to saytosid/virtualenv that referenced this issue Aug 15, 2020
Fixes: pypa#1818

Signed-off-by: Siddhant Kumar <skumar619@bloomberg.net>
saytosid pushed a commit to saytosid/virtualenv that referenced this issue Aug 15, 2020
Fixes: pypa#1818

Signed-off-by: Siddhant Kumar <skumar619@bloomberg.net>
saytosid pushed a commit to saytosid/virtualenv that referenced this issue Aug 15, 2020
Fixes: pypa#1818

Signed-off-by: Siddhant Kumar <skumar619@bloomberg.net>
saytosid pushed a commit to saytosid/virtualenv that referenced this issue Aug 15, 2020
Fixes: pypa#1818

Signed-off-by: Siddhant Kumar <skumar619@bloomberg.net>
@laurent-leconte
Copy link

hello, I believe this bug is not a duplicate of #1924 and is not fixed.

Why is this not a duplicate:
In #1924, the Scripts/activate command does not work. In this bug, the command works and the virtualenv is activated (ref original post), however Python cannot find modules installed in the virtualenv.

Why I believe this isn't fixed: running the latest version of virtualenv (20.0.31), I'm able to reproduce all the steps above and I get an ImportError when running python. Interestingly, I don't get an error when running pytest, although the code imports the same modules.

I'm happy to reattach logs to this bug or open a new one, please let me know how to proceed.

@gaborbernat
Copy link
Contributor

Install virtualenv from the repository, and try to replicate it with that. If you can provide a reproducible with that I'll reopen.

@laurent-leconte
Copy link

I was able to reproduce the issue from the repo.

Installing the latest version:

$ pip install git+https://github.com/pypa/virtualenv.git#egg=virtualenv -U
Collecting virtualenv from git+https://github.com/pypa/virtualenv.git#egg=virtualenv
  Cloning https://github.com/pypa/virtualenv.git to c:\users\laurent\appdata\local\temp\pip-install-m1238c4f\virtualenv
  Running command git clone -q https://github.com/pypa/virtualenv.git 'C:\Users\laurent\AppData\Local\Temp\pip-install-m1238c4f\virtualenv'
  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
  Getting requirements to build wheel: started
  Getting requirements to build wheel: finished with status 'done'
    Preparing wheel metadata: started
    Preparing wheel metadata: finished with status 'done'
Requirement already satisfied, skipping upgrade: six<2,>=1.9.0 in c:\users\laurent\appdata\local\programs\python\python38-32\lib\site-packages (from virtualenv) (1.15.0)
Requirement already satisfied, skipping upgrade: appdirs<2,>=1.4.3 in c:\users\laurent\appdata\local\programs\python\python38-32\lib\site-packages (from virtualenv) (1.4.4)
Requirement already satisfied, skipping upgrade: filelock<4,>=3.0.0 in c:\users\laurent\appdata\local\programs\python\python38-32\lib\site-packages (from virtualenv) (3.0.12)
Requirement already satisfied, skipping upgrade: distlib<1,>=0.3.1 in c:\users\laurent\appdata\local\programs\python\python38-32\lib\site-packages (from virtualenv) (0.3.1)
Building wheels for collected packages: virtualenv
  Building wheel for virtualenv (PEP 517): started
  Building wheel for virtualenv (PEP 517): finished with status 'done'
  Created wheel for virtualenv: filename=virtualenv-20.0.32.dev5+gaed87ac-cp38-none-any.whl size=4886299 sha256=2fea6dedebf9af403765146762ca924e0e5b75ee713c9b6e4f78bbb5cfeca21e
  Stored in directory: C:\Users\laurent\AppData\Local\Temp\pip-ephem-wheel-cache-msdarvzt\wheels\84\ae\38\0e7e69ccb778a2bb7d345f7d60e99dd7dc9001e409d3ddf942
Successfully built virtualenv
Installing collected packages: virtualenv
  Found existing installation: virtualenv 20.0.31
    Uninstalling virtualenv-20.0.31:
      Successfully uninstalled virtualenv-20.0.31
Successfully installed virtualenv-20.0.32.dev5+gaed87ac

$ virtualenv --version
virtualenv 20.0.32.dev5+gaed87ac from c:\users\laurent\appdata\local\programs\python\python38-32\lib\site-packages\virtualenv\__init__.py

$ python --version --version
Python 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:20:19) [MSC v.1925 32 bit (Intel)]

Creating a new virtualenv:

$ virtualenv venv -vvv --with-traceback
153 setup logging to NOTSET [DEBUG report:43]
174 find interpreter for spec PythonSpec(path=c:\users\laurent\appdata\local\programs\python\python38-32\python.exe) [INFO builtin:44]
175 proposed PythonInfo(spec=CPython3.8.3.final.0-32, exe=c:\users\laurent\appdata\local\programs\python\python38-32\python.exe, platform=win32, version='3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:20:19) [MSC v.1925 32 bit (Intel)]', encoding_fs_io=utf-8-cp1252) [INFO builtin:50]
175 accepted PythonInfo(spec=CPython3.8.3.final.0-32, exe=c:\users\laurent\appdata\local\programs\python\python38-32\python.exe, platform=win32, version='3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:20:19) [MSC v.1925 32 bit (Intel)]', encoding_fs_io=utf-8-cp1252) [DEBUG builtin:52]
181 symlink on filesystem does work [DEBUG info:47]
182 filesystem is not case-sensitive [DEBUG info:28]
278 create virtual environment via CPython3Windows(dest=C:\Users\laurent\workspace\perso\virtualenv-bug\venv, clear=False, global=False) [INFO session:52]
278 create folder C:\Users\laurent\workspace\perso\virtualenv-bug\venv\Lib\site-packages [DEBUG _sync:25]
279 create folder C:\Users\laurent\workspace\perso\virtualenv-bug\venv\Scripts [DEBUG _sync:25]
280 write C:\Users\laurent\workspace\perso\virtualenv-bug\venv\pyvenv.cfg [DEBUG pyenv_cfg:34]
280     home = c:\users\laurent\appdata\local\programs\python\python38-32 [DEBUG pyenv_cfg:38]
280     implementation = CPython [DEBUG pyenv_cfg:38]
280     version_info = 3.8.3.final.0 [DEBUG pyenv_cfg:38]
280     virtualenv = 20.0.32.dev5+gaed87ac [DEBUG pyenv_cfg:38]
280     include-system-site-packages = false [DEBUG pyenv_cfg:38]
280     base-prefix = c:\users\laurent\appdata\local\programs\python\python38-32 [DEBUG pyenv_cfg:38]
280     base-exec-prefix = c:\users\laurent\appdata\local\programs\python\python38-32 [DEBUG pyenv_cfg:38]
280     base-executable = c:\users\laurent\appdata\local\programs\python\python38-32\python.exe [DEBUG pyenv_cfg:38]
282 symlink c:\users\laurent\appdata\local\programs\python\python38-32\python.exe to C:\Users\laurent\workspace\perso\virtualenv-bug\venv\Scripts\python.exe [DEBUG _sync:44]
285 symlink c:\users\laurent\appdata\local\programs\python\python38-32\pythonw.exe to C:\Users\laurent\workspace\perso\virtualenv-bug\venv\Scripts\pythonw.exe [DEBUG _sync:44]
286 symlink c:\users\laurent\appdata\local\programs\python\python38-32\python3.dll to C:\Users\laurent\workspace\perso\virtualenv-bug\venv\Scripts\python3.dll [DEBUG _sync:44]
288 symlink c:\users\laurent\appdata\local\programs\python\python38-32\python38.dll to C:\Users\laurent\workspace\perso\virtualenv-bug\venv\Scripts\python38.dll [DEBUG _sync:44]
290 symlink c:\users\laurent\appdata\local\programs\python\python38-32\vcruntime140.dll to C:\Users\laurent\workspace\perso\virtualenv-bug\venv\Scripts\vcruntime140.dll [DEBUG _sync:44]
292 symlink c:\users\laurent\appdata\local\programs\python\python38-32\DLLs\libcrypto-1_1.dll to C:\Users\laurent\workspace\perso\virtualenv-bug\venv\Scripts\libcrypto-1_1.dll [DEBUG _sync:44]
295 symlink c:\users\laurent\appdata\local\programs\python\python38-32\DLLs\libffi-7.dll to C:\Users\laurent\workspace\perso\virtualenv-bug\venv\Scripts\libffi-7.dll [DEBUG _sync:44]
297 symlink c:\users\laurent\appdata\local\programs\python\python38-32\DLLs\libssl-1_1.dll to C:\Users\laurent\workspace\perso\virtualenv-bug\venv\Scripts\libssl-1_1.dll [DEBUG _sync:44]
300 symlink c:\users\laurent\appdata\local\programs\python\python38-32\DLLs\pyexpat.pyd to C:\Users\laurent\workspace\perso\virtualenv-bug\venv\Scripts\pyexpat.pyd [DEBUG _sync:44]
302 symlink c:\users\laurent\appdata\local\programs\python\python38-32\DLLs\select.pyd to C:\Users\laurent\workspace\perso\virtualenv-bug\venv\Scripts\select.pyd [DEBUG _sync:44]
304 symlink c:\users\laurent\appdata\local\programs\python\python38-32\DLLs\sqlite3.dll to C:\Users\laurent\workspace\perso\virtualenv-bug\venv\Scripts\sqlite3.dll [DEBUG _sync:44]
306 symlink c:\users\laurent\appdata\local\programs\python\python38-32\DLLs\tcl86t.dll to C:\Users\laurent\workspace\perso\virtualenv-bug\venv\Scripts\tcl86t.dll [DEBUG _sync:44]
308 symlink c:\users\laurent\appdata\local\programs\python\python38-32\DLLs\tk86t.dll to C:\Users\laurent\workspace\perso\virtualenv-bug\venv\Scripts\tk86t.dll [DEBUG _sync:44]
310 symlink c:\users\laurent\appdata\local\programs\python\python38-32\DLLs\unicodedata.pyd to C:\Users\laurent\workspace\perso\virtualenv-bug\venv\Scripts\unicodedata.pyd [DEBUG _sync:44]
313 symlink c:\users\laurent\appdata\local\programs\python\python38-32\DLLs\winsound.pyd to C:\Users\laurent\workspace\perso\virtualenv-bug\venv\Scripts\winsound.pyd [DEBUG _sync:44]
315 symlink c:\users\laurent\appdata\local\programs\python\python38-32\DLLs\_asyncio.pyd to C:\Users\laurent\workspace\perso\virtualenv-bug\venv\Scripts\_asyncio.pyd [DEBUG _sync:44]
317 symlink c:\users\laurent\appdata\local\programs\python\python38-32\DLLs\_bz2.pyd to C:\Users\laurent\workspace\perso\virtualenv-bug\venv\Scripts\_bz2.pyd [DEBUG _sync:44]
319 symlink c:\users\laurent\appdata\local\programs\python\python38-32\DLLs\_ctypes.pyd to C:\Users\laurent\workspace\perso\virtualenv-bug\venv\Scripts\_ctypes.pyd [DEBUG _sync:44]
321 symlink c:\users\laurent\appdata\local\programs\python\python38-32\DLLs\_ctypes_test.pyd to C:\Users\laurent\workspace\perso\virtualenv-bug\venv\Scripts\_ctypes_test.pyd [DEBUG _sync:44]
323 symlink c:\users\laurent\appdata\local\programs\python\python38-32\DLLs\_decimal.pyd to C:\Users\laurent\workspace\perso\virtualenv-bug\venv\Scripts\_decimal.pyd [DEBUG _sync:44]
325 symlink c:\users\laurent\appdata\local\programs\python\python38-32\DLLs\_elementtree.pyd to C:\Users\laurent\workspace\perso\virtualenv-bug\venv\Scripts\_elementtree.pyd [DEBUG _sync:44]
326 symlink c:\users\laurent\appdata\local\programs\python\python38-32\DLLs\_hashlib.pyd to C:\Users\laurent\workspace\perso\virtualenv-bug\venv\Scripts\_hashlib.pyd [DEBUG _sync:44]
328 symlink c:\users\laurent\appdata\local\programs\python\python38-32\DLLs\_lzma.pyd to C:\Users\laurent\workspace\perso\virtualenv-bug\venv\Scripts\_lzma.pyd [DEBUG _sync:44]
330 symlink c:\users\laurent\appdata\local\programs\python\python38-32\DLLs\_msi.pyd to C:\Users\laurent\workspace\perso\virtualenv-bug\venv\Scripts\_msi.pyd [DEBUG _sync:44]
331 symlink c:\users\laurent\appdata\local\programs\python\python38-32\DLLs\_multiprocessing.pyd to C:\Users\laurent\workspace\perso\virtualenv-bug\venv\Scripts\_multiprocessing.pyd [DEBUG _sync:44]
333 symlink c:\users\laurent\appdata\local\programs\python\python38-32\DLLs\_overlapped.pyd to C:\Users\laurent\workspace\perso\virtualenv-bug\venv\Scripts\_overlapped.pyd [DEBUG _sync:44]
336 symlink c:\users\laurent\appdata\local\programs\python\python38-32\DLLs\_queue.pyd to C:\Users\laurent\workspace\perso\virtualenv-bug\venv\Scripts\_queue.pyd [DEBUG _sync:44]
338 symlink c:\users\laurent\appdata\local\programs\python\python38-32\DLLs\_socket.pyd to C:\Users\laurent\workspace\perso\virtualenv-bug\venv\Scripts\_socket.pyd [DEBUG _sync:44]
339 symlink c:\users\laurent\appdata\local\programs\python\python38-32\DLLs\_sqlite3.pyd to C:\Users\laurent\workspace\perso\virtualenv-bug\venv\Scripts\_sqlite3.pyd [DEBUG _sync:44]
341 symlink c:\users\laurent\appdata\local\programs\python\python38-32\DLLs\_ssl.pyd to C:\Users\laurent\workspace\perso\virtualenv-bug\venv\Scripts\_ssl.pyd [DEBUG _sync:44]
342 symlink c:\users\laurent\appdata\local\programs\python\python38-32\DLLs\_testbuffer.pyd to C:\Users\laurent\workspace\perso\virtualenv-bug\venv\Scripts\_testbuffer.pyd [DEBUG _sync:44]
344 symlink c:\users\laurent\appdata\local\programs\python\python38-32\DLLs\_testcapi.pyd to C:\Users\laurent\workspace\perso\virtualenv-bug\venv\Scripts\_testcapi.pyd [DEBUG _sync:44]
346 symlink c:\users\laurent\appdata\local\programs\python\python38-32\DLLs\_testconsole.pyd to C:\Users\laurent\workspace\perso\virtualenv-bug\venv\Scripts\_testconsole.pyd [DEBUG _sync:44]
347 symlink c:\users\laurent\appdata\local\programs\python\python38-32\DLLs\_testimportmultiple.pyd to C:\Users\laurent\workspace\perso\virtualenv-bug\venv\Scripts\_testimportmultiple.pyd [DEBUG _sync:44]
349 symlink c:\users\laurent\appdata\local\programs\python\python38-32\DLLs\_testmultiphase.pyd to C:\Users\laurent\workspace\perso\virtualenv-bug\venv\Scripts\_testmultiphase.pyd [DEBUG _sync:44]
351 symlink c:\users\laurent\appdata\local\programs\python\python38-32\DLLs\_tkinter.pyd to C:\Users\laurent\workspace\perso\virtualenv-bug\venv\Scripts\_tkinter.pyd [DEBUG _sync:44]
362 create virtualenv import hook file C:\Users\laurent\workspace\perso\virtualenv-bug\venv\Lib\site-packages\_virtualenv.pth [DEBUG api:95]
364 create C:\Users\laurent\workspace\perso\virtualenv-bug\venv\Lib\site-packages\_virtualenv.py [DEBUG api:98]
369 ============================== target debug ============================== [DEBUG session:54]
370 debug via 'C:\Users\laurent\workspace\perso\virtualenv-bug\venv\Scripts\python.exe' 'c:\users\laurent\appdata\local\programs\python\python38-32\lib\site-packages\virtualenv\create\debug.py' [DEBUG creator:213]
369 {
  "sys": {
    "executable": "C:\\Users\\laurent\\workspace\\perso\\virtualenv-bug\\venv\\Scripts\\python.exe",
    "_base_executable": "C:\\Users\\laurent\\workspace\\perso\\virtualenv-bug\\venv\\Scripts\\python.exe",
    "prefix": "C:\\Users\\laurent\\workspace\\perso\\virtualenv-bug\\venv",
    "base_prefix": "c:\\users\\laurent\\appdata\\local\\programs\\python\\python38-32",
    "real_prefix": null,
    "exec_prefix": "C:\\Users\\laurent\\workspace\\perso\\virtualenv-bug\\venv",
    "base_exec_prefix": "c:\\users\\laurent\\appdata\\local\\programs\\python\\python38-32",
    "path": [
      "C:\\Users\\laurent\\workspace\\perso\\virtualenv-bug\\venv\\Scripts\\python38.zip",
      "c:\\users\\laurent\\appdata\\local\\programs\\python\\python38-32\\DLLs",
      "c:\\users\\laurent\\appdata\\local\\programs\\python\\python38-32\\lib",
      "c:\\users\\laurent\\appdata\\local\\programs\\python\\python38-32",
      "C:\\Users\\laurent\\workspace\\perso\\virtualenv-bug\\venv",
      "C:\\Users\\laurent\\workspace\\perso\\virtualenv-bug\\venv\\lib\\site-packages"
    ],
    "meta_path": [
      "<class '_virtualenv._Finder'>",
      "<class '_frozen_importlib.BuiltinImporter'>",
      "<class '_frozen_importlib.FrozenImporter'>",
      "<class '_frozen_importlib_external.PathFinder'>"
    ],
    "fs_encoding": "utf-8",
    "io_encoding": "cp1252"
  },
  "version": "3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:20:19) [MSC v.1925 32 bit (Intel)]",
  "makefile_filename": "c:\\users\\laurent\\appdata\\local\\programs\\python\\python38-32\\Lib\\config\\Makefile",
  "os": "<module 'os' from 'c:\\\\users\\\\laurent\\\\appdata\\\\local\\\\programs\\\\python\\\\python38-32\\\\lib\\\\os.py'>",
  "site": "<module 'site' from 'c:\\\\users\\\\laurent\\\\appdata\\\\local\\\\programs\\\\python\\\\python38-32\\\\lib\\\\site.py'>",
  "datetime": "<module 'datetime' from 'c:\\\\users\\\\laurent\\\\appdata\\\\local\\\\programs\\\\python\\\\python38-32\\\\lib\\\\datetime.py'>",
  "math": "<module 'math' (built-in)>",
  "json": "<module 'json' from 'c:\\\\users\\\\laurent\\\\appdata\\\\local\\\\programs\\\\python\\\\python38-32\\\\lib\\\\json\\\\__init__.py'>"
} [DEBUG session:55]
502 add seed packages via FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=C:\Users\laurent\AppData\Local\pypa\virtualenv) [INFO session:59]
508 wrote embed update of distribution setuptools at C:\Users\laurent\AppData\Local\pypa\virtualenv\wheel\3.8\embed\1\setuptools.json [DEBUG via_disk_folder:162]
509 wrote embed update of distribution pip at C:\Users\laurent\AppData\Local\pypa\virtualenv\wheel\3.8\embed\1\pip.json [DEBUG via_disk_folder:162]
509 wrote embed update of distribution wheel at C:\Users\laurent\AppData\Local\pypa\virtualenv\wheel\3.8\embed\1\wheel.json [DEBUG via_disk_folder:162]
514 triggered periodic upgrade of setuptools==50.2.0 (for python 3.8) via background process having PID 8948 [INFO periodic_update:194]
515 triggered periodic upgrade of wheel==0.35.1 (for python 3.8) via background process having PID 24396 [INFO periodic_update:194]
518 got embed update of distribution setuptools from C:\Users\laurent\AppData\Local\pypa\virtualenv\wheel\3.8\embed\1\setuptools.json [DEBUG via_disk_folder:133]
519 got embed update of distribution wheel from C:\Users\laurent\AppData\Local\pypa\virtualenv\wheel\3.8\embed\1\wheel.json [DEBUG via_disk_folder:133]
524 triggered periodic upgrade of pip==20.2.3 (for python 3.8) via background process having PID 29120 [INFO periodic_update:194]
527 got embed update of distribution pip from C:\Users\laurent\AppData\Local\pypa\virtualenv\wheel\3.8\embed\1\pip.json [DEBUG via_disk_folder:133]
546 install setuptools from wheel c:\users\laurent\appdata\local\programs\python\python38-32\lib\site-packages\virtualenv\seed\wheels\embed\setuptools-50.2.0-py3-none-any.whl via CopyPipInstall [DEBUG via_app_data:53]
578 Attempting to acquire lock 59063216 on C:\Users\laurent\AppData\Local\pypa\virtualenv\wheel\3.8\image\1\CopyPipInstall\setuptools-50.2.0-py3-none-any.lock [DEBUG filelock:270]
579 install wheel from wheel c:\users\laurent\appdata\local\programs\python\python38-32\lib\site-packages\virtualenv\seed\wheels\embed\wheel-0.35.1-py2.py3-none-any.whl via CopyPipInstall [DEBUG via_app_data:53]
580 Attempting to acquire lock 59062256 on C:\Users\laurent\AppData\Local\pypa\virtualenv\wheel\3.8\image\1\CopyPipInstall\wheel-0.35.1-py2.py3-none-any.lock [DEBUG filelock:270]
583 Lock 59063216 acquired on C:\Users\laurent\AppData\Local\pypa\virtualenv\wheel\3.8\image\1\CopyPipInstall\setuptools-50.2.0-py3-none-any.lock [INFO filelock:274]
585 Lock 59062256 acquired on C:\Users\laurent\AppData\Local\pypa\virtualenv\wheel\3.8\image\1\CopyPipInstall\wheel-0.35.1-py2.py3-none-any.lock [INFO filelock:274]
585 build install image for setuptools-50.2.0-py3-none-any.whl to C:\Users\laurent\AppData\Local\pypa\virtualenv\wheel\3.8\image\1\CopyPipInstall\setuptools-50.2.0-py3-none-any [DEBUG base:52]
585 build install image for wheel-0.35.1-py2.py3-none-any.whl to C:\Users\laurent\AppData\Local\pypa\virtualenv\wheel\3.8\image\1\CopyPipInstall\wheel-0.35.1-py2.py3-none-any [DEBUG base:52]
585 install pip from wheel c:\users\laurent\appdata\local\programs\python\python38-32\lib\site-packages\virtualenv\seed\wheels\embed\pip-20.2.3-py2.py3-none-any.whl via CopyPipInstall [DEBUG via_app_data:53]
586 Attempting to acquire lock 59063240 on C:\Users\laurent\AppData\Local\pypa\virtualenv\wheel\3.8\image\1\CopyPipInstall\pip-20.2.3-py2.py3-none-any.lock [DEBUG filelock:270]
590 Lock 59063240 acquired on C:\Users\laurent\AppData\Local\pypa\virtualenv\wheel\3.8\image\1\CopyPipInstall\pip-20.2.3-py2.py3-none-any.lock [INFO filelock:274]
591 build install image for pip-20.2.3-py2.py3-none-any.whl to C:\Users\laurent\AppData\Local\pypa\virtualenv\wheel\3.8\image\1\CopyPipInstall\pip-20.2.3-py2.py3-none-any [DEBUG base:52]
824 Attempting to release lock 59062256 on C:\Users\laurent\AppData\Local\pypa\virtualenv\wheel\3.8\image\1\CopyPipInstall\wheel-0.35.1-py2.py3-none-any.lock [DEBUG filelock:315]
825 Lock 59062256 released on C:\Users\laurent\AppData\Local\pypa\virtualenv\wheel\3.8\image\1\CopyPipInstall\wheel-0.35.1-py2.py3-none-any.lock [INFO filelock:318]
826 copy directory C:\Users\laurent\AppData\Local\pypa\virtualenv\wheel\3.8\image\1\CopyPipInstall\wheel-0.35.1-py2.py3-none-any\wheel to C:\Users\laurent\workspace\perso\virtualenv-bug\venv\Lib\site-packages\wheel [DEBUG _sync:52]
955 copy directory C:\Users\laurent\AppData\Local\pypa\virtualenv\wheel\3.8\image\1\CopyPipInstall\wheel-0.35.1-py2.py3-none-any\wheel-0.35.1.dist-info to C:\Users\laurent\workspace\perso\virtualenv-bug\venv\Lib\site-packages\wheel-0.35.1.dist-info [DEBUG _sync:52]
988 copy C:\Users\laurent\AppData\Local\pypa\virtualenv\wheel\3.8\image\1\CopyPipInstall\wheel-0.35.1-py2.py3-none-any\wheel-0.35.1.virtualenv to C:\Users\laurent\workspace\perso\virtualenv-bug\venv\Lib\site-packages\wheel-0.35.1.virtualenv [DEBUG _sync:52]
1045 generated console scripts wheel3.exe wheel-3.8.exe wheel.exe wheel3.8.exe [DEBUG base:48]
1476 Attempting to release lock 59063216 on C:\Users\laurent\AppData\Local\pypa\virtualenv\wheel\3.8\image\1\CopyPipInstall\setuptools-50.2.0-py3-none-any.lock [DEBUG filelock:315]
1477 Lock 59063216 released on C:\Users\laurent\AppData\Local\pypa\virtualenv\wheel\3.8\image\1\CopyPipInstall\setuptools-50.2.0-py3-none-any.lock [INFO filelock:318]
1478 copy C:\Users\laurent\AppData\Local\pypa\virtualenv\wheel\3.8\image\1\CopyPipInstall\setuptools-50.2.0-py3-none-any\distutils-precedence.pth to C:\Users\laurent\workspace\perso\virtualenv-bug\venv\Lib\site-packages\distutils-precedence.pth [DEBUG _sync:52]
1481 copy C:\Users\laurent\AppData\Local\pypa\virtualenv\wheel\3.8\image\1\CopyPipInstall\setuptools-50.2.0-py3-none-any\easy_install.py to C:\Users\laurent\workspace\perso\virtualenv-bug\venv\Lib\site-packages\easy_install.py [DEBUG _sync:52]
1484 copy directory C:\Users\laurent\AppData\Local\pypa\virtualenv\wheel\3.8\image\1\CopyPipInstall\setuptools-50.2.0-py3-none-any\pkg_resources to C:\Users\laurent\workspace\perso\virtualenv-bug\venv\Lib\site-packages\pkg_resources [DEBUG _sync:52]
1623 copy directory C:\Users\laurent\AppData\Local\pypa\virtualenv\wheel\3.8\image\1\CopyPipInstall\setuptools-50.2.0-py3-none-any\setuptools to C:\Users\laurent\workspace\perso\virtualenv-bug\venv\Lib\site-packages\setuptools [DEBUG _sync:52]
2111 copy directory C:\Users\laurent\AppData\Local\pypa\virtualenv\wheel\3.8\image\1\CopyPipInstall\setuptools-50.2.0-py3-none-any\setuptools-50.2.0.dist-info to C:\Users\laurent\workspace\perso\virtualenv-bug\venv\Lib\site-packages\setuptools-50.2.0.dist-info [DEBUG _sync:52]
2144 copy C:\Users\laurent\AppData\Local\pypa\virtualenv\wheel\3.8\image\1\CopyPipInstall\setuptools-50.2.0-py3-none-any\setuptools-50.2.0.virtualenv to C:\Users\laurent\workspace\perso\virtualenv-bug\venv\Lib\site-packages\setuptools-50.2.0.virtualenv [DEBUG _sync:52]
2147 copy directory C:\Users\laurent\AppData\Local\pypa\virtualenv\wheel\3.8\image\1\CopyPipInstall\setuptools-50.2.0-py3-none-any\_distutils_hack to C:\Users\laurent\workspace\perso\virtualenv-bug\venv\Lib\site-packages\_distutils_hack [DEBUG _sync:52]
2174 generated console scripts easy_install-3.8.exe easy_install3.exe easy_install3.8.exe easy_install.exe [DEBUG base:48]
2360 Attempting to release lock 59063240 on C:\Users\laurent\AppData\Local\pypa\virtualenv\wheel\3.8\image\1\CopyPipInstall\pip-20.2.3-py2.py3-none-any.lock [DEBUG filelock:315]
2361 Lock 59063240 released on C:\Users\laurent\AppData\Local\pypa\virtualenv\wheel\3.8\image\1\CopyPipInstall\pip-20.2.3-py2.py3-none-any.lock [INFO filelock:318]
2362 copy directory C:\Users\laurent\AppData\Local\pypa\virtualenv\wheel\3.8\image\1\CopyPipInstall\pip-20.2.3-py2.py3-none-any\pip to C:\Users\laurent\workspace\perso\virtualenv-bug\venv\Lib\site-packages\pip [DEBUG _sync:52]
3382 copy directory C:\Users\laurent\AppData\Local\pypa\virtualenv\wheel\3.8\image\1\CopyPipInstall\pip-20.2.3-py2.py3-none-any\pip-20.2.3.dist-info to C:\Users\laurent\workspace\perso\virtualenv-bug\venv\Lib\site-packages\pip-20.2.3.dist-info [DEBUG _sync:52]
3399 copy C:\Users\laurent\AppData\Local\pypa\virtualenv\wheel\3.8\image\1\CopyPipInstall\pip-20.2.3-py2.py3-none-any\pip-20.2.3.virtualenv to C:\Users\laurent\workspace\perso\virtualenv-bug\venv\Lib\site-packages\pip-20.2.3.virtualenv [DEBUG _sync:52]
3414 generated console scripts pip-3.8.exe pip3.exe pip3.8.exe pip.exe [DEBUG base:48]
3414 add activators for Bash, Batch, Fish, PowerShell, Python, Xonsh [INFO session:64]
3435 write C:\Users\laurent\workspace\perso\virtualenv-bug\venv\pyvenv.cfg [DEBUG pyenv_cfg:34]
3436    home = c:\users\laurent\appdata\local\programs\python\python38-32 [DEBUG pyenv_cfg:38]
3436    implementation = CPython [DEBUG pyenv_cfg:38]
3436    version_info = 3.8.3.final.0 [DEBUG pyenv_cfg:38]
3436    virtualenv = 20.0.32.dev5+gaed87ac [DEBUG pyenv_cfg:38]
3436    include-system-site-packages = false [DEBUG pyenv_cfg:38]
3436    base-prefix = c:\users\laurent\appdata\local\programs\python\python38-32 [DEBUG pyenv_cfg:38]
3436    base-exec-prefix = c:\users\laurent\appdata\local\programs\python\python38-32 [DEBUG pyenv_cfg:38]
3437    base-executable = c:\users\laurent\appdata\local\programs\python\python38-32\python.exe [DEBUG pyenv_cfg:38]
3438 created virtual environment CPython3.8.3.final.0-32 in 3291ms
  creator CPython3Windows(dest=C:\Users\laurent\workspace\perso\virtualenv-bug\venv, clear=False, global=False)
  seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=C:\Users\laurent\AppData\Local\pypa\virtualenv)
    added seed packages: pip==20.2.3, setuptools==50.2.0, wheel==0.35.1
  activators BashActivator,BatchActivator,FishActivator,PowerShellActivator,PythonActivator,XonshActivator [WARNING __main__:17]

Activating it:

$ set -x; . venv/Scripts/activate; set +x
+ . venv/Scripts/activate
++ '[' venv/Scripts/activate = /usr/bin/bash ']'
++ deactivate nondestructive
++ unset -f pydoc
++ '[' -z '' ']'
++ '[' -z '' ']'
++ '[' -n /usr/bin/bash ']'
++ hash -r
++ '[' -z '' ']'
++ unset VIRTUAL_ENV
++ '[' '!' nondestructive = nondestructive ']'
++ VIRTUAL_ENV='C:\Users\laurent\workspace\perso\virtualenv-bug\venv'
++ export VIRTUAL_ENV
++ _OLD_VIRTUAL_PATH='/c/Users/laurent/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/mingw64/bin:/usr/bin:/c/Users/laurent/bin:/c/Program Files (x86)/Intel/iCLS Client:/c/ProgramData/Oracle/Java/javapath:/c/Program Files/Intel/iCLS Client:/c/windows/system32:/c/windows:/c/windows/System32/Wbem:/c/windows/System32/WindowsPowerShell/v1.0:/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/c/Program Files/Java/jdk1.8.0_144/bin:/c/Program Files/PuTTY:/c/WINDOWS/system32:/c/WINDOWS:/c/WINDOWS/System32/Wbem:/c/WINDOWS/System32/WindowsPowerShell/v1.0:/c/Program Files (x86)/Intel/Intel(R) Management Engine Components/DAL:/c/Program Files/Intel/Intel(R) Management Engine Components/DAL:/c/Program Files (x86)/Intel/Intel(R) Management Engine Components/IPT:/c/Program Files/Intel/Intel(R) Management Engine Components/IPT:/c/WINDOWS/System32/OpenSSH:/c/Program Files/Intel/WiFi/bin:/c/Program Files/Common Files/Intel/WirelessCommon:/c/Program Files/Microsoft VS Code/bin:/cmd:/c/Program Files/Docker/Docker/resources/bin:/c/ProgramData/DockerDesktop/version-bin:/c/Program Files/nodejs:/c/Users/laurent/apps/jdk-12.0.1/bin:/c/Users/laurent/AppData/Local/Programs/Python/Python38-32/Scripts:/c/Users/laurent/AppData/Local/Programs/Python/Python38-32:/c/Users/laurent/AppData/Local/Microsoft/WindowsApps:/c/Program Files/Docker Toolbox:/c/users/laurent/apps/hashicorp:/c/users/laurent/apps:/c/Program Files/Microsoft VS Code/bin:/c/Users/laurent/AppData/Local/Programs/MiKTeX 2.9/miktex/bin/x64:/c/msys32/mingw32/bin:/c/Program Files/Intel/WiFi/bin:/c/Program Files/Common Files/Intel/WirelessCommon:/c/Users/laurent/AppData/Local/Pandoc:/c/Users/laurent/AppData/Roaming/npm:/usr/bin/vendor_perl:/usr/bin/core_perl'
++ PATH='C:\Users\laurent\workspace\perso\virtualenv-bug\venv/Scripts:/c/Users/laurent/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/mingw64/bin:/usr/bin:/c/Users/laurent/bin:/c/Program Files (x86)/Intel/iCLS Client:/c/ProgramData/Oracle/Java/javapath:/c/Program Files/Intel/iCLS Client:/c/windows/system32:/c/windows:/c/windows/System32/Wbem:/c/windows/System32/WindowsPowerShell/v1.0:/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/c/Program Files/Java/jdk1.8.0_144/bin:/c/Program Files/PuTTY:/c/WINDOWS/system32:/c/WINDOWS:/c/WINDOWS/System32/Wbem:/c/WINDOWS/System32/WindowsPowerShell/v1.0:/c/Program Files (x86)/Intel/Intel(R) Management Engine Components/DAL:/c/Program Files/Intel/Intel(R) Management Engine Components/DAL:/c/Program Files (x86)/Intel/Intel(R) Management Engine Components/IPT:/c/Program Files/Intel/Intel(R) Management Engine Components/IPT:/c/WINDOWS/System32/OpenSSH:/c/Program Files/Intel/WiFi/bin:/c/Program Files/Common Files/Intel/WirelessCommon:/c/Program Files/Microsoft VS Code/bin:/cmd:/c/Program Files/Docker/Docker/resources/bin:/c/ProgramData/DockerDesktop/version-bin:/c/Program Files/nodejs:/c/Users/laurent/apps/jdk-12.0.1/bin:/c/Users/laurent/AppData/Local/Programs/Python/Python38-32/Scripts:/c/Users/laurent/AppData/Local/Programs/Python/Python38-32:/c/Users/laurent/AppData/Local/Microsoft/WindowsApps:/c/Program Files/Docker Toolbox:/c/users/laurent/apps/hashicorp:/c/users/laurent/apps:/c/Program Files/Microsoft VS Code/bin:/c/Users/laurent/AppData/Local/Programs/MiKTeX 2.9/miktex/bin/x64:/c/msys32/mingw32/bin:/c/Program Files/Intel/WiFi/bin:/c/Program Files/Common Files/Intel/WirelessCommon:/c/Users/laurent/AppData/Local/Pandoc:/c/Users/laurent/AppData/Roaming/npm:/usr/bin/vendor_perl:/usr/bin/core_perl'
++ export PATH
++ '[' -z '' ']'
++ '[' -z '' ']'
++ _OLD_VIRTUAL_PS1='\[\033]0;$TITLEPREFIX:$PWD\007\]\n\[\033[32m\]\u@\h \[\033[35m\]$MSYSTEM \[\033[33m\]\w\[\033[36m\]`__git_ps1`\[\033[0m\]\n$ '
++ '[' x '!=' x ']'
+++ basename 'C:\Users\laurent\workspace\perso\virtualenv-bug\venv'
++ PS1='(venv) \[\033]0;$TITLEPREFIX:$PWD\007\]\n\[\033[32m\]\u@\h \[\033[35m\]$MSYSTEM \[\033[33m\]\w\[\033[36m\]`__git_ps1`\[\033[0m\]\n$ '
++ export PS1
++ alias pydoc
++ true
++ '[' -n /usr/bin/bash ']'
++ hash -r
+ set +x

The virtualenv is correctly activated:

(venv)
$ which python
/c/Users/laurent/workspace/perso/virtualenv-bug/\Users\laurent\workspace\perso\virtualenv-bug\venv/Scripts/python
(venv)
$ which pip
/c/Users/laurent/workspace/perso/virtualenv-bug/\Users\laurent\workspace\perso\virtualenv-bug\venv/Scripts/pip

Installing a package works:

(venv)
$ pip install requests
Collecting requests
  Downloading requests-2.24.0-py2.py3-none-any.whl (61 kB)
Collecting certifi>=2017.4.17
  Downloading certifi-2020.6.20-py2.py3-none-any.whl (156 kB)
Collecting urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1
  Downloading urllib3-1.25.10-py2.py3-none-any.whl (127 kB)
Collecting chardet<4,>=3.0.2
  Using cached chardet-3.0.4-py2.py3-none-any.whl (133 kB)
Collecting idna<3,>=2.5
  Downloading idna-2.10-py2.py3-none-any.whl (58 kB)
Installing collected packages: certifi, urllib3, chardet, idna, requests
Successfully installed certifi-2020.6.20 chardet-3.0.4 idna-2.10 requests-2.24.0 urllib3-1.25.10
(venv)
$ ls venv/Lib/site-packages/
__pycache__/      _virtualenv.py                chardet/                  easy_install.py       pip/                   pkg_resources/              setuptools/                   urllib3/                    wheel-0.35.1.dist-info/
_distutils_hack/  certifi/                      chardet-3.0.4.dist-info/  idna/                 pip-20.2.3.dist-info/  requests/                   setuptools-50.2.0.dist-info/  urllib3-1.25.10.dist-info/  wheel-0.35.1.virtualenv
_virtualenv.pth   certifi-2020.6.20.dist-info/  distutils-precedence.pth  idna-2.10.dist-info/  pip-20.2.3.virtualenv  requests-2.24.0.dist-info/  setuptools-50.2.0.virtualenv  wheel/

However, importing fails:

$ python -c "import requests"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'requests'

sys.path points to the basic install rather than the virtualenv:

(venv)
$ python -c "import sys; print(sys.path)"
['', 'C:\\users\\laurent\\appdata\\local\\programs\\python\\python38-32\\python38.zip', 'C:\\users\\laurent\\appdata\\local\\programs\\python\\python38-32\\DLLs', 'C:\\users\\laurent\\appdata\\local\\programs\\python\\python38-32\\lib', 'C:\\users\\laurent\\appdata\\local\\programs\\python\\python38-32', 'C:\\users\\laurent\\appdata\\local\\programs\\python\\python38-32\\lib\\site-packages']

Strangely, pytest is not affected by this issue: the import works and sys.path is correctly set.

$ cat test_import.py
import sys
import requests

def test_print_sys():
    print(sys.path)
    assert True

(venv)
$ pytest -s
============================= test session starts =============================
platform win32 -- Python 3.8.3, pytest-6.0.2, py-1.9.0, pluggy-0.13.1
rootdir: C:\Users\laurent\workspace\perso\virtualenv-bug
collected 1 item

tests\test_import.py ['C:\\Users\\laurent\\workspace\\perso\\virtualenv-bug\\tests', 'C:\\Users\\laurent\\workspace\\perso\\virtualenv-bug\\venv\\Scripts\\pytest.exe', 'c:\\users\\laurent\\workspace\\perso\\virtualenv-bug\\venv\\scripts\\python38.zip', 'c:\\users\\laurent\\appdata\\local\\programs\\python\\python38-32\\DLLs', 'c:\\users\\laurent\\appdata\\local\\programs\\python\\python38-32\\lib', 'c:\\users\\laurent\\appdata\\local\\programs\\python\\python38-32', 'c:\\users\\laurent\\workspace\\perso\\virtualenv-bug\\venv', 'c:\\users\\laurent\\workspace\\perso\\virtualenv-bug\\venv\\lib\\site-packages']
.

============================== 1 passed in 0.15s ==============================

It looks like the issue is with the activate script. I don't know the code base but I can try to investigate if someone gives me pointers to the most likely culprits.

bmwiedemann pushed a commit to bmwiedemann/openSUSE that referenced this issue Oct 29, 2020
https://build.opensuse.org/request/show/840217
by user StevenK + dimstar_suse
- Update to 20.0.33:
  * Fix ``None`` type error in cygwin if POSIX path in dest - by :user:`danyeaw`. (`#1962 <https://github.com/pypa/virtualenv/issues/1962>`_)
  * Fix Python 3.4 incompatibilities (added back to the CI) - by :user:`gaborbernat`. (`#1963 <https://github.com/pypa/virtualenv/issues/1963>`_)
  * For activation scripts always use UNIX line endings (unless it's BATCH shell related) - by :user:`saytosid`. (`#1818 <https://github.com/pypa/virtualenv/issues/1818>`_)
  * Avoid spawning new windows when doing seed package upgrades in the background on Windows - by :user:`gaborbernat`. (`#1928 <https://github.com/pypa/virtualenv/issues/1928>`_)
  * Fix a bug that reading and writing on the same file may cause race on multiple processes. (`#1938 <https://github.com/pypa/virtualenv/is
@pypa pypa locked and limited conversation to collaborators Jan 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants