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

Hatch unable to find other installed versions set with pyenv on Windows #744

Closed
stephen-young opened this issue Feb 5, 2023 · 2 comments

Comments

@stephen-young
Copy link

stephen-young commented Feb 5, 2023

I've been trying to replicate the setup discussed in #642 on my system and I can't seem to get hatch to find other python versions other than the version that installed pipx and hatch or other versions random versions of the python executable found in my sys path.

Just as a trial I have been following the tutorial on packaging python packages but with using hatch. I added a simple test similar to what I did here.

My setup:

  • OS: Windows 10
  • pyenv-win installed through Powershell script on their Github
  • installed python versions 3.11.1, 3.10.9, 3.9.13, 3.8.10 and 3.7.9
  • pipx installed with global python version set to 3.11.1
  • hatch installed with pipx
  • project created with hatch new
  • project python versions set with pyenv local to include 3.9, 3.10, 3.11

Running hatch run test.py311:cov runs the tests no problem

>hatch run test.py311:cov
============================================================================== test session starts ===============================================================================
platform win32 -- Python 3.11.1, pytest-7.2.1, pluggy-1.0.0
rootdir: C:\Users\steph\Projects\Personal\packaging-tutorial-stephenmyoung
plugins: cov-4.0.0
collected 1 item

tests\test_example.py .                                                                                                                                                     [100%]

---------- coverage: platform win32, python 3.11.1-final-0 -----------
Name                                               Stmts   Miss Branch BrPart  Cover   Missing
----------------------------------------------------------------------------------------------
src\packaging_tutorial_stephenmyoung\__init__.py       0      0      0      0   100%
src\packaging_tutorial_stephenmyoung\example.py        2      0      0      0   100%
tests\__init__.py                                      0      0      0      0   100%
tests\test_example.py                                  3      0      0      0   100%
----------------------------------------------------------------------------------------------
TOTAL                                                  5      0      0      0   100%


=============================================================================== 1 passed in 0.13s ================================================================================

but 3.10 and 3.9 versions cannot be found

❯ hatch run test.py310:cov
Environment `test.py310` is incompatible: cannot locate Python: 310
❯ hatch run test.py39:cov
Environment `test.py39` is incompatible: cannot locate Python: 39

If I change the global python version with pyenv global, it still only finds 311. Perhaps it has more to do with the version that installed pipx and hatch than pyenv and it is ignoring the pyenv-win setup altogether?

Any help would be greatly appreciated.

@icfly2
Copy link

icfly2 commented Feb 10, 2023

This appears connected to pyenv, on WSL and normal env setup it works fine. #738

@stephen-young
Copy link
Author

Porting my setup to WSL did seem to fix things. I guess this is more of a problem with pyenv-win.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants