CamperBob2 2 days ago

Edit: thanks very much for the suggestions, especially adding the Python version to the uv command line. I totally missed that, and that totally fixed it. Apologies for the OT tech support derailment.

--------------

Question for those familiar with uv. US Routing apparently requires a very specific Python version (3.11 and nothing else), but my system has Python 3.10.9 installed at the moment and I'd rather not upgrade the global version just now. My understanding from reading a lot of uv evangelism on HN and elsewhere is that uv fixes this type of dilemma. But, having just tried to use it to install this package, it's just giving me the same old Python version errors:

    C:\devel\us-routing-master\us_routing>uv venv
    Using CPython 3.10.9 interpreter at: c:\WinPython-31090
    \python-3.10.9.amd64\python.exe
    Creating virtual environment at: .venv
    Activate with: .venv\Scripts\activate

    C:\devel\us-routing-master\us_routing>.venv\Scripts\activate

    (us_routing) C:\devel\us-routing-master\us_routing>uv pip     
    install us-routing

    x No solution found when resolving dependencies:
    `-> Because the current Python version (3.10.9) does not 
    satisfy Python>=3.11,<3.12 and us-routing==0.1.0
    depends on Python>=3.11,<3.12, we can conclude that us-    
    routing==0.1.0 cannot be used.
    And because only us-routing==0.1.0 is available and you 
    require us-routing, we can conclude that your
    requirements are unsatisfiable.
Am I misunderstanding the whole uv thing, or just doing something wrong? Or is us-routing somehow incompatible with it?

5
nighthawk454 2 days ago

By the looks of things, uv is telling you it’s creating a venv with Python 3.10.9 still. Since you didn’t specify you wanted another version, it probably defaulted to the first available system version.

What you want is `uv venv —python 3.11` to create a virtual environment with Python 3.11 without messing up your global system env. This should also install a portable version of Python 3.11 if needed (which it will be since you don’t have it).

https://docs.astral.sh/uv/pip/environments/#creating-a-virtu...

mrlatinos 2 days ago

This library can use any version of Python 3.11, which you can install alongside your existing 3.10.9 without changing your global python version. I don't typically work in Windows so the codeblock below is AI generated, but follows the path I would normally take - manage installed python versions using pyenv, changing the python version only for this directory via .python_version, and then creating uv environment using that.

``` :: Step 1: Install pyenv-win (make sure Git is installed) git clone https://github.com/pyenv-win/pyenv-win.git "$env:USERPROFILE\.pyenv"

:: Step 2: Add pyenv to PATH (run or add to your profile) $env:PYENV = "$env:USERPROFILE\.pyenv\pyenv-win" $env:PATH += ";$env:PYENV\bin;$env:PYENV\shims"

:: Step 3: Restart your terminal or reload environment if needed :: (you can paste the above $env:... lines again after restart)

:: Step 4: Install Python 3.11 pyenv install 3.11.9

:: Step 5: Set the local Python version for your project folder cd C:\devel\us-routing-master\us_routing pyenv local 3.11.9

:: Step 6: Verify correct Python is selected pyenv which python # should point to 3.11.x

:: Step 7: Create uv environment using Python 3.11 uv venv .venv --python "$(pyenv which python)"

:: Step 8: Activate the environment .venv\Scripts\activate

:: Step 9: Install your package uv pip install us-routing ```

pyenv is a great way to have many versions of Python installed, whether or not your global is mapped to the latest. You don't even need to set the local .python_version.. you could just do `uv venv .venv --python=python3.11`

ivanbelenky 2 days ago

This is a project I did not maintain much for the past few months, but recently I migrated many other codebases to be uv managed, and I find this optimal for many reasons. Happy to receive contributions and fix the quite strict requirements I set. That would probably be the faster way.

thelastbender12 2 days ago

You need to request a specific python version compatible with this project. Give `uv venv --python 3.11` a try.

https://docs.astral.sh/uv/pip/environments/

zerocrates 2 days ago

You just created a venv but didn't change the Python version.

I imagine you'd want:

uv venv --python 3.11