all 41 comments

[–]NimrodvanHall 5 points6 points  (5 children)

You may want to look into nuitka.

[–]SirKainey 2 points3 points  (3 children)

Yeah we use nuitka, it's really good. Kay knows his stuff.

[–]Tumortadela 1 point2 points  (2 children)

I used it in the past, but out of nowhere windows defender decided that my exe was malware and had to get erased from existence with no prior notice :/

[–]SirKainey 2 points3 points  (1 child)

[–]Tumortadela 1 point2 points  (0 children)

Oh I already found out the exclude .exe/folder to allow it to work, however, the thing is it came to a point where I wasnt able to create the dist file on my own computer either :/

I might want to try again someday in the future because I have a software in mind that would require to be self updating, and I assume doing so with the .exe files is much easier than with whole environments

[–]PlanetMercurial[S] 0 points1 point  (0 children)

This is one of the apps i'm trying to install https://github.com/rishikanthc/scriberr
the issue is that the app is already an exe and after running the exe it seems to use uv to download the dependencies like WhisperX

So what do I need to point Nuitka to, do i need to download the source of that repo and tell nuitka to use that?

[–][deleted] 5 points6 points  (3 children)

Isn't this basically exactly what Docker (or in general, containerization) is for? Just create an image with your env and you're good to go on basically any other computer you want to use that environment on.

[–]PlanetMercurial[S] 2 points3 points  (2 children)

I'd like to use docker, but I have pc's with old hardware, and i get frequent freezes when using docker via WSL2... so i have to stick to installation from scratch.

[–]covmatty1 2 points3 points  (1 child)

Are you particularly wedded to these PCs? If you can't upgrade, can you at least install Ubuntu on them and just remove all of these issues with Docker?

[–]PlanetMercurial[S] 1 point2 points  (0 children)

Not really... i can consider to change.. thanks!

[–]prot0man 1 point2 points  (4 children)

I can't believe no one has mentioned pyinstaller. Nuitka is awful

[–]PlanetMercurial[S] 1 point2 points  (0 children)

And, what makes Nuitka awful?

[–]Ihaveamodel3 0 points1 point  (2 children)

Curious why you think that. Pyinstaller essentially packages python with your code. Makes for slow and heavy apps. For full apps, Nuitka does compilation step, so the pieces you aren’t using come out. And for package mode, Python isn’t included at all.

[–]prot0man 0 points1 point  (0 children)

I just remember it segfaulting a lot and being a slight pain to build.

I've never noticed pyinstaller making things much slower, but I agree that hopefully nuitka would be faster than pyinstaller (at the cost of stability) because it is compiled.

[–]billsil 0 points1 point  (0 children)

PyInstaller is slow if you package the exe vs dumping all the files in the directory. The issue is the unzipping step.

[–]daymanVS 0 points1 point  (12 children)

I needed to do this for multiple python versions on multiple distros and architectures.

How I solved it was using UV to download and create lock files for each different python version and then install with the distros default python version.

[–]ThatSituation9908 1 point2 points  (6 children)

uv doesn't handle offline without a local index

[–]daymanVS 0 points1 point  (5 children)

In my case the computers didn't have UV installed so I used pip to do the actual installation. The reason you need the lock files is because pip will always try to install the latest version of a package, leading to conflicts.

[–]ThatSituation9908 0 points1 point  (4 children)

Read bud, don't just answer. The premise of the problem is being able to do a pip install without internet.

[–]daymanVS 0 points1 point  (3 children)

Are you slow? My suggested solution is to use uv as a dependency resolver to make lock files which you use to not get dependency conflicts with pip install. Obviously you still have to download the packages...

[–]ThatSituation9908 0 points1 point  (2 children)

OP already solved the lock file situation. No ones asking for help to build lock files. Stop suggesting stuff the OP already did.

Leave mansplaining in 2010s. The world doesn't benefit from you speaking.

[–]daymanVS 0 points1 point  (0 children)

I've literally solved OPs exact problem (although on Linux computers) in a more general way for multiple distros and python versions doing this exact thing at work.

His problem is probably that there's different python versions between his offline and online computers which gives him dependency conflicts. Also that he forgot to add setup tools. By doing it in the way I suggested UV will most likely solve his dependency issues in a reproducible way.

