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

Activate script doesn't work in cygwin #1874

Closed
zakhark opened this issue Jun 24, 2020 · 3 comments
Closed

Activate script doesn't work in cygwin #1874

zakhark opened this issue Jun 24, 2020 · 3 comments

Comments

@zakhark
Copy link

zakhark commented Jun 24, 2020

Issue

Activate script doesn't work properly on Windows under cygwin

Administrator@EC2AMAZ-O1FN3D7 ~
$ source v20.0.15/Scripts/activate
-bash: $'\r': command not found
-bash: $'\r': command not found
-bash: v20.0.15/Scripts/activate: line 10: syntax error near unexpected token `$'{\r''
'bash: v20.0.15/Scripts/activate: line 10: `deactivate () {

Looking at the file, it says ASCII text, with CRLF line terminators and vim says it's fileformat=dos
I see it starting in 20.0.0
If I pip install 16.7.10 on the same box it works ok and shows activate being ASCII text

If I run dos2unix against the activate file created by version 20.0.0+ it fixes it.

Environment

Provide at least:

  • OS: Windows Server 2016 R2 64-bit
  • pip list of the host python where virtualenv is installed:
$ pip list
Package             Version
------------------- -------
appdirs             1.4.4
distlib             0.3.0
filelock            3.0.12
importlib-metadata  1.6.1
importlib-resources 1.5.0
pip                 20.1.1
setuptools          47.3.1
six                 1.15.0
virtualenv          20.0.15
wheel               0.34.2
zipp                3.1.0

Output of the virtual environment creation

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

$ python -m virtualenv '--python=C:\python\Python36\python.exe' v20.0.15 -vvv --with-traceback
109 setup logging to NOTSET [DEBUG report:43]
125 find interpreter for spec PythonSpec(path=C:\python\Python36\python.exe) [INFO builtin:44]
125 Attempting to acquire lock 2052070016840 on C:\Users\Administrator\AppData\Local\pypa\virtualenv\py_info\20.0.15\e9a5c692229444628246990c80852bb42e5af3e1360d75b586c9caa1cffe2051.lock [DEBUG filelock:270]
125 Lock 2052070016840 acquired on C:\Users\Administrator\AppData\Local\pypa\virtualenv\py_info\20.0.15\e9a5c692229444628246990c80852bb42e5af3e1360d75b586c9caa1cffe2051.lock [INFO filelock:274]
125 get interpreter info via cmd: 'C:\python\Python36\python.exe' 'C:\home\Administrator\.virtualenvs\lib\site-packages\virtualenv\discovery\py_info.py' [DEBUG cached_py_info:108]
234 write PythonInfo to C:\Users\Administrator\AppData\Local\pypa\virtualenv\py_info\20.0.15\e9a5c692229444628246990c80852bb42e5af3e1360d75b586c9caa1cffe2051.json for C:\python\Python36\python.exe [DEBUG cached_py_info:94]
234 Attempting to release lock 2052070016840 on C:\Users\Administrator\AppData\Local\pypa\virtualenv\py_info\20.0.15\e9a5c692229444628246990c80852bb42e5af3e1360d75b586c9caa1cffe2051.lock [DEBUG filelock:315]
234 Lock 2052070016840 released on C:\Users\Administrator\AppData\Local\pypa\virtualenv\py_info\20.0.15\e9a5c692229444628246990c80852bb42e5af3e1360d75b586c9caa1cffe2051.lock [INFO filelock:318]
234 proposed PythonInfo(spec=CPython3.6.8.final.0-64, exe=C:\python\Python36\python.exe, platform=win32, version='3.6.8 (tags/v3.6.8:3c6b436a57, Dec 24 2018, 00:16:47) [MSC v.1916 64 bit (AMD64)]', encoding_fs_io=utf-8-cp1252) [INFO builtin:50]
234 accepted PythonInfo(spec=CPython3.6.8.final.0-64, exe=C:\python\Python36\python.exe, platform=win32, version='3.6.8 (tags/v3.6.8:3c6b436a57, Dec 24 2018, 00:16:47) [MSC v.1916 64 bit (AMD64)]', encoding_fs_io=utf-8-cp1252) [DEBUG builtin:52]
249 symlink on filesystem does work [DEBUG info:47]
249 filesystem is not case-sensitive [DEBUG info:28]
328 create virtual environment via CPython3Windows(dest=C:\cygwin\home\Administrator\v20.0.15, clear=False, global=False) [INFO session:52]
328 create folder C:\cygwin\home\Administrator\v20.0.15\Lib\site-packages [DEBUG _sync:21]
343 create folder C:\cygwin\home\Administrator\v20.0.15\Scripts [DEBUG _sync:21]
343 write C:\cygwin\home\Administrator\v20.0.15\pyvenv.cfg [DEBUG pyenv_cfg:34]
343 	home = C:\python\Python36 [DEBUG pyenv_cfg:38]
343 	implementation = CPython [DEBUG pyenv_cfg:38]
343 	version_info = 3.6.8.final.0 [DEBUG pyenv_cfg:38]
343 	virtualenv = 20.0.15 [DEBUG pyenv_cfg:38]
343 	include-system-site-packages = false [DEBUG pyenv_cfg:38]
343 	base-prefix = C:\python\Python36 [DEBUG pyenv_cfg:38]
343 	base-exec-prefix = C:\python\Python36 [DEBUG pyenv_cfg:38]
343 	base-executable = C:\python\Python36\python.exe [DEBUG pyenv_cfg:38]
343 symlink C:\python\Python36\python.exe to C:\cygwin\home\Administrator\v20.0.15\Scripts\python.exe [DEBUG _sync:40]
343 symlink C:\python\Python36\pythonw.exe to C:\cygwin\home\Administrator\v20.0.15\Scripts\pythonw.exe [DEBUG _sync:40]
343 symlink C:\python\Python36\python3.dll to C:\cygwin\home\Administrator\v20.0.15\Scripts\python3.dll [DEBUG _sync:40]
343 symlink C:\python\Python36\python36.dll to C:\cygwin\home\Administrator\v20.0.15\Scripts\python36.dll [DEBUG _sync:40]
343 symlink C:\python\Python36\vcruntime140.dll to C:\cygwin\home\Administrator\v20.0.15\Scripts\vcruntime140.dll [DEBUG _sync:40]
343 symlink C:\python\Python36\DLLs\pyexpat.pyd to C:\cygwin\home\Administrator\v20.0.15\Scripts\pyexpat.pyd [DEBUG _sync:40]
343 symlink C:\python\Python36\DLLs\select.pyd to C:\cygwin\home\Administrator\v20.0.15\Scripts\select.pyd [DEBUG _sync:40]
343 symlink C:\python\Python36\DLLs\sqlite3.dll to C:\cygwin\home\Administrator\v20.0.15\Scripts\sqlite3.dll [DEBUG _sync:40]
343 symlink C:\python\Python36\DLLs\tcl86t.dll to C:\cygwin\home\Administrator\v20.0.15\Scripts\tcl86t.dll [DEBUG _sync:40]
343 symlink C:\python\Python36\DLLs\tk86t.dll to C:\cygwin\home\Administrator\v20.0.15\Scripts\tk86t.dll [DEBUG _sync:40]
343 symlink C:\python\Python36\DLLs\unicodedata.pyd to C:\cygwin\home\Administrator\v20.0.15\Scripts\unicodedata.pyd [DEBUG _sync:40]
343 symlink C:\python\Python36\DLLs\winsound.pyd to C:\cygwin\home\Administrator\v20.0.15\Scripts\winsound.pyd [DEBUG _sync:40]
343 symlink C:\python\Python36\DLLs\_asyncio.pyd to C:\cygwin\home\Administrator\v20.0.15\Scripts\_asyncio.pyd [DEBUG _sync:40]
343 symlink C:\python\Python36\DLLs\_bz2.pyd to C:\cygwin\home\Administrator\v20.0.15\Scripts\_bz2.pyd [DEBUG _sync:40]
343 symlink C:\python\Python36\DLLs\_ctypes.pyd to C:\cygwin\home\Administrator\v20.0.15\Scripts\_ctypes.pyd [DEBUG _sync:40]
343 symlink C:\python\Python36\DLLs\_ctypes_test.pyd to C:\cygwin\home\Administrator\v20.0.15\Scripts\_ctypes_test.pyd [DEBUG _sync:40]
343 symlink C:\python\Python36\DLLs\_decimal.pyd to C:\cygwin\home\Administrator\v20.0.15\Scripts\_decimal.pyd [DEBUG _sync:40]
343 symlink C:\python\Python36\DLLs\_distutils_findvs.pyd to C:\cygwin\home\Administrator\v20.0.15\Scripts\_distutils_findvs.pyd [DEBUG _sync:40]
343 symlink C:\python\Python36\DLLs\_elementtree.pyd to C:\cygwin\home\Administrator\v20.0.15\Scripts\_elementtree.pyd [DEBUG _sync:40]
343 symlink C:\python\Python36\DLLs\_hashlib.pyd to C:\cygwin\home\Administrator\v20.0.15\Scripts\_hashlib.pyd [DEBUG _sync:40]
343 symlink C:\python\Python36\DLLs\_lzma.pyd to C:\cygwin\home\Administrator\v20.0.15\Scripts\_lzma.pyd [DEBUG _sync:40]
343 symlink C:\python\Python36\DLLs\_msi.pyd to C:\cygwin\home\Administrator\v20.0.15\Scripts\_msi.pyd [DEBUG _sync:40]
343 symlink C:\python\Python36\DLLs\_multiprocessing.pyd to C:\cygwin\home\Administrator\v20.0.15\Scripts\_multiprocessing.pyd [DEBUG _sync:40]
343 symlink C:\python\Python36\DLLs\_overlapped.pyd to C:\cygwin\home\Administrator\v20.0.15\Scripts\_overlapped.pyd [DEBUG _sync:40]
343 symlink C:\python\Python36\DLLs\_socket.pyd to C:\cygwin\home\Administrator\v20.0.15\Scripts\_socket.pyd [DEBUG _sync:40]
359 symlink C:\python\Python36\DLLs\_sqlite3.pyd to C:\cygwin\home\Administrator\v20.0.15\Scripts\_sqlite3.pyd [DEBUG _sync:40]
359 symlink C:\python\Python36\DLLs\_ssl.pyd to C:\cygwin\home\Administrator\v20.0.15\Scripts\_ssl.pyd [DEBUG _sync:40]
359 symlink C:\python\Python36\DLLs\_testbuffer.pyd to C:\cygwin\home\Administrator\v20.0.15\Scripts\_testbuffer.pyd [DEBUG _sync:40]
359 symlink C:\python\Python36\DLLs\_testcapi.pyd to C:\cygwin\home\Administrator\v20.0.15\Scripts\_testcapi.pyd [DEBUG _sync:40]
359 symlink C:\python\Python36\DLLs\_testconsole.pyd to C:\cygwin\home\Administrator\v20.0.15\Scripts\_testconsole.pyd [DEBUG _sync:40]
359 symlink C:\python\Python36\DLLs\_testimportmultiple.pyd to C:\cygwin\home\Administrator\v20.0.15\Scripts\_testimportmultiple.pyd [DEBUG _sync:40]
359 symlink C:\python\Python36\DLLs\_testmultiphase.pyd to C:\cygwin\home\Administrator\v20.0.15\Scripts\_testmultiphase.pyd [DEBUG _sync:40]
359 symlink C:\python\Python36\DLLs\_tkinter.pyd to C:\cygwin\home\Administrator\v20.0.15\Scripts\_tkinter.pyd [DEBUG _sync:40]
359 create virtualenv import hook file C:\cygwin\home\Administrator\v20.0.15\Lib\site-packages\_virtualenv.pth [DEBUG api:76]
359 create C:\cygwin\home\Administrator\v20.0.15\Lib\site-packages\_virtualenv.py [DEBUG api:79]
359 ============================== target debug ============================== [DEBUG session:54]
359 debug via 'C:\cygwin\home\Administrator\v20.0.15\Scripts\python.exe' 'C:\home\Administrator\.virtualenvs\lib\site-packages\virtualenv\create\debug.py' [DEBUG creator:187]
359 {
  "sys": {
    "executable": "C:\\cygwin\\home\\Administrator\\v20.0.15\\Scripts\\python.exe",
    "_base_executable": null,
    "prefix": "C:\\cygwin\\home\\Administrator\\v20.0.15",
    "base_prefix": "C:\\python\\Python36",
    "real_prefix": null,
    "exec_prefix": "C:\\cygwin\\home\\Administrator\\v20.0.15",
    "base_exec_prefix": "C:\\python\\Python36",
    "path": [
      "C:\\cygwin\\home\\Administrator\\v20.0.15\\Scripts\\python36.zip",
      "C:\\python\\Python36\\DLLs",
      "C:\\python\\Python36\\lib",
      "C:\\python\\Python36",
      "C:\\cygwin\\home\\Administrator\\v20.0.15",
      "C:\\cygwin\\home\\Administrator\\v20.0.15\\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.6.8 (tags/v3.6.8:3c6b436a57, Dec 24 2018, 00:16:47) [MSC v.1916 64 bit (AMD64)]",
  "os": "<module 'os' from 'C:\\\\python\\\\Python36\\\\lib\\\\os.py'>",
  "site": "<module 'site' from 'C:\\\\python\\\\Python36\\\\lib\\\\site.py'>",
  "datetime": "<module 'datetime' from 'C:\\\\python\\\\Python36\\\\lib\\\\datetime.py'>",
  "math": "<module 'math' (built-in)>",
  "json": "<module 'json' from 'C:\\\\python\\\\Python36\\\\lib\\\\json\\\\__init__.py'>"
} [DEBUG session:55]
437 add seed packages via FromAppData(download=False, pip=latest, setuptools=latest, wheel=latest, via=copy, app_data_dir=C:\Users\Administrator\AppData\Local\pypa\virtualenv\seed-app-data\v1.0.1) [INFO session:59]
437 Attempting to acquire lock 2052077819104 on C:\Users\Administrator\AppData\Local\pypa\virtualenv\seed-app-data\v1.0.1\3.6\wheels.lock [DEBUG filelock:270]
437 Lock 2052077819104 acquired on C:\Users\Administrator\AppData\Local\pypa\virtualenv\seed-app-data\v1.0.1\3.6\wheels.lock [INFO filelock:274]
437 get bundled wheel C:\home\Administrator\.virtualenvs\lib\site-packages\virtualenv\seed\embed\wheels\pip-20.0.2-py2.py3-none-any.whl [DEBUG acquire:51]
453 get bundled wheel C:\home\Administrator\.virtualenvs\lib\site-packages\virtualenv\seed\embed\wheels\setuptools-46.1.3-py3-none-any.whl [DEBUG acquire:51]
453 get bundled wheel C:\home\Administrator\.virtualenvs\lib\site-packages\virtualenv\seed\embed\wheels\wheel-0.34.2-py2.py3-none-any.whl [DEBUG acquire:51]
453 install setuptools from wheel C:\Users\Administrator\AppData\Local\pypa\virtualenv\seed-app-data\v1.0.1\3.6\wheels\setuptools-46.1.3-py3-none-any.whl via CopyPipInstall [DEBUG via_app_data:46]
453 build install image to C:\Users\Administrator\AppData\Local\pypa\virtualenv\seed-app-data\v1.0.1\3.6\image\CopyPipInstall\setuptools-46.1.3-py3-none-any of setuptools-46.1.3-py3-none-any.whl [DEBUG base:57]
453 install wheel from wheel C:\Users\Administrator\AppData\Local\pypa\virtualenv\seed-app-data\v1.0.1\3.6\wheels\wheel-0.34.2-py2.py3-none-any.whl via CopyPipInstall [DEBUG via_app_data:46]
453 install pip from wheel C:\Users\Administrator\AppData\Local\pypa\virtualenv\seed-app-data\v1.0.1\3.6\wheels\pip-20.0.2-py2.py3-none-any.whl via CopyPipInstall [DEBUG via_app_data:46]
453 build install image to C:\Users\Administrator\AppData\Local\pypa\virtualenv\seed-app-data\v1.0.1\3.6\image\CopyPipInstall\pip-20.0.2-py2.py3-none-any of pip-20.0.2-py2.py3-none-any.whl [DEBUG base:57]
453 build install image to C:\Users\Administrator\AppData\Local\pypa\virtualenv\seed-app-data\v1.0.1\3.6\image\CopyPipInstall\wheel-0.34.2-py2.py3-none-any of wheel-0.34.2-py2.py3-none-any.whl [DEBUG base:57]
515 copy directory C:\Users\Administrator\AppData\Local\pypa\virtualenv\seed-app-data\v1.0.1\3.6\image\CopyPipInstall\wheel-0.34.2-py2.py3-none-any\wheel to C:\cygwin\home\Administrator\v20.0.15\Lib\site-packages\wheel [DEBUG _sync:48]
593 copy directory C:\Users\Administrator\AppData\Local\pypa\virtualenv\seed-app-data\v1.0.1\3.6\image\CopyPipInstall\wheel-0.34.2-py2.py3-none-any\wheel-0.34.2.dist-info to C:\cygwin\home\Administrator\v20.0.15\Lib\site-packages\wheel-0.34.2.dist-info [DEBUG _sync:48]
640 copy C:\Users\Administrator\AppData\Local\pypa\virtualenv\seed-app-data\v1.0.1\3.6\image\CopyPipInstall\setuptools-46.1.3-py3-none-any\easy_install.py to C:\cygwin\home\Administrator\v20.0.15\Lib\site-packages\easy_install.py [DEBUG _sync:48]
640 copy C:\Users\Administrator\AppData\Local\pypa\virtualenv\seed-app-data\v1.0.1\3.6\image\CopyPipInstall\wheel-0.34.2-py2.py3-none-any\wheel-0.34.2.virtualenv to C:\cygwin\home\Administrator\v20.0.15\Lib\site-packages\wheel-0.34.2.virtualenv [DEBUG _sync:48]
640 copy directory C:\Users\Administrator\AppData\Local\pypa\virtualenv\seed-app-data\v1.0.1\3.6\image\CopyPipInstall\setuptools-46.1.3-py3-none-any\pkg_resources to C:\cygwin\home\Administrator\v20.0.15\Lib\site-packages\pkg_resources [DEBUG _sync:48]
656 generated console scripts wheel3.exe wheel.exe wheel-3.6.exe [DEBUG base:53]
765 copy directory C:\Users\Administrator\AppData\Local\pypa\virtualenv\seed-app-data\v1.0.1\3.6\image\CopyPipInstall\setuptools-46.1.3-py3-none-any\setuptools to C:\cygwin\home\Administrator\v20.0.15\Lib\site-packages\setuptools [DEBUG _sync:48]
1296 copy directory C:\Users\Administrator\AppData\Local\pypa\virtualenv\seed-app-data\v1.0.1\3.6\image\CopyPipInstall\pip-20.0.2-py2.py3-none-any\pip to C:\cygwin\home\Administrator\v20.0.15\Lib\site-packages\pip [DEBUG _sync:48]
1359 copy directory C:\Users\Administrator\AppData\Local\pypa\virtualenv\seed-app-data\v1.0.1\3.6\image\CopyPipInstall\setuptools-46.1.3-py3-none-any\setuptools-46.1.3.dist-info to C:\cygwin\home\Administrator\v20.0.15\Lib\site-packages\setuptools-46.1.3.dist-info [DEBUG _sync:48]
1406 copy C:\Users\Administrator\AppData\Local\pypa\virtualenv\seed-app-data\v1.0.1\3.6\image\CopyPipInstall\setuptools-46.1.3-py3-none-any\setuptools-46.1.3.virtualenv to C:\cygwin\home\Administrator\v20.0.15\Lib\site-packages\setuptools-46.1.3.virtualenv [DEBUG _sync:48]
1406 generated console scripts easy_install-3.6.exe easy_install.exe easy_install3.exe [DEBUG base:53]
3609 copy directory C:\Users\Administrator\AppData\Local\pypa\virtualenv\seed-app-data\v1.0.1\3.6\image\CopyPipInstall\pip-20.0.2-py2.py3-none-any\pip-20.0.2.dist-info to C:\cygwin\home\Administrator\v20.0.15\Lib\site-packages\pip-20.0.2.dist-info [DEBUG _sync:48]
3624 copy C:\Users\Administrator\AppData\Local\pypa\virtualenv\seed-app-data\v1.0.1\3.6\image\CopyPipInstall\pip-20.0.2-py2.py3-none-any\pip-20.0.2.virtualenv to C:\cygwin\home\Administrator\v20.0.15\Lib\site-packages\pip-20.0.2.virtualenv [DEBUG _sync:48]
3624 generated console scripts pip.exe pip3.6.exe pip3.exe pip-3.6.exe [DEBUG base:53]
3624 Attempting to release lock 2052077819104 on C:\Users\Administrator\AppData\Local\pypa\virtualenv\seed-app-data\v1.0.1\3.6\wheels.lock [DEBUG filelock:315]
3624 Lock 2052077819104 released on C:\Users\Administrator\AppData\Local\pypa\virtualenv\seed-app-data\v1.0.1\3.6\wheels.lock [INFO filelock:318]
3624 add activators for Bash, Batch, Fish, PowerShell, Python, Xonsh [INFO session:65]
3718 write C:\cygwin\home\Administrator\v20.0.15\pyvenv.cfg [DEBUG pyenv_cfg:34]
3718 	home = C:\python\Python36 [DEBUG pyenv_cfg:38]
3718 	implementation = CPython [DEBUG pyenv_cfg:38]
3718 	version_info = 3.6.8.final.0 [DEBUG pyenv_cfg:38]
3718 	virtualenv = 20.0.15 [DEBUG pyenv_cfg:38]
3718 	include-system-site-packages = false [DEBUG pyenv_cfg:38]
3718 	base-prefix = C:\python\Python36 [DEBUG pyenv_cfg:38]
3718 	base-exec-prefix = C:\python\Python36 [DEBUG pyenv_cfg:38]
3718 	base-executable = C:\python\Python36\python.exe [DEBUG pyenv_cfg:38]
3718 created virtual environment CPython3.6.8.final.0-64 in 3609ms
  creator CPython3Windows(dest=C:\cygwin\home\Administrator\v20.0.15, clear=False, global=False)
  seeder FromAppData(download=False, pip=latest, setuptools=latest, wheel=latest, via=copy, app_data_dir=C:\Users\Administrator\AppData\Local\pypa\virtualenv\seed-app-data\v1.0.1)
  activators BashActivator,BatchActivator,FishActivator,PowerShellActivator,PythonActivator,XonshActivator [WARNING __main__:21]

@saytosid
Copy link
Contributor

Looking at the file, it says ASCII text, with CRLF line terminators and vim says it's fileformat=dos
I see it starting in 20.0.0
If I pip install 16.7.10 on the same box it works ok and shows activate being ASCII text
If I run dos2unix against the activate file created by version 20.0.0+ it fixes it.

This seems to be because cygwin is expecting unix-line-endings. If a virtualenv is created on windows IMO it should have windows-line-endings and running it on cygwin should probably not be supported. 🤔

@gaborbernat
Copy link
Contributor

Duplicate of #1818

@gaborbernat gaborbernat marked this as a duplicate of #1818 Jul 31, 2020
@gaborbernat
Copy link
Contributor

@saytosid I think if we use Linux endings it works for all bash on Windows, so I'd be happy to see a PR that tackles this.

@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

No branches or pull requests

3 participants