How can I install Packages from the Python Package Index?

Koloss42

Dabbler
Joined
Aug 21, 2023
Messages
21
I use truenas scale. I want to use "pip install requests" it doesn´t work.
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
That isn't surprising. TrueNAS is an appliance; it isn't designed for you to install arbitrary software in it. You would add software by way of Apps (either iX' own collection, or third-party collections like TrueCharts) or in a virtual machine.
 

Koloss42

Dabbler
Joined
Aug 21, 2023
Messages
21
Yes, i know. I my opinion is a VM for py very stupid because python works. But if you wanna you python for a docker container truenas block is also, why?
 

Ericloewe

Server Wrangler
Moderator
Joined
Feb 15, 2014
Messages
20,194
But if you wanna you python for a docker container truenas block is also, why?
Excuse me?
I my opinion is a VM for py very stupid because python works.
Well, Python some packages can be fickle when it comes to versioning. Users borking their systems through careless use of pip is an entirely possible scenario - same logic that leads to apt on Scale and pkg on Core being disabled.
 

Koloss42

Dabbler
Joined
Aug 21, 2023
Messages
21
Well, Python some packages can be fickle when it comes to versioning. Users borking their systems through careless use of pip is an entirely possible scenario - same logic that leads to apt on Scale and pkg on Core being disabled.
It seems logic. Do you have a solution too install this bibs? Maybe it exist a website were you can download the bib to import it portable?
 

sfatula

Guru
Joined
Jul 5, 2022
Messages
608
You can get python packages by using a python virtual environment. Search for it on the internet, just a few commands and it doesn't bother any truenas packages.

So, cd to some dataset/directory where you want to put it and do something like (not checked but again google it and you can replace yourenv with some other name):

python -m venv yourenv --without-pip --system-site-packages source yourenv/bin/activate (now you can in the virtual python environment) curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py python get-pip.py rm get-pip.py

Now you have pip but only inside the python virtial environment. When you want to exit the environment, type deactivate, but meanwhile load your code up somewhere and load all your pip modules your heart desires from within the environment.

To run your code from outside the virtual environment, whatever it is, you might do something like:
cd to your code directory
/pathtoyourvirtualenvironment/bin/python yourpythonscript

To just enter your virtual environment for various reasons, use source pathtovenv/bin/activate
 
Last edited:
Top