astral-sh / uv

An extremely fast Python package and project manager, written in Rust.
https://docs.astral.sh/uv
Apache License 2.0
24.91k stars 721 forks source link

uv run behaves differently on windows vs linux #8748

Open linde12 opened 4 hours ago

linde12 commented 4 hours ago

I'm trying to run func start (Azure Functions Emulator) with uv, and in Linux this works fine: uv run func start runs func start with the .venv as expected. However, on Windows it is unable to run func as it can't spawn the process.

As a minimal example i did the same with echo: Linux (fish shell): image

Windows (powershell): image

So there seems to be some mismatch between the two, but maybe there is better/preferred way of running an arbitrary program while also running/installing the uv venv?

FishAlchemist commented 4 hours ago

In Ubuntu 20, echo is a program, and I assume it's the same in other Linux distributions. It's normal for it to work in Linux. As for Windows, I believe echo doesn't exist as a standalone program. The echo in PowerShell is an alias, and in cmd, it's likely a built-in command. image

linde12 commented 4 hours ago

In Ubuntu 20, echo is a program, and I assume it's the same in other Linux distributions. It's normal for it to work in Linux. As for Windows, I believe echo doesn't exist as a standalone program. The echo in PowerShell is an alias, and in cmd, it's likely a built-in command. image

@FishAlchemist Aha! This make sense, its just weird that the same happens with func start ..! I was unable to reproduce it on another Windows machine though, so i will investigate if there is something wrong with the first one.

FishAlchemist commented 4 hours ago

@linde12 For Windows, check the .venv\Scripts folder. If any package has an executable file, it's usually placed in this Scripts folder.

linde12 commented 3 hours ago

@linde12 For Windows, check the .venv\Scripts folder. If any package has an executable file, it's usually placed in this Scripts folder.

Ah yes, but func is a third party tool not installed in the .venv. I just want to run this executable with the venv activated.

FishAlchemist commented 3 hours ago

@linde12 For Windows, check the .venv\Scripts folder. If any package has an executable file, it's usually placed in this Scripts folder.

Ah yes, but func is a third party tool not installed in the .venv. I just want to run this executable with the venv activated.

I think your Windows environment doesn't have an executable file named echo that can be found by UV. However, it seems like echo isn't the program you actually want to run. Is there a possibility that you forgot to install the related program on Windows?

UV is not limited to executing files within virtual environments only. image