davidmarble / virtualenvwrapper-win

Port of Doug Hellmann's virtualenvwrapper to Windows batch scripts

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Specify python version with py launcher using the mkproject command

Ricyteach opened this issue · comments

First off: sorry to have submitted this as an issue before I had fully investigated, and editing it several times.

I have installed both 3.9 and 3.10 on Windows with virtualenvwrapper-win (which I love using).

When I try to do mkproject using python 3.10, my expectation is for the -p3.10 flag to send the python request to py launcher. But instead, we get some error messages, and the project creation succeeds using the wrong python (3.9).

C:\Users\Rick Teachey>mkproject testagain -p3.10
Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases.
created virtual environment CPython3.9.6.final.0-64 in 1279ms
  creator CPython3Windows(dest=C:\Users\Rick Teachey\Envs\testagain, 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\Rick Teachey\AppData\Local\pypa\virtualenv)
    added seed packages: pip==21.2.4, setuptools==58.0.4, wheel==0.37.0
  activators BashActivator,BatchActivator,FishActivator,PowerShellActivator,PythonActivator

    "C:\Users\Rick Teachey\projects\testagain" is now the project directory for
    virtualenv "C:\Users\Rick Teachey\Envs\testagain"
Access is denied.

    "C:\Users\Rick Teachey\projects\testagain" added to
    C:\Users\Rick Teachey\Envs\testagain\Lib\site-packages\virtualenv_path_extensions.pth

(testagain) C:\Users\Rick Teachey\projects\testagain>python -V
Python 3.9.6

When doing the same thing using mkvirtualenv, everything works fine:

C:\Users\Rick Teachey\projects>mkvirtualenv -p3.10 test
Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases.
created virtual environment CPython3.10.0.final.0-64 in 1189ms
  creator CPython3Windows(dest=C:\Users\Rick Teachey\Envs\test, 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\Rick Teachey\AppData\Local\pypa\virtualenv)
    added seed packages: pip==21.2.2, setuptools==57.4.0, wheel==0.36.2
  activators BashActivator,BatchActivator,FishActivator,PowerShellActivator,PythonActivator

(test) C:\Users\Rick Teachey\projects>python -V
Python 3.10.0

Shouldn't we be able to do a mkproject -p3.10 my_project and have it send the python version request to py launcher? Is this an issue to be raised with virtualenvwrapper, or something specific to the windows version?

EDIT: this appears to just be how the mkproject command works:

C:\Users\Rick Teachey\projects>mkproject test --python "C:\Users\Rick Teachey\AppData\Local\Programs\Python\Python310\python.exe"
<SNIP>
(test) C:\Users\Rick Teachey\projects\test>python -V
Python 3.9.6

I'll take it up with virtualenvwrapper. Sorry to waste your time.

commented

mkproject should probably forward flags it doesn't handle to mkvirtualenv (which it calls). I think this is a bug.

mkproject should probably forward flags it doesn't handle to mkvirtualenv (which it calls). I think this is a bug.

I'm glad I found it; after I closed this yesterday, and reading up a little bit more on what mkproject is supposed to do, I started to think that it might actually be a bug. But to be honest I was kind of embarrassed about having opened it, changing the title 3 times, deleting a bunch of irrelevant follow-up comments, and closing it.

Anyway, I agree it seems like a bug. Thanks!