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

Project entry point and generated executable not working using Python version 3.7 #10165

Closed
kevintuwsp opened this issue Dec 26, 2024 · 9 comments
Labels
windows Specific to the Windows platform

Comments

@kevintuwsp
Copy link

kevintuwsp commented Dec 26, 2024

When initialising a project on Windows using the below commands, the resulting project executable does not run correctly.

uv init --app --project newpackage
uv run newpackage
SyntaxError: Non-UTF-8 code starting with '\x90' in file C:\Users\mrkev\Documents\Github\newpackage.venv\Scripts\newpackage.exe on line 2, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details
(newpackage)

Is there anything I am doing wrong? How can I check if the generated executable is correct?

@FishAlchemist
Copy link
Contributor

Image
I cannot reproduce the issue you're describing.
However, when I encounter similar encoding problems, it's usually because the source code is not in valid UTF-8.

@kevintuwsp
Copy link
Author

Image I cannot reproduce the issue you're describing. However, when I encounter similar encoding problems, it's usually because the source code is not in valid UTF-8.

Apologies, you will need to change directory to the created project folder

uv init --app --project newpackage
cd newpackage
uv run newpackage

@FishAlchemist
Copy link
Contributor

@kevintuwsp
Image
Which version of UV are you using? I'm using UV 0.5.11 on Windows 11 x86-64, but I can't reproduce the issue.

@kevintuwsp
Copy link
Author

I am using version 0.5.11 also.
Seems like your system isn't adding the executable to your path.
Can you try run the executable that UV generates in /.venv/Scripts/newpackage.exe?

@FishAlchemist
Copy link
Contributor

@kevintuwsp No, my Scripts folder doesn't have newpackage.exe, so I want to create it from scratch and it won't have newpackage.exe.
Image

@kevintuwsp
Copy link
Author

kevintuwsp commented Dec 26, 2024

Sorry it is a little late, my instructions were not correct.
It looks like this is working correctly on the later versions of python, e.g. 3.13.1.

However, for my use case I need to use the older 3.7.9 python version which shows the error.

uv init --app --package newpackage
cd newpackage
uv python install 3.7.9
uv python pin 3.7.9
uv run newpackage

@kevintuwsp kevintuwsp changed the title Project entry point and generated executable not working Project entry point and generated executable not working using Python version 3.7 Dec 26, 2024
@vivodi
Copy link

vivodi commented Dec 26, 2024

Python 3.7 is not supported.

requires-python = ">=3.8"

@charliermarsh charliermarsh added the windows Specific to the Windows platform label Dec 26, 2024
@FishAlchemist
Copy link
Contributor

@kevintuwsp
If I use Python 3.7, this issue will occur.
However, as @vivodi mentioned, uv doesn't support 3.7, so even if this issue needs to be fixed, it will probably take a long time.
So the quickest solution is to avoid using 3.7. It seems like 3.8 works fine.

@kevintuwsp
Copy link
Author

Thanks all for your help, closing this issue.

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

No branches or pull requests

4 participants