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

not work properly with pywin32 #2662

Open
leolcao opened this issue Nov 4, 2023 · 2 comments
Open

not work properly with pywin32 #2662

leolcao opened this issue Nov 4, 2023 · 2 comments
Assignees

Comments

@leolcao
Copy link

leolcao commented Nov 4, 2023

Issue

I find poetry, pipenv use the virtualenv as the low level tool to create virutal env, and when work with pywin32, the install command will copy pywintypes39.dll into wrong directory, which cause the windows service installed by pywin32 cannot run.

I actually create the bug in poetry place, python-poetry/poetry#8612 (that thread use python 3.12.0, this thread use 3.9.11)

Maybe it is not virtualenv's bug either, and I didn't find clue with existing reported issues from here.

So, for the virtualenv created .venv folder and files structure, why put python.exe into the .venv/Scripts/? does it follow some PEP? why there are pyenv paths in the sys.path from the create .venv ? I see the "copy" argument is true by default, so why not just copy all files from pyenv installed python version?

> .\.venv\Scripts\python.exe -m site
sys.path = [
    'D:\\LeoCao\\Projects\\llc\\techstack.git\\1.python\\0.project-mgmt\\pipenv-pipfile',
    'D:\\LeoCao\\Programs\\pyenv\\pyenv-win\\versions\\3.9.13\\python39.zip',
    'D:\\LeoCao\\Programs\\pyenv\\pyenv-win\\versions\\3.9.13\\DLLs',
    'D:\\LeoCao\\Programs\\pyenv\\pyenv-win\\versions\\3.9.13\\lib',
    'D:\\LeoCao\\Programs\\pyenv\\pyenv-win\\versions\\3.9.13',
    'D:\\LeoCao\\Projects\\llc\\techstack.git\\1.python\\0.project-mgmt\\pipenv-pipfile\\.venv',
    'D:\\LeoCao\\Projects\\llc\\techstack.git\\1.python\\0.project-mgmt\\pipenv-pipfile\\.venv\\lib\\site-packages',
]
USER_BASE: 'C:\\Users\\LeoCao\\AppData\\Roaming\\Python' (exists)
USER_SITE: 'C:\\Users\\LeoCao\\AppData\\Roaming\\Python\\Python39\\site-packages' (doesn't exist)
ENABLE_USER_SITE: False

I also use the virtualenv cli to create the .env, the result is same of poetry install.

virtualenv.exe .venv --python D:\LeoCao\Programs\pyenv\pyenv-win\versions\3.9.13\python.exe -vvv --with-traceback

Environment

windows 10 22H2
python for windows 3.10.11
pyenv-win 3.1.1
virtualenv 20.24.6

Output of the virtual environment creation

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

122 setup logging to NOTSET [DEBUG report:37]
131 find interpreter for spec PythonSpec(path=D:\LeoCao\Programs\pyenv\pyenv-win\versions\3.9.13\python.exe) [INFO builtin:58]
132 Attempting to acquire lock 1670568615760 on C:\Users\LeoCao\AppData\Local\pypa\virtualenv\py_info\1\22780f16572c44ca921ba0a001182edde6615db9a980ee7b4e9cee22794a0c7e.lock [DEBUG _api:254]
132 Lock 1670568615760 acquired on C:\Users\LeoCao\AppData\Local\pypa\virtualenv\py_info\1\22780f16572c44ca921ba0a001182edde6615db9a980ee7b4e9cee22794a0c7e.lock [DEBUG _api:257]
132 got python info of %s from (WindowsPath('D:/LeoCao/Programs/pyenv/pyenv-win/versions/3.9.13/python.exe'), WindowsPath('C:/Users/LeoCao/AppData/Local/pypa/virtualenv/py_info/1/22780f16572c44ca921ba0a001182edde6615db9a980ee7b4e9cee22794a0c7e.json')) [DEBUG via_disk_folder:131]
134 Attempting to release lock 1670568615760 on C:\Users\LeoCao\AppData\Local\pypa\virtualenv\py_info\1\22780f16572c44ca921ba0a001182edde6615db9a980ee7b4e9cee22794a0c7e.lock [DEBUG _api:286]
134 Lock 1670568615760 released on C:\Users\LeoCao\AppData\Local\pypa\virtualenv\py_info\1\22780f16572c44ca921ba0a001182edde6615db9a980ee7b4e9cee22794a0c7e.lock [DEBUG _api:289]
135 proposed PythonInfo(spec=CPython3.9.13.final.0-64, exe=D:\LeoCao\Programs\pyenv\pyenv-win\versions\3.9.13\python.exe, platform=win32, version='3.9.13 (tags/v3.9.13:6de2ca5, May 17 2022, 16:36:42) [MSC v.1929 64 bit (AMD64)]', encoding_fs_io=utf-8-utf-8) [INFO builtin:65]
135 accepted PythonInfo(spec=CPython3.9.13.final.0-64, exe=D:\LeoCao\Programs\pyenv\pyenv-win\versions\3.9.13\python.exe, platform=win32, version='3.9.13 (tags/v3.9.13:6de2ca5, May 17 2022, 16:36:42) [MSC v.1929 64 bit (AMD64)]', encoding_fs_io=utf-8-utf-8) [DEBUG builtin:67]
135 symlink on filesystem does not work [DEBUG info:45]
135 filesystem is not case-sensitive [DEBUG info:26]
192 create virtual environment via CPython3Windows(dest=D:\LeoCao\Projects\llc\techstack.git\1.python\0.project-mgmt\pipenv-pipfile\.venv, clear=False, no_vcs_ignore=False, global=False) [INFO session:50]
192 create folder D:\LeoCao\Projects\llc\techstack.git\1.python\0.project-mgmt\pipenv-pipfile\.venv\Lib\site-packages [DEBUG _sync:12]
192 create folder D:\LeoCao\Projects\llc\techstack.git\1.python\0.project-mgmt\pipenv-pipfile\.venv\Scripts [DEBUG _sync:12]
192 write D:\LeoCao\Projects\llc\techstack.git\1.python\0.project-mgmt\pipenv-pipfile\.venv\pyvenv.cfg [DEBUG pyenv_cfg:32]
192     home = D:\LeoCao\Programs\pyenv\pyenv-win\versions\3.9.13 [DEBUG pyenv_cfg:36]
192     implementation = CPython [DEBUG pyenv_cfg:36]
192     version_info = 3.9.13.final.0 [DEBUG pyenv_cfg:36]
192     virtualenv = 20.24.6 [DEBUG pyenv_cfg:36]
192     include-system-site-packages = false [DEBUG pyenv_cfg:36]
192     base-prefix = D:\LeoCao\Programs\pyenv\pyenv-win\versions\3.9.13 [DEBUG pyenv_cfg:36]
192     base-exec-prefix = D:\LeoCao\Programs\pyenv\pyenv-win\versions\3.9.13 [DEBUG pyenv_cfg:36]
195     base-executable = D:\LeoCao\Programs\pyenv\pyenv-win\versions\3.9.13\python.exe [DEBUG pyenv_cfg:36]
195 copy D:\LeoCao\Programs\pyenv\pyenv-win\versions\3.9.13\Lib\venv\scripts\nt\python.exe to D:\LeoCao\Projects\llc\techstack.git\1.python\0.project-mgmt\pipenv-pipfile\.venv\Scripts\python.exe [DEBUG _sync:40]
196 copy D:\LeoCao\Programs\pyenv\pyenv-win\versions\3.9.13\Lib\venv\scripts\nt\pythonw.exe to D:\LeoCao\Projects\llc\techstack.git\1.python\0.project-mgmt\pipenv-pipfile\.venv\Scripts\pythonw.exe [DEBUG _sync:40]
198 create virtualenv import hook file D:\LeoCao\Projects\llc\techstack.git\1.python\0.project-mgmt\pipenv-pipfile\.venv\Lib\site-packages\_virtualenv.pth [DEBUG api:91]
198 create D:\LeoCao\Projects\llc\techstack.git\1.python\0.project-mgmt\pipenv-pipfile\.venv\Lib\site-packages\_virtualenv.py [DEBUG api:94]
199 ============================== target debug ============================== [DEBUG session:52]
199 debug via 'D:\LeoCao\Projects\llc\techstack.git\1.python\0.project-mgmt\pipenv-pipfile\.venv\Scripts\python.exe' 'D:\LeoCao\.pipx\venvs\virtualenv\Lib\site-packages\virtualenv\create\debug.py' [DEBUG creator:200]
199 {
  "sys": {
    "executable": "D:\\LeoCao\\Projects\\llc\\techstack.git\\1.python\\0.project-mgmt\\pipenv-pipfile\\.venv\\Scripts\\python.exe",
    "_base_executable": "D:\\LeoCao\\Programs\\pyenv\\pyenv-win\\versions\\3.9.13\\python.exe",
    "prefix": "D:\\LeoCao\\Projects\\llc\\techstack.git\\1.python\\0.project-mgmt\\pipenv-pipfile\\.venv",
    "base_prefix": "D:\\LeoCao\\Programs\\pyenv\\pyenv-win\\versions\\3.9.13",
    "real_prefix": null,
    "exec_prefix": "D:\\LeoCao\\Projects\\llc\\techstack.git\\1.python\\0.project-mgmt\\pipenv-pipfile\\.venv",
    "base_exec_prefix": "D:\\LeoCao\\Programs\\pyenv\\pyenv-win\\versions\\3.9.13",
    "path": [
      "D:\\LeoCao\\Programs\\pyenv\\pyenv-win\\versions\\3.9.13\\python39.zip",
      "D:\\LeoCao\\Programs\\pyenv\\pyenv-win\\versions\\3.9.13\\DLLs",
      "D:\\LeoCao\\Programs\\pyenv\\pyenv-win\\versions\\3.9.13\\lib",
      "D:\\LeoCao\\Programs\\pyenv\\pyenv-win\\versions\\3.9.13",
      "D:\\LeoCao\\Projects\\llc\\techstack.git\\1.python\\0.project-mgmt\\pipenv-pipfile\\.venv",
      "D:\\LeoCao\\Projects\\llc\\techstack.git\\1.python\\0.project-mgmt\\pipenv-pipfile\\.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": "utf-8"
  },
  "version": "3.9.13 (tags/v3.9.13:6de2ca5, May 17 2022, 16:36:42) [MSC v.1929 64 bit (AMD64)]",
  "makefile_filename": "D:\\LeoCao\\Programs\\pyenv\\pyenv-win\\versions\\3.9.13\\Lib\\config\\Makefile",
  "os": "<module 'os' from 'D:\\\\LeoCao\\\\Programs\\\\pyenv\\\\pyenv-win\\\\versions\\\\3.9.13\\\\lib\\\\os.py'>",
  "site": "<module 'site' from 'D:\\\\LeoCao\\\\Programs\\\\pyenv\\\\pyenv-win\\\\versions\\\\3.9.13\\\\lib\\\\site.py'>",
  "datetime": "<module 'datetime' from 'D:\\\\LeoCao\\\\Programs\\\\pyenv\\\\pyenv-win\\\\versions\\\\3.9.13\\\\lib\\\\datetime.py'>",
  "math": "<module 'math' (built-in)>",
  "json": "<module 'json' from 'D:\\\\LeoCao\\\\Programs\\\\pyenv\\\\pyenv-win\\\\versions\\\\3.9.13\\\\lib\\\\json\\\\__init__.py'>"
} [DEBUG session:53]
412 add seed packages via FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=C:\Users\LeoCao\AppData\Local\pypa\virtualenv) [INFO session:57]
412 got embed update of distribution %s from ('wheel', WindowsPath('C:/Users/LeoCao/AppData/Local/pypa/virtualenv/wheel/3.9/embed/3/wheel.json')) [DEBUG via_disk_folder:131]
412 got embed update of distribution %s from ('pip', WindowsPath('C:/Users/LeoCao/AppData/Local/pypa/virtualenv/wheel/3.9/embed/3/pip.json')) [DEBUG via_disk_folder:131]
412 got embed update of distribution %s from ('setuptools', WindowsPath('C:/Users/LeoCao/AppData/Local/pypa/virtualenv/wheel/3.9/embed/3/setuptools.json')) [DEBUG via_disk_folder:131]
421 got embed update of distribution %s from ('wheel', WindowsPath('C:/Users/LeoCao/AppData/Local/pypa/virtualenv/wheel/3.9/embed/3/wheel.json')) [DEBUG via_disk_folder:131]
422 got embed update of distribution %s from ('pip', WindowsPath('C:/Users/LeoCao/AppData/Local/pypa/virtualenv/wheel/3.9/embed/3/pip.json')) [DEBUG via_disk_folder:131]
422 got embed update of distribution %s from ('setuptools', WindowsPath('C:/Users/LeoCao/AppData/Local/pypa/virtualenv/wheel/3.9/embed/3/setuptools.json')) [DEBUG via_disk_folder:131]
423 install wheel from wheel D:\LeoCao\.pipx\venvs\virtualenv\Lib\site-packages\virtualenv\seed\wheels\embed\wheel-0.41.2-py3-none-any.whl via CopyPipInstall [DEBUG via_app_data:49]
423 install pip from wheel D:\LeoCao\.pipx\venvs\virtualenv\Lib\site-packages\virtualenv\seed\wheels\embed\pip-23.3.1-py3-none-any.whl via CopyPipInstall [DEBUG via_app_data:49]
424 install setuptools from wheel D:\LeoCao\.pipx\venvs\virtualenv\Lib\site-packages\virtualenv\seed\wheels\embed\setuptools-68.2.2-py3-none-any.whl via CopyPipInstall [DEBUG via_app_data:49]
424 Attempting to acquire lock 1670574309328 on C:\Users\LeoCao\AppData\Local\pypa\virtualenv\wheel\3.9\image\1\CopyPipInstall\wheel-0.41.2-py3-none-any.lock [DEBUG _api:254]
424 Attempting to acquire lock 1670574307408 on C:\Users\LeoCao\AppData\Local\pypa\virtualenv\wheel\3.9\image\1\CopyPipInstall\setuptools-68.2.2-py3-none-any.lock [DEBUG _api:254]
424 Attempting to acquire lock 1670574308240 on C:\Users\LeoCao\AppData\Local\pypa\virtualenv\wheel\3.9\image\1\CopyPipInstall\pip-23.3.1-py3-none-any.lock [DEBUG _api:254]
425 Lock 1670574309328 acquired on C:\Users\LeoCao\AppData\Local\pypa\virtualenv\wheel\3.9\image\1\CopyPipInstall\wheel-0.41.2-py3-none-any.lock [DEBUG _api:257]
425 Attempting to release lock 1670574309328 on C:\Users\LeoCao\AppData\Local\pypa\virtualenv\wheel\3.9\image\1\CopyPipInstall\wheel-0.41.2-py3-none-any.lock [DEBUG _api:286]
426 Lock 1670574307408 acquired on C:\Users\LeoCao\AppData\Local\pypa\virtualenv\wheel\3.9\image\1\CopyPipInstall\setuptools-68.2.2-py3-none-any.lock [DEBUG _api:257]
426 Lock 1670574308240 acquired on C:\Users\LeoCao\AppData\Local\pypa\virtualenv\wheel\3.9\image\1\CopyPipInstall\pip-23.3.1-py3-none-any.lock [DEBUG _api:257]
426 Lock 1670574309328 released on C:\Users\LeoCao\AppData\Local\pypa\virtualenv\wheel\3.9\image\1\CopyPipInstall\wheel-0.41.2-py3-none-any.lock [DEBUG _api:289]
426 Attempting to release lock 1670574307408 on C:\Users\LeoCao\AppData\Local\pypa\virtualenv\wheel\3.9\image\1\CopyPipInstall\setuptools-68.2.2-py3-none-any.lock [DEBUG _api:286]
426 Attempting to release lock 1670574308240 on C:\Users\LeoCao\AppData\Local\pypa\virtualenv\wheel\3.9\image\1\CopyPipInstall\pip-23.3.1-py3-none-any.lock [DEBUG _api:286]
426 copy directory C:\Users\LeoCao\AppData\Local\pypa\virtualenv\wheel\3.9\image\1\CopyPipInstall\wheel-0.41.2-py3-none-any\wheel to D:\LeoCao\Projects\llc\techstack.git\1.python\0.project-mgmt\pipenv-pipfile\.venv\Lib\site-packages\wheel [DEBUG _sync:40]
426 Lock 1670574307408 released on C:\Users\LeoCao\AppData\Local\pypa\virtualenv\wheel\3.9\image\1\CopyPipInstall\setuptools-68.2.2-py3-none-any.lock [DEBUG _api:289]
426 Lock 1670574308240 released on C:\Users\LeoCao\AppData\Local\pypa\virtualenv\wheel\3.9\image\1\CopyPipInstall\pip-23.3.1-py3-none-any.lock [DEBUG _api:289]
426 copy C:\Users\LeoCao\AppData\Local\pypa\virtualenv\wheel\3.9\image\1\CopyPipInstall\setuptools-68.2.2-py3-none-any\distutils-precedence.pth to D:\LeoCao\Projects\llc\techstack.git\1.python\0.project-mgmt\pipenv-pipfile\.venv\Lib\site-packages\distutils-precedence.pth [DEBUG _sync:40]
430 copy directory C:\Users\LeoCao\AppData\Local\pypa\virtualenv\wheel\3.9\image\1\CopyPipInstall\pip-23.3.1-py3-none-any\pip to D:\LeoCao\Projects\llc\techstack.git\1.python\0.project-mgmt\pipenv-pipfile\.venv\Lib\site-packages\pip [DEBUG _sync:40]
431 copy directory C:\Users\LeoCao\AppData\Local\pypa\virtualenv\wheel\3.9\image\1\CopyPipInstall\setuptools-68.2.2-py3-none-any\pkg_resources to D:\LeoCao\Projects\llc\techstack.git\1.python\0.project-mgmt\pipenv-pipfile\.venv\Lib\site-packages\pkg_resources [DEBUG _sync:40]
469 copy directory C:\Users\LeoCao\AppData\Local\pypa\virtualenv\wheel\3.9\image\1\CopyPipInstall\wheel-0.41.2-py3-none-any\wheel-0.41.2.dist-info to D:\LeoCao\Projects\llc\techstack.git\1.python\0.project-mgmt\pipenv-pipfile\.venv\Lib\site-packages\wheel-0.41.2.dist-info [DEBUG _sync:40]
474 copy C:\Users\LeoCao\AppData\Local\pypa\virtualenv\wheel\3.9\image\1\CopyPipInstall\wheel-0.41.2-py3-none-any\wheel-0.41.2.virtualenv to D:\LeoCao\Projects\llc\techstack.git\1.python\0.project-mgmt\pipenv-pipfile\.venv\Lib\site-packages\wheel-0.41.2.virtualenv [DEBUG _sync:40]
474 generated console scripts wheel-3.9.exe wheel.exe wheel3.exe wheel3.9.exe [DEBUG base:43]
485 copy directory C:\Users\LeoCao\AppData\Local\pypa\virtualenv\wheel\3.9\image\1\CopyPipInstall\setuptools-68.2.2-py3-none-any\setuptools to D:\LeoCao\Projects\llc\techstack.git\1.python\0.project-mgmt\pipenv-pipfile\.venv\Lib\site-packages\setuptools [DEBUG _sync:40]
604 copy directory C:\Users\LeoCao\AppData\Local\pypa\virtualenv\wheel\3.9\image\1\CopyPipInstall\setuptools-68.2.2-py3-none-any\setuptools-68.2.2.dist-info to D:\LeoCao\Projects\llc\techstack.git\1.python\0.project-mgmt\pipenv-pipfile\.venv\Lib\site-packages\setuptools-68.2.2.dist-info [DEBUG _sync:40]
611 copy C:\Users\LeoCao\AppData\Local\pypa\virtualenv\wheel\3.9\image\1\CopyPipInstall\setuptools-68.2.2-py3-none-any\setuptools-68.2.2.virtualenv to D:\LeoCao\Projects\llc\techstack.git\1.python\0.project-mgmt\pipenv-pipfile\.venv\Lib\site-packages\setuptools-68.2.2.virtualenv [DEBUG _sync:40]
612 copy directory C:\Users\LeoCao\AppData\Local\pypa\virtualenv\wheel\3.9\image\1\CopyPipInstall\setuptools-68.2.2-py3-none-any\_distutils_hack to D:\LeoCao\Projects\llc\techstack.git\1.python\0.project-mgmt\pipenv-pipfile\.venv\Lib\site-packages\_distutils_hack [DEBUG _sync:40]
615 generated console scripts  [DEBUG base:43]
751 copy directory C:\Users\LeoCao\AppData\Local\pypa\virtualenv\wheel\3.9\image\1\CopyPipInstall\pip-23.3.1-py3-none-any\pip-23.3.1.dist-info to D:\LeoCao\Projects\llc\techstack.git\1.python\0.project-mgmt\pipenv-pipfile\.venv\Lib\site-packages\pip-23.3.1.dist-info [DEBUG _sync:40]
757 copy C:\Users\LeoCao\AppData\Local\pypa\virtualenv\wheel\3.9\image\1\CopyPipInstall\pip-23.3.1-py3-none-any\pip-23.3.1.virtualenv to D:\LeoCao\Projects\llc\techstack.git\1.python\0.project-mgmt\pipenv-pipfile\.venv\Lib\site-packages\pip-23.3.1.virtualenv [DEBUG _sync:40]
761 generated console scripts pip.exe pip3.exe pip-3.9.exe pip3.9.exe [DEBUG base:43]
761 add activators for Bash, Batch, Fish, Nushell, PowerShell, Python [INFO session:63]
768 write D:\LeoCao\Projects\llc\techstack.git\1.python\0.project-mgmt\pipenv-pipfile\.venv\pyvenv.cfg [DEBUG pyenv_cfg:32]
768     home = D:\LeoCao\Programs\pyenv\pyenv-win\versions\3.9.13 [DEBUG pyenv_cfg:36]
770     implementation = CPython [DEBUG pyenv_cfg:36]
770     version_info = 3.9.13.final.0 [DEBUG pyenv_cfg:36]
770     virtualenv = 20.24.6 [DEBUG pyenv_cfg:36]
770     include-system-site-packages = false [DEBUG pyenv_cfg:36]
770     base-prefix = D:\LeoCao\Programs\pyenv\pyenv-win\versions\3.9.13 [DEBUG pyenv_cfg:36]
770     base-exec-prefix = D:\LeoCao\Programs\pyenv\pyenv-win\versions\3.9.13 [DEBUG pyenv_cfg:36]
770     base-executable = D:\LeoCao\Programs\pyenv\pyenv-win\versions\3.9.13\python.exe [DEBUG pyenv_cfg:36]
771 created virtual environment CPython3.9.13.final.0-64 in 651ms
  creator CPython3Windows(dest=D:\LeoCao\Projects\llc\techstack.git\1.python\0.project-mgmt\pipenv-pipfile\.venv, clear=False, no_vcs_ignore=False, global=False)
  seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=C:\Users\LeoCao\AppData\Local\pypa\virtualenv)
    added seed packages: pip==23.3.1, setuptools==68.2.2, wheel==0.41.2
  activators BashActivator,BatchActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator [WARNING __main__:19]
@gaborbernat
Copy link
Contributor

PR welcome.

@leolcao
Copy link
Author

leolcao commented Nov 23, 2023

PR welcome.

I would like to do some help, but no such ability~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants