Что делать если нужно поставить какую-то 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
🌿 Ubud isn’t just a place – it’s a state of mind
🧘♀️ It’s not about parties – it’s about balance, inspiration, and reconnecting with yourself.
Why you should go:
• stunning nature and views
• calm, cozy atmosphere
• yoga, meditation & retreats
• delicious, healthy food
• rich Balinese culture
#places#Ubud@BaliNews
🌴 Bali zoo has a new animal: the Asian tapir
The zoo near Ubud in Gianyar district has a new member. By the beginning of the Muslim holiday Lebaran there brought a new animal. It's an Asian tapir.
The black and white tapir can still be found in the wild, walking in the jungles of Sumatra Island. They are solitary individuals that reach a length of 2 to 2,5 meters. The animals eat leaves and fruits, and their nose resembles a small trunk, like an elephant's.
@BaliNews
#wheretogo#Ubud
🧘 Ubud is hosting the Bali Spirit Festival 2026 this week
This is one of Bali’s most renowned festivals dedicated to yoga, music, dance, and somatic practices.
📆 The festival will take place from April 15 to 19 at The Yoga Barn and Puri Padi. The main program is scheduled for the upcoming weekend, from April 17 to 19.
Before that, the organizers will host:
✨ a free evening gathering – April 15
✨ an open day – April 16
📲 More info and tickets on the official website.
#events#Ubud@BaliNews
📰 The consequences of the fire at the market in Ubud
🧑🚒 The flames could not be extinguished due to the construction of the building!
🚒 The central market of Ubud was seriously damaged as a result of a fire racing in the building on August 17. The flames broke out in the eastern part of the basement of the market. The fire was caused by a short circuit in kiosk No. 3, selling T-shirts and other textiles.
🛵 The fire destroyed the contents of many shops and many motorbikes parked nearby. Extinguishing the flame took 8 hours. Those who fought the fire blame the construction of the market for the prolonged fire.
@BaliNews
#accidents#Ubud
🌴 New hotels coming to Ubud, Bali in 2027
Tourism in Bali continues to grow, and two major hotel openings are set for 2027:
🛎 Hotel Indigo Bali Ubud (IHG Hotels & Resorts)
• 130 rooms in the heart of Ubud’s cultural district
• Built near Blangsinga Waterfall, local craft markets, and Blangsinga Glass Bridge
• Will offer immersive cultural experiences, local guides, and culinary programs
• Aims to connect guests with Ubud’s heritage, nature, and creative community
• Second IHG property in Ubud, following Kimpton Bali Ubud
🛎 Atiara Ubud Bali (Radisson Collection)
• 52 rooms, including a 530 sqm Presidential Suite with private pool
• Features wellness suites, outdoor terraces, yoga decks, and jacuzzis
• First Radisson luxury property in Indonesia, targeting domestic and international travelers
#tourism#places#Ubud@BaliNews
⭐️It looks like a movie featuring Gerard Butler may be filming in Ubud
📸 The actor has been spotted several times in the city center, calmly walking around, chatting with people, and taking photos with fans — without security or a film crew, dressed in casual everyday clothes, far from the usual Hollywood glamour.
👍 The very fact that a Hollywood star of this level can freely walk around Ubud and interact with locals has once again fueled conversations about Bali as a place where celebrities can be “just people,” rather than targets for paparazzi.
What do you think — is this a film shoot, or is Butler simply vacationing on the island?
#celebrities#Ubud@BaliNews
📰Balinese sculpture park gains popularity online
📍 In Ubud, the Sari Timbul sculpture garden is rapidly gaining popularity. A massive Barong head at the entrance, the mystical Kala Rau statue, and figures from Balinese folklore make it one of the most unusual places to visit.
👀 Here, visitors can not only take striking photos but also watch the process of glass blowing and wood carving.
#places#Ubud#wheretogo@BaliNews
🎙Stand Up secret show on Bali this Friday
📰 Secret Comedy Night is Bali's only underground stand-up comedy show. Why is it a secret? All past shows have sold out resulting in having to sadly turn away many people at the door. Hence, the location now is a secret and the online sales stop once capacity is reached. Address will be sent to you privately upon your ticket purchase.
⏳ Doors open for dinner & drinks starting from 6.30 pm.
🎤 Show starts: 7.45 pm.
🍸 Food & drinks available for sale at the venue.
📍 Ubud Area (address detail will be revealed upon ticket purchase).
🎫 Early bird tickets – Rp 255,000.
🖥 Details of the event via the link.
@BaliNews
#wheretogo#events#Ubud
🐒Monkey Forest in Ubud has been closed indefinitely after the death of tourists
📰 Bali appears to have lost one of its most popular tourist attractions. After the tragedy at Monkey Forest, which claimed the lives of two foreigners, the park in the center of Ubud was closed indefinitely.
🌳 Recall, on Tuesday, due to the squally winds in Monkey Forest fell a huge tree. Two tourists died. At the site of the tragedy held a religious ceremony.
🪔 According to Balinese Hindu tradition, it is necessary to hold a pekaruan ceremony to cleanse the space of uncleanness and calm the negative energies present in the space. It is believed that if one does not get rid of these negative energies, incidents may happen again. The ceremony is usually closed to the general public.
@BaliNews
#accidents#places#Ubud
👳♂️ Sadhguru flew to Bali to recuperate after an illness
Where else could one meet India's most popular yogi and mystic if not in Ubud. Sadhguru went for a walk through the busy Balinese streets, surprising the islanders and visitors with his appearance.
It was hard not to notice him, because he went on the tour not alone, but with a full delegation. These are the participants of the unique 10-day program "Mystical Reflections", with which he came to Bali.
Bali brings tranquility and vigor for physical and spiritual recovery
Sadhguru
@BaliNews
#celebrity#Ubud