virtualenv icon indicating copy to clipboard operation
virtualenv copied to clipboard

The pip executable does not work when a virtualenv is created on a different drive under cygwin on windows without using --copies

Open talwrii opened this issue 3 years ago • 0 comments

Issue

pip does not run, returning an error about "Exec format error" on windows with cygwin when a virtualenv is created on a different device (in my case this was a google drive device).

Environment

Provide at least:

  • OS: Windows 10
  • pip list of the host python where virtualenv is installed:
$ python3 -m pip list
Package                           Version
--------------------------------- -------
backports.entry-points-selectable 1.1.0
distlib                           0.3.2
filelock                          3.0.12
pip                               21.2.4
platformdirs                      2.2.0
setuptools                        51.1.1
six                               1.16.0
virtualenv                        20.7.2
wheel                             0.37.0

Output of the virtual environment creation

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

$ python3 -m virtualenv  -vvv --with-traceback test
365 setup logging to NOTSET [DEBUG report:43]
388 find interpreter for spec PythonSpec(path=/usr/bin/python3) [INFO builtin:62]
388 proposed PythonInfo(spec=CPython3.8.10.final.0-64, exe=/usr/bin/python3, platform=cygwin, version='3.8.10 (default, May 20 2021, 11:41:59) \n[GCC 10.2.0]', encoding_fs_io=utf-8-utf-8) [INFO builtin:69]
388 accepted PythonInfo(spec=CPython3.8.10.final.0-64, exe=/usr/bin/python3, platform=cygwin, version='3.8.10 (default, May 20 2021, 11:41:59) \n[GCC 10.2.0]', encoding_fs_io=utf-8-utf-8) [DEBUG builtin:71]
392 filesystem is not case-sensitive [DEBUG info:28]
483 create virtual environment via CPython3Posix(dest=/cygdrive/g/My Drive/test, clear=False, no_vcs_ignore=False, global=False) [INFO session:52]
484 create folder /cygdrive/g/My Drive/test/bin [DEBUG _sync:25]
498 create folder /cygdrive/g/My Drive/test/lib/python3.8/site-packages [DEBUG _sync:25]
514 write /cygdrive/g/My Drive/test/pyvenv.cfg [DEBUG pyenv_cfg:34]
514     home = /usr [DEBUG pyenv_cfg:38]
514     implementation = CPython [DEBUG pyenv_cfg:38]
514     version_info = 3.8.10.final.0 [DEBUG pyenv_cfg:38]
514     virtualenv = 20.7.2 [DEBUG pyenv_cfg:38]
514     include-system-site-packages = false [DEBUG pyenv_cfg:38]
514     base-prefix = /usr [DEBUG pyenv_cfg:38]
514     base-exec-prefix = /usr [DEBUG pyenv_cfg:38]
515     base-executable = /usr/bin/python3 [DEBUG pyenv_cfg:38]
526 symlink /usr/bin/python3 to /cygdrive/g/My Drive/test/bin/python [DEBUG _sync:44]
569 create virtualenv import hook file /cygdrive/g/My Drive/test/lib/python3.8/site-packages/_virtualenv.pth [DEBUG api:95]
581 create /cygdrive/g/My Drive/test/lib/python3.8/site-packages/_virtualenv.py [DEBUG api:98]
674 ============================== target debug ============================== [DEBUG session:54]
674 debug via '/cygdrive/g/My Drive/test/bin/python' /usr/local/lib/python3.8/site-packages/virtualenv/create/debug.py [DEBUG creator:224]
674 {
  "out": "",
  "err": "Exec format error",
  "returncode": 8,
  "exception": "SyntaxError('unexpected EOF while parsing', ('<unknown>', 0, 0, ''))"
} [DEBUG session:55]
723 add seed packages via FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/home/alex/.local/share/virtualenv) [INFO session:59]
729 got embed update of distribution pip from /home/alex/.local/share/virtualenv/wheel/3.8/embed/1/pip.json [DEBUG via_disk_folder:135]
729 got embed update of distribution wheel from /home/alex/.local/share/virtualenv/wheel/3.8/embed/1/wheel.json [DEBUG via_disk_folder:135]
729 got embed update of distribution setuptools from /home/alex/.local/share/virtualenv/wheel/3.8/embed/1/setuptools.json [DEBUG via_disk_folder:135]
735 got embed update of distribution pip from /home/alex/.local/share/virtualenv/wheel/3.8/embed/1/pip.json [DEBUG via_disk_folder:135]
736 got embed update of distribution setuptools from /home/alex/.local/share/virtualenv/wheel/3.8/embed/1/setuptools.json [DEBUG via_disk_folder:135]
736 got embed update of distribution wheel from /home/alex/.local/share/virtualenv/wheel/3.8/embed/1/wheel.json [DEBUG via_disk_folder:135]
737 install pip from wheel /usr/local/lib/python3.8/site-packages/virtualenv/seed/wheels/embed/pip-21.2.3-py3-none-any.whl via CopyPipInstall [DEBUG via_app_data:49]
737 install setuptools from wheel /usr/local/lib/python3.8/site-packages/virtualenv/seed/wheels/embed/setuptools-57.4.0-py3-none-any.whl via CopyPipInstall [DEBUG via_app_data:49]
738 install wheel from wheel /usr/local/lib/python3.8/site-packages/virtualenv/seed/wheels/embed/wheel-0.37.0-py2.py3-none-any.whl via CopyPipInstall [DEBUG via_app_data:49]
739 Attempting to acquire lock 123145291819136 on /home/alex/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-21.2.3-py3-none-any.lock [DEBUG filelock:270]
739 Attempting to acquire lock 123145291819184 on /home/alex/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-57.4.0-py3-none-any.lock [DEBUG filelock:270]
739 Attempting to acquire lock 123145291819376 on /home/alex/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.37.0-py2.py3-none-any.lock [DEBUG filelock:270]
740 Lock 123145291819136 acquired on /home/alex/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-21.2.3-py3-none-any.lock [INFO filelock:274]
740 Lock 123145291819184 acquired on /home/alex/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-57.4.0-py3-none-any.lock [INFO filelock:274]
740 Lock 123145291819376 acquired on /home/alex/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.37.0-py2.py3-none-any.lock [INFO filelock:274]
740 Attempting to release lock 123145291819136 on /home/alex/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-21.2.3-py3-none-any.lock [DEBUG filelock:315]
740 Attempting to release lock 123145291819184 on /home/alex/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-57.4.0-py3-none-any.lock [DEBUG filelock:315]
741 Lock 123145291819136 released on /home/alex/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-21.2.3-py3-none-any.lock [INFO filelock:318]
741 Attempting to release lock 123145291819376 on /home/alex/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.37.0-py2.py3-none-any.lock [DEBUG filelock:315]
741 Lock 123145291819184 released on /home/alex/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-57.4.0-py3-none-any.lock [INFO filelock:318]
741 Lock 123145291819376 released on /home/alex/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.37.0-py2.py3-none-any.lock [INFO filelock:318]
746 copy directory /home/alex/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-21.2.3-py3-none-any/pip to /cygdrive/g/My Drive/test/lib/python3.8/site-packages/pip [DEBUG _sync:52]
746 copy /home/alex/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-57.4.0-py3-none-any/distutils-precedence.pth to /cygdrive/g/My Drive/test/lib/python3.8/site-packages/distutils-precedence.pth [DEBUG _sync:52]
746 copy directory /home/alex/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.37.0-py2.py3-none-any/wheel to /cygdrive/g/My Drive/test/lib/python3.8/site-packages/wheel [DEBUG _sync:52]
796 copy directory /home/alex/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-57.4.0-py3-none-any/pkg_resources to /cygdrive/g/My Drive/test/lib/python3.8/site-packages/pkg_resources [DEBUG _sync:52]
2194 copy directory /home/alex/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.37.0-py2.py3-none-any/wheel-0.37.0.dist-info to /cygdrive/g/My Drive/test/lib/python3.8/site-packages/wheel-0.37.0.dist-info [DEBUG _sync:52]
2422 copy directory /home/alex/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-57.4.0-py3-none-any/setuptools to /cygdrive/g/My Drive/test/lib/python3.8/site-packages/setuptools [DEBUG _sync:52]
2924 copy /home/alex/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.37.0-py2.py3-none-any/wheel-0.37.0.virtualenv to /cygdrive/g/My Drive/test/lib/python3.8/site-packages/wheel-0.37.0.virtualenv [DEBUG _sync:52]
3149 generated console scripts wheel wheel-3.8 wheel3.8 wheel3 [DEBUG base:48]
9338 copy directory /home/alex/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-57.4.0-py3-none-any/setuptools-57.4.0.dist-info to /cygdrive/g/My Drive/test/lib/python3.8/site-packages/setuptools-57.4.0.dist-info [DEBUG _sync:52]
9878 copy /home/alex/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-57.4.0-py3-none-any/setuptools-57.4.0.virtualenv to /cygdrive/g/My Drive/test/lib/python3.8/site-packages/setuptools-57.4.0.virtualenv [DEBUG _sync:52]
9927 copy directory /home/alex/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-57.4.0-py3-none-any/_distutils_hack to /cygdrive/g/My Drive/test/lib/python3.8/site-packages/_distutils_hack [DEBUG _sync:52]
10044 generated console scripts  [DEBUG base:48]
18626 copy directory /home/alex/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-21.2.3-py3-none-any/pip-21.2.3.dist-info to /cygdrive/g/My Drive/test/lib/python3.8/site-packages/pip-21.2.3.dist-info [DEBUG _sync:52]
18754 copy /home/alex/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-21.2.3-py3-none-any/pip-21.2.3.virtualenv to /cygdrive/g/My Drive/test/lib/python3.8/site-packages/pip-21.2.3.virtualenv [DEBUG _sync:52]
18826 generated console scripts pip3.8 pip pip-3.8 pip3 [DEBUG base:48]
18826 add activators for Bash, CShell, Fish, PowerShell, Python [INFO session:64]
18887 write /cygdrive/g/My Drive/test/pyvenv.cfg [DEBUG pyenv_cfg:34]
18887   home = /usr [DEBUG pyenv_cfg:38]
18887   implementation = CPython [DEBUG pyenv_cfg:38]
18887   version_info = 3.8.10.final.0 [DEBUG pyenv_cfg:38]
18887   virtualenv = 20.7.2 [DEBUG pyenv_cfg:38]
18887   include-system-site-packages = false [DEBUG pyenv_cfg:38]
18887   base-prefix = /usr [DEBUG pyenv_cfg:38]
18887   base-exec-prefix = /usr [DEBUG pyenv_cfg:38]
18887   base-executable = /usr/bin/python3 [DEBUG pyenv_cfg:38]
18897 created virtual environment CPython3.8.10.final.0-64 in 18536ms
  creator CPython3Posix(dest=/cygdrive/g/My Drive/test, clear=False, no_vcs_ignore=False, global=False)
  seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/home/alex/.local/share/virtualenv)
    added seed packages: pip==21.2.3, setuptools==57.4.0, wheel==0.37.0
  activators BashActivator,CShellActivator,FishActivator,PowerShellActivator,PythonActivator [WARNING __main__:19]

Error:

alex@LAPTOP-4VHJ624P /cygdrive/g/My Drive
$ test/bin/pip install top
test/bin/pip: line 2: /cygdrive/g/My Drive/test/bin/python: cannot execute binary file: Exec format error
test/bin/pip: line 2: exec: /cygdrive/g/My Drive/test/bin/python: cannot execute: Permission denied

This error does not occur when I run this under c drive.

This error does not occur if I use --copies - this is a work around.

talwrii avatar Aug 28 '21 21:08 talwrii