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

python3.exe missing on windows when creating a virtualvenv #2774

Open
mortenb-buypass opened this issue Sep 30, 2024 · 2 comments
Open

python3.exe missing on windows when creating a virtualvenv #2774

mortenb-buypass opened this issue Sep 30, 2024 · 2 comments

Comments

@mortenb-buypass
Copy link

mortenb-buypass commented Sep 30, 2024

Issue

I mainly develop for linux on a windows so all my scripts start with #!/usr/bin/env python3

I created a precommit hack for git and it fails on the shebang python3 not found This is the first ever I've seen
the shebang being used on windows. So I discovered it was not there :-)

We have lots of legacy system with legacy python pointing to old version2 python, and -m venv creates a python3 softlink on linux

So it would be nice if they where the same.

I see I do not have a python3.exe under windows main python either, but how can we assure same file will run same binary

Environment

Provide at least:

  • OS: windows11
  • pip list of the host python where virtualenv is installed:
pip list
Package Version
------- -------
pip     24.2

Output of the virtual environment creation

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

python -m venv C:\dist\venvs\ranchercli
(trk-fullstack-test) PS C:\dist\trk-fullstack-test> C:\dist\venvs\ranchercli\Scripts\Activate.ps1
(ranchercli) PS C:\dist\trk-fullstack-test> where.exe python3
INFO: Could not find files for the given pattern(s).
(ranchercli) PS C:\dist\trk-fullstack-test> where.exe python 
C:\dist\venvs\ranchercli\Scripts\python.exe
C:\dist\python312\python.exe
(ranchercli) PS C:\dist\trk-fullstack-test> python --version
Python 3.12.6
(ranchercli) PS C:\dist\trk-fullstack-test> ls -l C:\dist\venvs\ranchercli\Scripts\


    Directory: C:\dist\venvs\ranchercli\Scripts


Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a----        30.09.2024     16:31           2052 activate
-a----        30.09.2024     16:31           1005 activate.bat
-a----        30.09.2024     16:31          26199 Activate.ps1
-a----        30.09.2024     16:31            393 deactivate.bat
-a----        30.09.2024     16:31         108402 pip.exe
-a----        30.09.2024     16:31         108402 pip3.12.exe
-a----        30.09.2024     16:31         108402 pip3.exe
-a----        30.09.2024     16:30         270104 python.exe
-a----        30.09.2024     16:30         258840 pythonw.exe

workaround

# just go into the rancher
cd C:\dist\venvs\ranchercli\Scripts\

I just checked 3.12.6 venv on ubuntu 22.04 and it has python3:

(ranchercli) mobj@BPOIMOBJ1:/dist$ python3 --version
Python 3.12.6
(ranchercli) mobj@BPOIMOBJ1:/dist$ ls -l ~/.venv/ranchercli/bin/
total 36
-rw-r--r-- 1 mobj mobj 9033 Sep 30 16:52 Activate.ps1
-rw-r--r-- 1 mobj mobj 2054 Sep 30 16:52 activate
-rw-r--r-- 1 mobj mobj  933 Sep 30 16:52 activate.csh
-rw-r--r-- 1 mobj mobj 2212 Sep 30 16:52 activate.fish
-rwxr-xr-x 1 mobj mobj  247 Sep 30 16:52 pip
-rwxr-xr-x 1 mobj mobj  247 Sep 30 16:52 pip3
-rwxr-xr-x 1 mobj mobj  247 Sep 30 16:52 pip3.12
lrwxrwxrwx 1 mobj mobj   10 Sep 30 16:52 python -> python3.12
lrwxrwxrwx 1 mobj mobj   10 Sep 30 16:52 python3 -> python3.12
lrwxrwxrwx 1 mobj mobj   48 Sep 30 16:52 python3.12 -> /home/mobj/.pyenv/versions/3.12.6/bin/python3.12
@gaborbernat
Copy link
Contributor

Please post output from virtualenv invocation with verbose mode as the template requests.

@mortenb-buypass
Copy link
Author

The -vvv output is large and clunky : out.log

PS C:\tmp> ls -l .\python3126\Scripts\  
-a----        02.10.2024     11:24           2038 activate
-a----        02.10.2024     11:24            998 activate.bat
-a----        02.10.2024     11:24          26199 Activate.ps1


-a----        02.10.2024     11:24            393 deactivate.bat
-a----        02.10.2024     11:24         108395 pip.exe
-a----        02.10.2024     11:24         108395 pip3.12.exe
-a----        02.10.2024     11:24         108395 pip3.exe
-a----        02.10.2024     11:24         270104 python.exe
-a----        02.10.2024     11:24         258840 pythonw.exe

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