Closed asottile closed 4 years ago
I am happy to work on this issue :) Haven't contributed in a long time 🙂
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.
Install virtualenv from the repository, and try to replicate it with that. If you can provide a reproducible with that I'll reopen.
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.
Issue
PATH
(and maybeVIRTUAL_ENV
?) seems to be set incorrectly on windows when using git bash, this worked with virtualenv 16.xEnvironment
Provide at least:
pip list
of the host python wherevirtualenv
is installed:Output of the virtual environment creation
Make sure to run the creation with
-vvv --with-traceback
:Here's the activation:
here's the oddness:
this seemed to break
pip install aiohttp
and thenpython -c import aiohttp
: