Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

run a python app without installing it[SOLVED-Tnx 2 pylkko]

Programming languages, Coding, Executables, Package Creation, and Scripting.
Post Reply
Message
Author
User avatar
sickpig
Posts: 589
Joined: 2019-01-23 10:34

run a python app without installing it[SOLVED-Tnx 2 pylkko]

#1 Post by sickpig »

dear citizens of gotham,

tldr:
i can just run the binary after running make in the source folder of applications built in c, no need to install the damn thing. Is there is any way to do the same for packages built in python?

long version
i realized a couple months back that there is no need to actually install an application built from source. I limit what i run using root privileges. Installing anything needs that. I am more than happy to just run make and then run the built binary (after making it executable of course).

My world was a happy place until i stumbled across apps in python. And i c what i did earlier is not possible for packages written in python.

So my question is is there any way to just build the app from source and run the binary without installing for something written in python?

I see that their readme.md advises to run sudo setup.py install together. I dont want to install it but just build it and run the binary. i can add the links to usr application folder and wherever required.
Last edited by sickpig on 2019-06-09 23:40, edited 1 time in total.

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 133 times

Re: run a python app without installing it

#2 Post by Head_on_a_Stick »

sickpig wrote:Is there is any way to do the same for packages built in python?
Yes:

Code: Select all

./application.py
deadbang

User avatar
sickpig
Posts: 589
Joined: 2019-01-23 10:34

Re: run a python app without installing it

#3 Post by sickpig »

thanks Head_on_a_Stick that would make everything right in the world again. lemme check.

User avatar
sickpig
Posts: 589
Joined: 2019-01-23 10:34

Re: run a python app without installing it

#4 Post by sickpig »

no dice
m back with tail between me legs, it spat the below error

Code: Select all

~/persepolis/persepolis/scripts$ python3 ./persepolis.py
Traceback (most recent call last):
  File "./persepolis.py", line 16, in <module>
    from persepolis.scripts.useful_tools import osAndDesktopEnvironment, determineConfigFolder
  File "/home/a/persepolis/persepolis/scripts/persepolis.py", line 16, in <module>
    from persepolis.scripts.useful_tools import osAndDesktopEnvironment, determineConfigFolder
ImportError: No module named 'persepolis.scripts'; 'persepolis' is not a package
voices in my head said maybe i misunderstood your reply and i should run ./setup.py, tried that but it is still not done with spitting errors

Code: Select all

a@a:~/persepolis$ python3 ./setup.py
Linux detected!
python3-pyqt5 is found
python3-requests is found!
python3-setproctitle is found!
python3-psutil is found!
youtube-dl is found
aria2 is found!
libnotify-bin is found!
paplay is found!
sound-theme-freedesktop is found!
Traceback (most recent call last):
  File "./setup.py", line 130, in <module>
    if sys.argv[1] == "test":
IndexError: list index out of range

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 133 times

Re: run a python app without installing it

#5 Post by Head_on_a_Stick »

sickpig wrote:maybe i misunderstood your reply and i should run ./setup.py
No, I did mean to run the application directly but it will only work if no modules are needed, which is not the case for your example.
deadbang

User avatar
pylkko
Posts: 1802
Joined: 2014-11-06 19:02

Re: run a python app without installing it

#6 Post by pylkko »

sickpig wrote:dear citizens of gotham,

So my question is is there any way to just build the app from source and run the binary without installing for something written in python?

I see that their readme.md advises to run sudo setup.py install together. I dont want to install it but just build it and run the binary. i can add the links to usr application folder and wherever required.
Python is intended to be an interpreted language and the entire point is that you never have to make a binary (although sometimes Python program parts are compiled in C for performance).

So in a way it is even better (for what you want here) as you don't need to do anything more than copy paste the source code into the interpreter. However, just like in c where more complicated programs have references to installed libraries (which the programs install with an installer upon setup) python programs can also import other python code (if it is installed). So you can look at the source code and see what modules it is importing and and get them in whatever way you want, if you don't want to install them. But pip should be able to install packages without root.

User avatar
sickpig
Posts: 589
Joined: 2019-01-23 10:34

Re: run a python app without installing it

#7 Post by sickpig »

thanks fellas for taking the time to explain details. Appreciate your patience against my obvious lack of knowledge.

pip seems to be my ticket then? lemme check if i can get it to work. i can see there are package managers like linuxbrew which let you install in the home directory(without needing to be root), but i am looking to avoid installing anything at all, if possible.

lets c

neuraleskimo
Posts: 195
Joined: 2019-03-12 23:26

Re: run a python app without installing it

#8 Post by neuraleskimo »

sickpig wrote:thanks fellas for taking the time in explaining in details. Appreciate your patience against my obvious lack of knowledge.

pip seems to be my ticket then? lemme check if i can get it to work. i can see there are package managers like linuxbrew which let you install in the home directory(without needing to be root), but i am looking to avoid installing anything at all, if possible.

lets c
Why not use containers? It is a good way to keep dependencies under control. Docker is fairly easy to install and grabbing the official Debian or Python (built from Debain as I recall) images is easy.

User avatar
sickpig
Posts: 589
Joined: 2019-01-23 10:34

Re: run a python app without installing it

#9 Post by sickpig »

yup valid option but m wary it will start its startup daemon and bunch of startup processes. my ocd will make me disable them :)

But definitely worth considering. Appreciate your suggestion.

User avatar
sickpig
Posts: 589
Joined: 2019-01-23 10:34

Re: run a python app without installing it

#10 Post by sickpig »

no significant progress today, was pure unbridled lazy, watched a crap movie and converted oxygen to co2. thats about it.

but there is hope.

found a pip3 package in stretch repo and a seemingly helpful guide https://www.ostechnix.com/pipenv-offici ... ging-tool/

pylkko we might just win the war against machines! i will get to it soon and report back.

User avatar
sickpig
Posts: 589
Joined: 2019-01-23 10:34

Re: run a python app without installing it

#11 Post by sickpig »

pylkko u did it!!! u my new hero! many thanks, much obliged :D
i could get the app to run using the earlier mentioned guide without installing it or running anything as root at all. Amazing.

Image

I had given up but your tip about pip changed it around. I had searched google up to 3 pages but no mention of how to do what i wanted to do.

Post Reply