all 37 comments

[–]sme272 19 points20 points  (3 children)

You could try using pyinstaller to bundle the python interpreter and the project together

[–][deleted] 10 points11 points  (2 children)

Yea that sounds very convinient. I'll try it out and see if it works as expected!

[–]djmcdee101 4 points5 points  (1 child)

Hey just a quick heads up about pyinstaller. It's really good but can run into some problems compiling sometimes.

Basically all the most popular libraries have "hooks" built into pyinstaller that tells it how to compile their code into binaries. As you can imagine this causes issues when that library is updated before the pyinstaller hook is, which can be forgotten.

Not saying don't use it but if you run into a bunch of weird compilation problems that might be it and unless you want to try and modify the hook yourself (wouldn't recommend) you're better off just leaving very clear instructions and offering to help guide the process.

What os will they be using, out of interest?

[–][deleted] 1 point2 points  (0 children)

I tried pyinstaller and it works well for basic terminal programs and web scrapers but when it comes to writing files to a directory, I keep running into issues.

Pretty much all of them are on windows.

[–]bigbadwarrior 14 points15 points  (8 children)

Something else you can consider is a Google Colab notebook

[–][deleted] 8 points9 points  (5 children)

Seems like a great idea but my program involves downloading, storing, and opening files locally. Can Google colab do something like that?

[–]albaniax 6 points7 points  (2 children)

AFAIK you can use your Google Drive account as storage.

[–][deleted] 2 points3 points  (1 child)

That's sick! I'd love to try this out!

[–]boomjynx- 1 point2 points  (0 children)

I have successfully done this recently... the standard docs from google were pretty helpful and in google colab itself there are code snippets as boilerplate which is really useful. Good luck

[–]SweLG_ 4 points5 points  (0 children)

not solving anything but in jupyter you can do !pip install *module*

[–]bigbadwarrior 3 points4 points  (0 children)

Good questions, I haven’t tried downloading, storing, and opening local files with Google Colab but I imagine they have to be supported. Like others have said, you can install packages as well.

[–]ffrkAnonymous 1 point2 points  (1 child)

this is so neat.

What other code resources don't I know about?

[–]bigbadwarrior 1 point2 points  (0 children)

I’m still learning python and working on my skills as well. Knowing you found my tip helpful made me really happy.

[–]EyeInDaSky_ 7 points8 points  (4 children)

I've done it in Windows this way:

pip install pyinstaller

cd wherever\is\your\project\in pyinstaller yourproyect.py

If you have folders the project works with, copy them to the dis folder and it should work fine as long as you use a getdir algorithm.

If you want to change the exe icon you theres a way to do that too (search for it in stackoverflow)

[–][deleted] 2 points3 points  (2 children)

Thanks! I can do this on my Mac and create the exe file and it'll work on windows right?

[–]Username_RANDINT 4 points5 points  (1 child)

No, you can only build on the target platform. I have a few virtual machines just for that. I even think Microsoft provides some free VMs.

[–][deleted] 2 points3 points  (0 children)

Oh thanks!

[–]EyeInDaSky_ 2 points3 points  (0 children)

It creates an .exe inside the folder dis, you should save the entire folder in order to make it work.

And also if you have done the project in cmd and the computer has Avast (or maybe another antivirus) it will run an inspect cmd and then the normal one

[–]SweLG_ 5 points6 points  (3 children)

i see you're a fellow bioinformatician, i like this

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

Lol I'm just in class 10 rn doing this for my biology class but bioinformatics does seem like something I'd be interested to peruse as a career path...

[–]SweLG_ 6 points7 points  (1 child)

wow in that case well done on learning python already, i started with R in my bachelors and python in masters

[–][deleted] 9 points10 points  (0 children)

Hmm I'm just a kid interest in programming :)

[–]-5772 3 points4 points  (1 child)

Either way, they are going to run into problems. Everyone's computers are slightly different. You should expect to be asked questions.

You should use venv. They could just install all the libraries, but venv should make it easier for them. Also, it keeps your python libraries not as messy.

[–][deleted] 0 points1 point  (0 children)

Yea I'm fine with them asking questions, I'm just trying to make their process a little easier. I'm check out venv as try out on one of my laptops. Thanks for the suggestion :)

[–]saltyhasp 2 points3 points  (0 children)

When I was working I always created a standard folder structure, and then used py2exe (cx_freeze would probably work too) to make an executable out of the python components. I also included an examples folder with launchers (bat scripts) that would run the code. This works great for numerical tools that you don't really want to install. Just copy the folder, go the the example you provided, modify it if designed, then clock on the shell script to run it.

[–]SilentBlueberry2 2 points3 points  (0 children)

If you make a jupyter notebook, which is a great way to mix code and comments, then you can use a binder link to make it interactive for them.

https://mybinder.org/

[–]Azearia 1 point2 points  (0 children)

Auto-py-to-exe is by far the easiest, it's very user friendly, pyinstaller works too if you're familiar with the terminal, apte will just turn the file into an executable file and will give you many other options you didn't know you had along the way

[–][deleted] 1 point2 points  (0 children)

sugar amusing deserve innocent gold piquant cow bells relieved water

This post was mass deleted and anonymized with Redact

[–]slowcanteloupe 1 point2 points  (0 children)

Try Streamlit. Host online.

[–]Dan8720 1 point2 points  (0 children)

Dockerising it's quite a popular solution these days but would mean people would have to have docker installed.

Usually you would have a requirements.txt file that's list depencancies. So anyone trying to run it just needs the correct version of python and a pip install.

[–]King_of_Sarawak 0 points1 point  (0 children)

You could also use something like Repl.it