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

Need help with C, C++, perl, python, etc?

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

Postby sickpig » 2019-06-08 12:38

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.
haven = Sir P.G. Wodehouse's books. U havent lived unless u have read one :)
User avatar
sickpig
 
Posts: 212
Joined: 2019-01-23 10:34

Re: run a python app without installing it

Postby Head_on_a_Stick » 2019-06-08 12:44

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

Yes:
Code: Select all
./application.py
User avatar
Head_on_a_Stick
 
Posts: 9878
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: run a python app without installing it

Postby sickpig » 2019-06-08 13:03

thanks Head_on_a_Stick that would make everything right in the world again. lemme check.
haven = Sir P.G. Wodehouse's books. U havent lived unless u have read one :)
User avatar
sickpig
 
Posts: 212
Joined: 2019-01-23 10:34

Re: run a python app without installing it

Postby sickpig » 2019-06-08 13:36

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
haven = Sir P.G. Wodehouse's books. U havent lived unless u have read one :)
User avatar
sickpig
 
Posts: 212
Joined: 2019-01-23 10:34

Re: run a python app without installing it

Postby Head_on_a_Stick » 2019-06-08 17:44

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.
User avatar
Head_on_a_Stick
 
Posts: 9878
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: run a python app without installing it

Postby pylkko » 2019-06-08 20:30

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
pylkko
 
Posts: 1486
Joined: 2014-11-06 19:02

Re: run a python app without installing it

Postby sickpig » 2019-06-08 23:11

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
haven = Sir P.G. Wodehouse's books. U havent lived unless u have read one :)
User avatar
sickpig
 
Posts: 212
Joined: 2019-01-23 10:34

Re: run a python app without installing it

Postby neuraleskimo » 2019-06-08 23:14

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
neuraleskimo
 
Posts: 86
Joined: 2019-03-12 23:26
Location: Bloomington, Indiana, USA

Re: run a python app without installing it

Postby sickpig » 2019-06-08 23:33

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.
haven = Sir P.G. Wodehouse's books. U havent lived unless u have read one :)
User avatar
sickpig
 
Posts: 212
Joined: 2019-01-23 10:34

Re: run a python app without installing it

Postby sickpig » 2019-06-09 09:30

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-officially-recommended-python-packaging-tool/

pylkko we might just win the war against machines! i will get to it soon and report back.
haven = Sir P.G. Wodehouse's books. U havent lived unless u have read one :)
User avatar
sickpig
 
Posts: 212
Joined: 2019-01-23 10:34

Re: run a python app without installing it

Postby sickpig » 2019-06-09 23:35

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.
haven = Sir P.G. Wodehouse's books. U havent lived unless u have read one :)
User avatar
sickpig
 
Posts: 212
Joined: 2019-01-23 10:34


Return to Programming

Who is online

Users browsing this forum: No registered users and 4 guests

fashionable