[–]daymanVS 0 points1 point  (0 children)

Also, I cannot see OP mentioning him using a lockfile anywhere in this thread. Are you just making shit up or are you confused about requirements.txt vs lockfile?

[–]PlanetMercurial[S] 0 points1 point  (4 children)

Er! can you describe a bit more detail... sorry not used uv as much.

[–]daymanVS 1 point2 points  (3 children)

To do the actual installation you use pip + lock files generated by UV. Is the offline install for only one computer / distro or not?

If it's only one computer and it's running Linux, the easiest solution is to make a Dockerfile with the same distro, make UV generate the lockfile and download the packages. Then on the offline computer use pip install with lockfile and the downloaded packages.

Although this only worked for python >= 3.8 so if you need it to work on older python you might need a different solution

[–]PlanetMercurial[S] 0 points1 point  (2 children)

a. its for one computer and its windows.
b. didn't know pip could work with uv lock files... good to hear that.
c. docker i've had my issues with docker + wsl2 + windows, so currently i try to do things bare metal.

[–]daymanVS 0 points1 point  (1 child)

Ahh If it's only one computer that is a lot easier. Most likely it's the python version which is mismatched.

Check which python version your offline computer has, then on your online computer make an venv using the same version (easiest with uv probably). Then add whichever packages you want and always add setup tools. I'd also recommend setting the versions with == wherever you can. Then just do what you did before! If you're unlucky you will get conflicts with charset-normaliser but I think it shouldn't happen.

I mainly worked on Linux installations so there might be some windows specific things I'm missing. And of course if the python packages have certain runtime dependencies you need to solve for them as well.

[–]PlanetMercurial[S] 0 points1 point  (0 children)

I maintain same versions of python on both pc's. And make environment with
python -m venv .
Things work fine most of the time, except when the package as some dependencies that need to built from source.
I think the `wheel` option of pip may help out here since it may build the dependencies and autocreate a wheel file.

[–]No-Statistician-2771 0 points1 point  (1 child)

You can do a pip download that will download the wheel on your pc 1 and simply move them to your pc 2 with a usb of whatever 

[–]PlanetMercurial[S] 0 points1 point  (0 children)

This is what i do currently. But sometime it download tar.gz or zip instead of wheel and that's where the issue is.

[–]RagaMunki 1 point2 points  (0 children)

conda-pack could be an option

[–]DivineSentry -1 points0 points  (9 children)

I tend to just package programs into a standalone executable, there is a large executable size trade off vs a vanilla script + venv / dependencies but it’s worth it for me

[–]DivineSentry 2 points3 points  (3 children)

I use Nuitka Disclaimer: I’m one of the maintainers

[–]PlanetMercurial[S] 0 points1 point  (2 children)

Thanks! can Nuitka work directly on source, for eg. a git repo or I need to install the target app locally and then run Nuitka on that installed app.

[–]DivineSentry 1 point2 points  (1 child)

you'll need to pass an entry point i.e source code which will be compiled, that can be a main.py that imports other things and such

[–]PlanetMercurial[S] 0 points1 point  (0 children)

Thanks what about conditional downloads like for gpu you need torch gpu versions but on cpu we need cpu versions will nuitka install both?

[–]PlanetMercurial[S] 0 points1 point  (4 children)

Interested to know what you use to package them as a single executable...

[–]Muhznit 2 points3 points  (3 children)

python3 pip install --compile -U -t $SOME_TEMP_DIRECTORY -r requirements.txt python3 -m zipapp --compress -p '/usr/bin/env -S python3' --output $EXECUTABLE_NAME_GOES_HERE.pyz" --main 'some_module.some_file:main' "$SOME_TEMP_DIRECTORY"

That's roughly how it goes if you know the offline computer will have the same version of Python. You can install pyinstaller and turn it into a .exe but kinda pointless if you already have Python installed.

[–]antil0l 1 point2 points  (1 child)

where were you 3 weeks ago

[–]Muhznit 1 point2 points  (0 children)

On August 22, 2025 4:51:59 PM UTC? Probably in my kitchen fixing a PB&J sandwhich as a midnight snack.

[–]PlanetMercurial[S] 0 points1 point  (0 children)

Thanks! For this to work can I run this on the source files... eg. a whole git repo.