Что делать если нужно поставить какую-то Python-библиотеку а root-прав нет? То есть в систему библиотеку никак и ничего не поставить.
Есть как минимум два способа это решить правильно!
🔸 Сделать виртуальное окружение и ставить там что угодно.
Это позволит создать полностью независимое исполняемое окружение для ваших приложений.
Все библиотеки будут храниться в домашней директории юзера а значит доступ на запись имеется.
Создать очень просто:
python3 -m venv ~/venvs/myenvname
Теперь активируем окружение
# Linux
source ~/venvs/myenvname/bin/activate
# Windows
%userprofile%\venvs\myenvname\Scripts\activate.bat
Можно ставить любые библиотеки и запускать приложение.
Это стандартный метод работы с любым проектом. Если еще не используете его, то пора начинать. Даже при наличии root доступа!
🔸 Бывает, что нет возможности запустить приложение из своего виртуального окружения. Например, его запускает какой-то сервис от вашего юзера и вставить активацию окружения вы не можете.
В этом случае можно установить библиотеки для Python не глобально в систему, а только для юзера.
Выполните этот код в консоли:
python3 -m site
Вы получите что-то такое:
sys.path = [
'/home/user',
'/usr/lib/python37.zip',
'/usr/lib/python3.7',
'/usr/lib/python3.7/lib-dynload',
'/home/user/.local/lib/python3.7/site-packages',
...
]
USER_BASE: '/home/user/.local'
USER_SITE: '/home/user/.local/lib/python3.7/site-packages'
ENABLE_USER_SITE: True
Нас интересует параметр USER_SITE. Это путь к пользовательским библиотекам, которые доступны по умолчанию, если они есть.
Именно сюда будут устанавливаться модули если добавить флаг --user при установке чего-либо через pip
pip install --user requests
Для этой команды не нужны root-права.
После неё можно запускать системный интерпретатор без виртуальных окружений и установленная библиотека будет доступна для текущего юзера.
Параметр USER_BASE показывает корневую директорию для хранения user-библиотек. Её можно изменить с помощью переменной окружения PYTHONUSERBASE
export PYTHONUSERBASE=~/pylibs
python3 -m site
...
USER_BASE: '/home/user/pylibs'
USER_SITE: '/home/user/pylibs/lib/python3.7/site-packages'
Получается некоторое подобие виртуального окружения для бедных 😁 которое можно менять через эту переменную (не делайте так!Лучше venv!)
🔸 Дописывание пути в PYTHONPATH
Этот способ не входит в список "двух правильных", но тоже рабочий. Здесь придётся сделать всё несколько сложней.
Сначала ставим библиотеку в любое место указывая путь установки
pip3 install -t ~/mylibs modulename
Библиотека установится без привязки к какому-либо интерпретатору. То есть по умолчанию не будет видна. Теперь в нужный момент добавляем этот путь в sys.path или в PYTHONPATH.
Не буду советовать так делать. Единственный раз когда этот способ мне пригодился и решил поставленную задачу, это при создании общей библиотеки для кластера компьютеров.
Модули лежат в сети и подгружаются для всех из одного и того же места. То есть обновлять файлы требуется только один раз а не на всех хосты отдельно.
Минусы такого подхода:
▫️Нужно всем хостам пробить нужный путь в .bashrc или ещё куда-то чтобы он сетапился на старте.
▫️Чем больше хостов тем больше нагрузка на сеть. Иногда такой способ не подходит именно по этой причине. Тогда Ansible вам в помощь.
▫️Не очень подходит если хосты с разными операционками. Некоторые библиотеки различаются для Linux и Windows (там, где есть бинарники) и приходится мудрить более сложные схемы.
#tricks#basic
kMeet
Free and secure videoconferencing solution
kMeet is a videoconferencing solution that respects your privacy for all your discussions.No e-mail address, no advertising and no registration are required. Your discussions are not analysed and are only transmitted through Infomaniak servers in Switzerland.
Features :
- Create online (audio and video) meetings with multiple people
- Excellent audio quality
- Unlimited number of participants (subject to resources)
- No apps required for desktop computers
- Join meetings hosted by Infomaniak Meet or Jitsi
- Protect access to your meetings with a password
- Discuss and share resources via the integrated chat function
- Invite your participants via a URL
Download - https://play.google.com/store/apps/details?id=com.infomaniak.meet
https://github.com/Infomaniak/android-infomaniak-meet
#im#Videocall
@foss_Android
Jitsi's official instance now requires you to authenticate with Facebook, Google, or Microsoft to host a call
https://jitsi.org/blog/authentication-on-meet-jit-si/
Jitsi was a quick-and-easy (not to mention private and anonymous) video chat tool for friends and also strangers. Jitsi's killer feature was being a FOSS 1-click, no sign-up call service.
Now you'll have to deploy your own instance if you want to avoid authenticating with Facebook, Google, or Microsoft (Github). But by deploying your own instance, you are effectively no longer anonymous, as you'll need to provide billing info to your host, or provide your home IP so folks can connect to it.
https://jitsi.github.io/handbook/docs/community/community-instances/
This list is dynamically refreshed and provides a fair amount of alternative servers:
https://ladatano.partidopirata.com.ar/jitsimeter/
#jitsi#videocall
#TBOT Show 7: The Significance of Dorsey’s Bitchat, Worlds First eSIM Hack, Mexico’s Digital ID, New Show Source Insights
Took a week off and now I’m back. 😎 (with a new addition to the show?!) (also - big sorry for the show being 40 minutes)
WATCH THE SHOW ON SUBSTACK
https://odysee.com/@takebackourtech:f/tbot-show-7:6
Here’s the stories for the week:
Jack #Dorsey’s #Bitchat - The Real Story: The tech mogul Jack Dorsey released a censorship proof messaging app in late June - named Bitchat. It runs a #bluetooth#mesh network, end to end #e2e#encryption, and rolling IDs and is picking up traction. I share my thoughts on the app, and concerns I have - but that’s not even the real story. I think Jack has a bigger message than just the app.
World’s First #eSIM Hack: A security lab out of Poland just demonstrated a hack on one of the largest SIM providers for IoT devices. We’ll get techy in our understanding and ask the question, could this impact our phones?
#DigitalID, Coming Soon To #Mexico: The Mexican government has signed a new #Biometric#ID law, known as the CURP. How is this enforced and what does it mean for Mexican residents? Find out today.
Decentralized #Video Conferencing: Recently I’ve been relying more on video conferences instead of calling people, especially while traveling. Good thing I’ve got the #Jitsi app, I’ll show you my setup!
#videocall
New Show, “Source Insights”: You follow #TBOT to stay informed on tech freedom. Now go deeper with a new weekly show “Source Insights”, where Hakeem shares his tools, lifestyle and productivity tips, entrepreneurial advice, wisdom from guides, and personal experiences.
Go deeper, join me as a Source Seeker. Unlock access with a paid subscription.
UNLOCK ACCESS
🪄 We aim for our show to be well-researched, well-informed and focused on the most impactful stories
⭐️ PLUS - Each story comes with recommendations and there’s one cool tech trick or open-source solution every week.
We’ll be publishing full posts and clips of each of these stories soon.
Share this post with your crew. 🚢
👩💻Get private phones, laptops, and tablets
📲SIM Swap Survival Guide Webinar