Что делать если нужно поставить какую-то 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
🇮🇩#Indonesia: Militants from the West Papua National Liberation Army (TPNPB) have attacked two ships which were reportedly carrying Indonesian military troops around the Yahukimo - Asmat border.
(via @war_noir)
🇮🇩Fuel Shortages Spread Across Indonesia's Riau
Fuel shortages have hit multiple regions across Riau province over the past week, with motorcycles, trucks, and cars forming long queues at nearly every petrol station. First reports emerged on April 30, affecting Pekanbaru and surrounding areas.
The shortages coincided with a Pertamina price hike on May 4 for several non-subsidised fuel products — just four days after supply disruptions began. The timing has amplified pressure on consumers already facing constrained access to fuel ahead of the adjustment.
The overlap between supply gaps and the price increase risks compounding distribution stress across Riau if restocking is delayed.
#Indonesia
@asianomics
🇮🇩Jakarta Plans State Vetting of Rights Defenders
Indonesia's Human Rights Ministry is proposing a formal assessor team to determine whether detained individuals qualify as human rights defenders — a classification that would trigger legal protections under a revised 1999 Human Rights Law. Minister Natalius Pigai stated eligibility would be based on the individual's actions at the time of arrest, excluding those deemed to have acted for personal or financial gain.
Civil society groups have pushed back, arguing that state authority over activist classification creates a structural conflict of interest — placing the government in the position of deciding who receives protection from government prosecution. The ministry framed the measure as a safeguard against criminalisation of legitimate advocacy, but critics maintain this function should sit with independent institutions.
The proposed regulation would take effect from the earliest stages of legal proceedings, meaning assessor determinations could directly influence whether charges proceed.
#Indonesia
@asianomics
🇮🇩Sumatra Provinces on Alert as El Niño Looms
Riau and South Sumatra are bracing for a surge in forest and peatland fires as a potential "super El Niño" raises the prospect of a prolonged, intensified dry season. In the first three months of 2026 alone, fires burned at least 42,000ha across Indonesia — roughly four times the size of Paris.
Both provinces contain the largest peatland concentrations in Sumatra, with Riau covering roughly half peatland and South Sumatra a quarter — terrain that makes fires difficult to extinguish and prone to deep subsurface burning. El Niño-driven drought cycles have historically triggered regional haze crises affecting Malaysia and Singapore.
A severe fire season would compound pressure on Indonesia's deforestation commitments and regional air quality agreements.
#Indonesia
@asianomics
🇮🇩Indonesia Military Court Tries Officers Over Acid Attack
Indonesian military prosecutors have charged four officers in connection with an acid attack on a civilian activist. Prosecutors are seeking a maximum sentence of 12 years in prison for each defendant.
The victim had been publicly known for campaigning against the expansion of the military's role in civilian affairs — a politically sensitive issue in Indonesia, where recent legislative changes have broadened the armed forces' institutional reach.
The trial places the military justice system under scrutiny at a moment of heightened debate over civil-military boundaries in the country.
#Indonesia
@asianomics
🇮🇩Wikipedia Avoids Indonesia Block With Compromise
The Wikimedia Foundation reached a compromise with Indonesia's Communication and Digital Affairs Ministry on April 25, averting a threatened block of Wikipedia after Jakarta issued a seven-day registration ultimatum under a 2020 electronic systems regulation. The ministry clarified that the registration requirement was administrative in nature, with no content takedown or data disclosure demands.
Indonesia's 2020 PSE regulation requires all electronic service providers to register locally and includes a provision mandating removal of content deemed to cause "public unrest" — a clause critics and the foundation had flagged as incompatible with international free speech norms. The foundation cited concern for its community-led model and user privacy before agreeing to proceed with administrative steps.
The Communication and Digital Affairs Ministry did not respond to requests for comment, leaving the scope of future compliance obligations formally undefined.
#Indonesia
@asianomics
🇮🇩Batam Immigration Officials Reassigned Over Tourist Extortion
Indonesia's newly appointed immigration director-general Hendarsam Marantoko has reassigned five officials from the Batam Immigration Office, placing them under a three-month investigation at the Internal Compliance Directorate. The move follows illegal levy practices at the Batam Center International Ferry Terminal targeting Singaporean and Myanmar passport holders on March 13 and 14.
The reassigned officials include Batam Immigration Office head Hajar Aswad and four others, among them immigration analyst Javier Saviola, identified as the officer who allegedly requested $300 from a Myanmar passport holder through a broker, with the final payment settling at $250. Hendarsam was installed as director-general on April 1 by Immigration and Corrections Minister Agus Andrianto.
Internal Compliance Directorate official Washington Napitupulu stated that severe disciplinary punishment under Government Regulation No. 94/2021 could include dismissal, and that the case may be referred to police for alleged extortion and gratification if sufficient evidence is gathered. Officer Javier Saviola is also to be sent to Nusakambangan Island for a special development programme.
#Indonesia
@asianomics
🇮🇩Three More Indonesian UN Peacekeepers Wounded Lebanon
Three UN peacekeepers wounded in a blast at a UN facility near El Adeisse on April 3 have been identified as Indonesian by the UN Information Centre in Jakarta. UNIFIL stated the explosion occurred inside the compound in the afternoon, with two of the three sustaining serious injuries. The origin of the blast was listed as unknown.
The incident followed a series of deaths among Indonesian peacekeepers in the same region. One Indonesian peacekeeper died on March 29 after a projectile exploded in southern Lebanon, with a UN security source telling AFP that fire from an Israeli tank was responsible. A day later, two more Indonesian peacekeepers died when an explosion struck a UNIFIL logistics convoy.
The bodies of the three previously killed peacekeepers were scheduled to arrive in Jakarta on April 4, according to Indonesia's military. Indonesia now has six peacekeepers killed or wounded in southern Lebanon within a week.
#Indonesia
@asianomics
🇮🇩Indonesia Bans Under-16s From Social Media
Indonesia on Saturday began implementing a government regulation approved earlier in March that prohibits children under 16 from accessing digital platforms including YouTube, TikTok, Facebook, Instagram, X, and Roblox. The measure is intended to limit exposure to pornography, cyberbullying, online scams, and addictive content.
Indonesia's Communication and Digital Affairs Minister Meutya Hafid stated that all digital platforms operating in the country must bring their products and services into compliance with applicable regulations, with no exceptions for any business entity. The regulation is estimated to affect around 70 million children in a country of approximately 280 million people.
Indonesia becomes the first country in Southeast Asia to impose such a ban, following a similar measure introduced by Australia in 2024. Implementation will proceed gradually until all platforms comply.
#Indonesia
@asianomics
🇮🇩 Indonesia says will withdraw from Board of Peace if it does not benefit Palestinians
Indonesia's President Prabowo Subianto has reassured local Islamic groups that he will withdraw from US President Donald Trump's 'Board of Peace' if the platform does not benefit Palestinians.
The participation of Indonesia, the world's largest Muslim-majority nation, on the board, and its decision to contribute troops for a Gaza stabilization force, has drawn criticism from experts and Muslim groups at home, who say it compromises its long-standing support for the Palestinian cause.
The Indonesian Ulema Council, a leading clerical body, had previously called for Indonesia to exit the board due to the US role in the ongoing Iran war.
#Indonesia
@asianomics
Padar Island, #Indonesia
Interesting fact:
This former haven of Komodo lizards surprises with a rare combination of colorful beaches.: with white, pink and black sand.
Nusa Penida, #Indonesia🇮🇩
Nusa Penida is a small island located about 12 km southeast of the Indonesian island of Bali.
The economy is based on tourism, fishing, and agriculture, which is quite limited due to the lack of fresh water. There are no permanent rivers or streams on the island; the riverbeds are filled with water only during the monsoon season. A significant part of the population is engaged in algae cultivation on coastal shoals in the sea