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

Non-ASCII characters in full path of virtual environment may cause activation failure. #2338

Open
huanganding opened this issue Apr 28, 2022 · 3 comments

Comments

@huanganding
Copy link

huanganding commented Apr 28, 2022

Issue

I created a Python virtual environment(PyVenv) by virtualenv , but after I activated it, the path of python&pip kept original.
When I typed in cmd:
where python
it showed:
C:\Users\[UserName]\AppData\Local\Programs\Python\Python310\python.exe
instead of:
[path of PyVenv]\Scripts\python.exe
and virtualenv didn't feedback when this situation happened.
I checked system variables PATH by set path and saw it had messy codes, so did the activate.bat in PyVenv, and the messy codes appeared in the string of path.
After converting the encoding of activate.bat from UTF-8 to ANSI, the problem seemed solved.

Environment

  • OS: Windows 10 x64
  • pip list of the host python where virtualenv is installed:
Package               Version
--------------------- -------
distlib               0.3.4
filelock              3.6.0
pip                   22.0.4
platformdirs          2.5.2
setuptools            58.1.0
six                   1.16.0
virtualenv            20.14.1
virtualenvwrapper-win 1.2.7

Output of the virtual environment creation

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

280 setup logging to NOTSET [DEBUG report:39]
294 find interpreter for spec PythonSpec(path=C:\Users\Huanganding\AppData\Local\Programs\Python\Python310\python.exe) [INFO builtin:62]
294 proposed PythonInfo(spec=CPython3.10.4.final.0-64, exe=C:\Users\Huanganding\AppData\Local\Programs\Python\Python310\python.exe, platform=win32, version='3.10.4 (tags/v3.10.4:9d38120, Mar 23 2022, 23:13:41) [MSC v.1929 64 bit (AMD64)]', encoding_fs_io=utf-8-gbk) [INFO builtin:69]
294 accepted PythonInfo(spec=CPython3.10.4.final.0-64, exe=C:\Users\Huanganding\AppData\Local\Programs\Python\Python310\python.exe, platform=win32, version='3.10.4 (tags/v3.10.4:9d38120, Mar 23 2022, 23:13:41) [MSC v.1929 64 bit (AMD64)]', encoding_fs_io=utf-8-gbk) [DEBUG builtin:71]
4377 symlink on filesystem does not work [DEBUG info:48]
4378 filesystem is not case-sensitive [DEBUG info:29]
4505 create virtual environment via CPython3Windows(dest=C:\Users\Huanganding\Desktop\pyenv, clear=False, no_vcs_ignore=False, global=False) [INFO session:52]
4506 create folder C:\Users\Huanganding\Desktop\pyenv\Lib\site-packages [DEBUG _sync:24]
4508 create folder C:\Users\Huanganding\Desktop\pyenv\Scripts [DEBUG _sync:24]
4509 write C:\Users\Huanganding\Desktop\pyenv\pyvenv.cfg [DEBUG pyenv_cfg:34]
4509 	home = C:\Users\Huanganding\AppData\Local\Programs\Python\Python310 [DEBUG pyenv_cfg:38]
4509 	implementation = CPython [DEBUG pyenv_cfg:38]
4509 	version_info = 3.10.4.final.0 [DEBUG pyenv_cfg:38]
4509 	virtualenv = 20.14.1 [DEBUG pyenv_cfg:38]
4509 	include-system-site-packages = false [DEBUG pyenv_cfg:38]
4509 	base-prefix = C:\Users\Huanganding\AppData\Local\Programs\Python\Python310 [DEBUG pyenv_cfg:38]
4509 	base-exec-prefix = C:\Users\Huanganding\AppData\Local\Programs\Python\Python310 [DEBUG pyenv_cfg:38]
4509 	base-executable = C:\Users\Huanganding\AppData\Local\Programs\Python\Python310\python.exe [DEBUG pyenv_cfg:38]
4510 copy C:\Users\Huanganding\AppData\Local\Programs\Python\Python310\Lib\venv\scripts\nt\python.exe to C:\Users\Huanganding\Desktop\pyenv\Scripts\python.exe [DEBUG _sync:51]
4515 copy C:\Users\Huanganding\AppData\Local\Programs\Python\Python310\Lib\venv\scripts\nt\pythonw.exe to C:\Users\Huanganding\Desktop\pyenv\Scripts\pythonw.exe [DEBUG _sync:51]
4519 create virtualenv import hook file C:\Users\Huanganding\Desktop\pyenv\Lib\site-packages\_virtualenv.pth [DEBUG api:95]
4520 create C:\Users\Huanganding\Desktop\pyenv\Lib\site-packages\_virtualenv.py [DEBUG api:98]
4521 ============================== target debug ============================== [DEBUG session:54]
4521 debug via 'C:\Users\Huanganding\Desktop\pyenv\Scripts\python.exe' 'C:\Users\Huanganding\AppData\Local\Programs\Python\Python310\lib\site-packages\virtualenv\create\debug.py' [DEBUG creator:224]
4521 {
  "sys": {
    "executable": "C:\\Users\\Huanganding\\Desktop\\pyenv\\Scripts\\python.exe",
    "_base_executable": "C:\\Users\\Huanganding\\AppData\\Local\\Programs\\Python\\Python310\\python.exe",
    "prefix": "C:\\Users\\Huanganding\\Desktop\\pyenv",
    "base_prefix": "C:\\Users\\Huanganding\\AppData\\Local\\Programs\\Python\\Python310",
    "real_prefix": null,
    "exec_prefix": "C:\\Users\\Huanganding\\Desktop\\pyenv",
    "base_exec_prefix": "C:\\Users\\Huanganding\\AppData\\Local\\Programs\\Python\\Python310",
    "path": [
      "C:\\Users\\Huanganding\\AppData\\Local\\Programs\\Python\\Python310\\python310.zip",
      "C:\\Users\\Huanganding\\AppData\\Local\\Programs\\Python\\Python310\\DLLs",
      "C:\\Users\\Huanganding\\AppData\\Local\\Programs\\Python\\Python310\\lib",
      "C:\\Users\\Huanganding\\AppData\\Local\\Programs\\Python\\Python310",
      "C:\\Users\\Huanganding\\Desktop\\pyenv",
      "C:\\Users\\Huanganding\\Desktop\\pyenv\\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": "gbk"
  },
  "version": "3.10.4 (tags/v3.10.4:9d38120, Mar 23 2022, 23:13:41) [MSC v.1929 64 bit (AMD64)]",
  "makefile_filename": "C:\\Users\\Huanganding\\AppData\\Local\\Programs\\Python\\Python310\\Lib\\config\\Makefile",
  "os": "<module 'os' from 'C:\\\\Users\\\\Huanganding\\\\AppData\\\\Local\\\\Programs\\\\Python\\\\Python310\\\\lib\\\\os.py'>",
  "site": "<module 'site' from 'C:\\\\Users\\\\Huanganding\\\\AppData\\\\Local\\\\Programs\\\\Python\\\\Python310\\\\lib\\\\site.py'>",
  "datetime": "<module 'datetime' from 'C:\\\\Users\\\\Huanganding\\\\AppData\\\\Local\\\\Programs\\\\Python\\\\Python310\\\\lib\\\\datetime.py'>",
  "math": "<module 'math' (built-in)>",
  "json": "<module 'json' from 'C:\\\\Users\\\\Huanganding\\\\AppData\\\\Local\\\\Programs\\\\Python\\\\Python310\\\\lib\\\\json\\\\__init__.py'>"
} [DEBUG session:55]
4794 add seed packages via FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=C:\Users\Huanganding\AppData\Local\pypa\virtualenv) [INFO session:59]
4804 got embed update of distribution setuptools from C:\Users\Huanganding\AppData\Local\pypa\virtualenv\wheel\3.10\embed\3\setuptools.json [DEBUG via_disk_folder:135]
4804 got embed update of distribution pip from C:\Users\Huanganding\AppData\Local\pypa\virtualenv\wheel\3.10\embed\3\pip.json [DEBUG via_disk_folder:135]
4804 got embed update of distribution wheel from C:\Users\Huanganding\AppData\Local\pypa\virtualenv\wheel\3.10\embed\3\wheel.json [DEBUG via_disk_folder:135]
4816 got embed update of distribution setuptools from C:\Users\Huanganding\AppData\Local\pypa\virtualenv\wheel\3.10\embed\3\setuptools.json [DEBUG via_disk_folder:135]
4816 got embed update of distribution pip from C:\Users\Huanganding\AppData\Local\pypa\virtualenv\wheel\3.10\embed\3\pip.json [DEBUG via_disk_folder:135]
4817 got embed update of distribution wheel from C:\Users\Huanganding\AppData\Local\pypa\virtualenv\wheel\3.10\embed\3\wheel.json [DEBUG via_disk_folder:135]
4817 install setuptools from wheel C:\Users\Huanganding\AppData\Local\Programs\Python\Python310\lib\site-packages\virtualenv\seed\wheels\embed\setuptools-62.1.0-py3-none-any.whl via CopyPipInstall [DEBUG via_app_data:49]
4818 install pip from wheel C:\Users\Huanganding\AppData\Local\Programs\Python\Python310\lib\site-packages\virtualenv\seed\wheels\embed\pip-22.0.4-py3-none-any.whl via CopyPipInstall [DEBUG via_app_data:49]
4818 install wheel from wheel C:\Users\Huanganding\AppData\Local\Programs\Python\Python310\lib\site-packages\virtualenv\seed\wheels\embed\wheel-0.37.1-py2.py3-none-any.whl via CopyPipInstall [DEBUG via_app_data:49]
4819 Attempting to acquire lock 2260548099696 on C:\Users\Huanganding\AppData\Local\pypa\virtualenv\wheel\3.10\image\1\CopyPipInstall\setuptools-62.1.0-py3-none-any.lock [DEBUG _api:169]
4820 Attempting to acquire lock 2260548099600 on C:\Users\Huanganding\AppData\Local\pypa\virtualenv\wheel\3.10\image\1\CopyPipInstall\wheel-0.37.1-py2.py3-none-any.lock [DEBUG _api:169]
4820 Attempting to acquire lock 2260548099984 on C:\Users\Huanganding\AppData\Local\pypa\virtualenv\wheel\3.10\image\1\CopyPipInstall\pip-22.0.4-py3-none-any.lock [DEBUG _api:169]
4821 Lock 2260548099696 acquired on C:\Users\Huanganding\AppData\Local\pypa\virtualenv\wheel\3.10\image\1\CopyPipInstall\setuptools-62.1.0-py3-none-any.lock [DEBUG _api:173]
4821 Lock 2260548099600 acquired on C:\Users\Huanganding\AppData\Local\pypa\virtualenv\wheel\3.10\image\1\CopyPipInstall\wheel-0.37.1-py2.py3-none-any.lock [DEBUG _api:173]
4821 Lock 2260548099984 acquired on C:\Users\Huanganding\AppData\Local\pypa\virtualenv\wheel\3.10\image\1\CopyPipInstall\pip-22.0.4-py3-none-any.lock [DEBUG _api:173]
4821 Attempting to release lock 2260548099696 on C:\Users\Huanganding\AppData\Local\pypa\virtualenv\wheel\3.10\image\1\CopyPipInstall\setuptools-62.1.0-py3-none-any.lock [DEBUG _api:203]
4822 Attempting to release lock 2260548099600 on C:\Users\Huanganding\AppData\Local\pypa\virtualenv\wheel\3.10\image\1\CopyPipInstall\wheel-0.37.1-py2.py3-none-any.lock [DEBUG _api:203]
4822 Attempting to release lock 2260548099984 on C:\Users\Huanganding\AppData\Local\pypa\virtualenv\wheel\3.10\image\1\CopyPipInstall\pip-22.0.4-py3-none-any.lock [DEBUG _api:203]
4823 Lock 2260548099696 released on C:\Users\Huanganding\AppData\Local\pypa\virtualenv\wheel\3.10\image\1\CopyPipInstall\setuptools-62.1.0-py3-none-any.lock [DEBUG _api:206]
4823 Lock 2260548099600 released on C:\Users\Huanganding\AppData\Local\pypa\virtualenv\wheel\3.10\image\1\CopyPipInstall\wheel-0.37.1-py2.py3-none-any.lock [DEBUG _api:206]
4823 Lock 2260548099984 released on C:\Users\Huanganding\AppData\Local\pypa\virtualenv\wheel\3.10\image\1\CopyPipInstall\pip-22.0.4-py3-none-any.lock [DEBUG _api:206]
4824 copy C:\Users\Huanganding\AppData\Local\pypa\virtualenv\wheel\3.10\image\1\CopyPipInstall\setuptools-62.1.0-py3-none-any\distutils-precedence.pth to C:\Users\Huanganding\Desktop\pyenv\Lib\site-packages\distutils-precedence.pth [DEBUG _sync:51]
4824 copy directory C:\Users\Huanganding\AppData\Local\pypa\virtualenv\wheel\3.10\image\1\CopyPipInstall\wheel-0.37.1-py2.py3-none-any\wheel to C:\Users\Huanganding\Desktop\pyenv\Lib\site-packages\wheel [DEBUG _sync:51]
4824 copy directory C:\Users\Huanganding\AppData\Local\pypa\virtualenv\wheel\3.10\image\1\CopyPipInstall\pip-22.0.4-py3-none-any\pip to C:\Users\Huanganding\Desktop\pyenv\Lib\site-packages\pip [DEBUG _sync:51]
4828 copy directory C:\Users\Huanganding\AppData\Local\pypa\virtualenv\wheel\3.10\image\1\CopyPipInstall\setuptools-62.1.0-py3-none-any\pkg_resources to C:\Users\Huanganding\Desktop\pyenv\Lib\site-packages\pkg_resources [DEBUG _sync:51]
4885 copy directory C:\Users\Huanganding\AppData\Local\pypa\virtualenv\wheel\3.10\image\1\CopyPipInstall\wheel-0.37.1-py2.py3-none-any\wheel-0.37.1.dist-info to C:\Users\Huanganding\Desktop\pyenv\Lib\site-packages\wheel-0.37.1.dist-info [DEBUG _sync:51]
4909 copy C:\Users\Huanganding\AppData\Local\pypa\virtualenv\wheel\3.10\image\1\CopyPipInstall\wheel-0.37.1-py2.py3-none-any\wheel-0.37.1.virtualenv to C:\Users\Huanganding\Desktop\pyenv\Lib\site-packages\wheel-0.37.1.virtualenv [DEBUG _sync:51]
4920 generated console scripts wheel.exe wheel3.exe wheel-3.10.exe wheel3.10.exe [DEBUG base:45]
4946 copy directory C:\Users\Huanganding\AppData\Local\pypa\virtualenv\wheel\3.10\image\1\CopyPipInstall\setuptools-62.1.0-py3-none-any\setuptools to C:\Users\Huanganding\Desktop\pyenv\Lib\site-packages\setuptools [DEBUG _sync:51]
5494 copy directory C:\Users\Huanganding\AppData\Local\pypa\virtualenv\wheel\3.10\image\1\CopyPipInstall\setuptools-62.1.0-py3-none-any\setuptools-62.1.0.dist-info to C:\Users\Huanganding\Desktop\pyenv\Lib\site-packages\setuptools-62.1.0.dist-info [DEBUG _sync:51]
5516 copy C:\Users\Huanganding\AppData\Local\pypa\virtualenv\wheel\3.10\image\1\CopyPipInstall\setuptools-62.1.0-py3-none-any\setuptools-62.1.0.virtualenv to C:\Users\Huanganding\Desktop\pyenv\Lib\site-packages\setuptools-62.1.0.virtualenv [DEBUG _sync:51]
5520 copy directory C:\Users\Huanganding\AppData\Local\pypa\virtualenv\wheel\3.10\image\1\CopyPipInstall\setuptools-62.1.0-py3-none-any\_distutils_hack to C:\Users\Huanganding\Desktop\pyenv\Lib\site-packages\_distutils_hack [DEBUG _sync:51]
5529 generated console scripts  [DEBUG base:45]
6522 copy directory C:\Users\Huanganding\AppData\Local\pypa\virtualenv\wheel\3.10\image\1\CopyPipInstall\pip-22.0.4-py3-none-any\pip-22.0.4.dist-info to C:\Users\Huanganding\Desktop\pyenv\Lib\site-packages\pip-22.0.4.dist-info [DEBUG _sync:51]
6543 copy C:\Users\Huanganding\AppData\Local\pypa\virtualenv\wheel\3.10\image\1\CopyPipInstall\pip-22.0.4-py3-none-any\pip-22.0.4.virtualenv to C:\Users\Huanganding\Desktop\pyenv\Lib\site-packages\pip-22.0.4.virtualenv [DEBUG _sync:51]
6552 generated console scripts pip-3.10.exe pip3.exe pip.exe pip3.10.exe [DEBUG base:45]
6553 add activators for Bash, Batch, Fish, Nushell, PowerShell, Python [INFO session:64]
6563 write C:\Users\Huanganding\Desktop\pyenv\pyvenv.cfg [DEBUG pyenv_cfg:34]
6563 	home = C:\Users\Huanganding\AppData\Local\Programs\Python\Python310 [DEBUG pyenv_cfg:38]
6563 	implementation = CPython [DEBUG pyenv_cfg:38]
6563 	version_info = 3.10.4.final.0 [DEBUG pyenv_cfg:38]
6563 	virtualenv = 20.14.1 [DEBUG pyenv_cfg:38]
6563 	include-system-site-packages = false [DEBUG pyenv_cfg:38]
6563 	base-prefix = C:\Users\Huanganding\AppData\Local\Programs\Python\Python310 [DEBUG pyenv_cfg:38]
6563 	base-exec-prefix = C:\Users\Huanganding\AppData\Local\Programs\Python\Python310 [DEBUG pyenv_cfg:38]
6563 	base-executable = C:\Users\Huanganding\AppData\Local\Programs\Python\Python310\python.exe [DEBUG pyenv_cfg:38]
6564 created virtual environment CPython3.10.4.final.0-64 in 6292ms
  creator CPython3Windows(dest=C:\Users\Huanganding\Desktop\pyenv, 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\Huanganding\AppData\Local\pypa\virtualenv)
    added seed packages: pip==22.0.4, setuptools==62.1.0, wheel==0.37.1
  activators BashActivator,BatchActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator [WARNING __main__:19]
@gaborbernat
Copy link
Contributor

Can you show the full output of -vvv as the template asked. Also how you installed the pyenv environment is important. We don't support pyenv-win AFAIK.

@huanganding
Copy link
Author

huanganding commented May 1, 2022

Can you show the full output of -vvv as the template asked. Also how you installed the pyenv environment is important. We don't support pyenv-win AFAIK.

The output was edited above. I installed the pyenv environments in Windows x64, with the installation path containing non-ascii characters.

@gaborbernat
Copy link
Contributor

A PR addressing the issue would be welcome.

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

3 participants
@gaborbernat @huanganding and others