Что делать если нужно поставить какую-то 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
Hello everyone!
We are happy to announce that the author of this channel has successfully completed AI Governance Professional training with the International Association of Privacy Professionals.
New goal: IAPP AI Governance exam and certification in Q1 2024!
#IAPP#AIGovernance
Dear Colleagues, I am thrilled to announce that I have successfully passed the AI Governance Professional certification exam from the International Association of Privacy Professionals (AIGP/IAPP).
This comprehensive exam covered a wide range of topics, from the technological foundations of AI systems and their lifecycles to the ethical, risk management, and legal considerations surrounding the development and deployment of AI systems.
I am committed to continuing my learning in this area and sharing news and valuable resources with you.
#IAPP#AIGP
🌐📥IAPP Publishes Curated Third-Party Resources for AI Governance
The IAPP AI Governance Center released a curated collection of third-party AI governance resources, compiled by Managing Director Ashley Casovan. The list brings together tools, templates, guidelines, and repositories from trusted organizations worldwide, aimed at helping AI developers, deployers, regulators, and governance professionals navigate an increasingly fragmented information landscape.
The initiative responds to a recurring problem in the field: the volume of AI governance material is growing faster than professionals can realistically track, assess, and trust. The resource is designed to highlight relevant, practical materials without duplicating existing work, and will be updated periodically with community input.
Casovan emphasizes that effective AI governance requires a “full-sum approach,” where multiple organizations contribute complementary expertise.
#AIGovernance#AIRegulation#EthicalAI#IAPP#AIPolicy
AIGP 2025 Update: Streamlining AI Governance Certification for Real-World Impact
The IAPP has unveiled the latest version of its AIGP Body of Knowledge (BoK), effective for exams through February 2, 2025, offering a clearer, more flexible, and practical approach to AI governance certification. Simplified to four domains, the update places new emphasis on foundational principles, ensuring that certification aligns with the most relevant and influential legal frameworks worldwide.
This streamlined version is highly practical, designed to address the current responsibilities AI governance professionals encounter, not merely theoretical questions. Furthermore, Domains III and IV now separate the roles of developers and deployers, a crucial distinction reflecting how laws and standards are evolving in the field.
By balancing legal and technical insights, the new AIGP BoK solidifies its standing as the essential credential for those committed to responsible AI governance.
#AIGP#AIGovernance#LegalTech#ResponsibleAI#IAPP
IAPP Releases Comprehensive Report on AI Governance in Practice
The International Association of Privacy Professionals (IAPP) has released a new report on AI Governance in Practice, providing key insights into the evolving field of AI governance.
The report offers a foundational overview of AI, detailing its development and essential terminology. This approach allows anyone to grasp the basics and advance in the field. It includes a thorough inventory of AI risks, particularly data-centric ones, and offers practical strategies for managing them. Additionally, the report cites leading resources, including laws, regulations, and frameworks like the NIST AI RMF, providing a strong basis for deeper exploration.
Moreover, the report highlights various industry examples to contextualize theoretical concepts. For those preparing for the AI governance exam, the report aligns well with the AIGP Body of Knowledge and covers numerous topics likely to be tested.
#AI#AIGovernance#DataPrivacy#IAPP#AIGP
Navigating the Future of AI Governance: IAPP Introduces AIGP Certification
Hello, AI enthusiasts! Exciting news from the International Association of Privacy Professionals (IAPP)! They have released the Artificial Intelligence Governance Professional Body of Knowledge (BoK), a foundational document for the upcoming AIGP certification and training.
This certification presents a brand new learning opportunity for legal professionals in the AI domain:
🔹 A Path to Safe and Trustworthy AI: The BoK outlines the knowledge and skills required for AI governance professionals to guide AI implementation responsibly.
🔹 A Living Document for an Ever-Changing Landscape: In a rapidly evolving world, updates to the BoK will be reviewed every six months to ensure it remains up-to-date.
🔹 Empowering Professionals for New Responsibilities: As generative AI increasingly integrates into business operations, organizations face both excitement and concern. The BoK equips professionals from diverse backgrounds to navigate legal and ethical challenges and take a proactive approach to risk mitigation.
🔹 A Collaborative Effort: The BoK is the result of a remarkable collaboration between the IAPP and leading voices from privacy, law, ethics, academia, computer science, and more.
🔹 Elevating AI Governance Professionals: With AI initiatives becoming integral to various organizations, privacy professionals are well-positioned to take the lead. The AIGP certification empowers them to gain the necessary knowledge and expertise to excel in AI governance roles. It's a wonderful new opportunity for legal professionals to advance their expertise in the exciting field of AI!
#AIandLaw#AIRegulation#IAPP#DigitalEthics#AIinBusiness#AIcertification
📖IAPP Expands Its AI Governance Lexicon to 101 Key Terms
The International Association of Privacy Professionals (IAPP) has released an expanded version of its Key Terms for AI Governance, now including over 100 core concepts used by professionals across the AI policy and compliance space. The initial glossary, published in fall 2023, contained 61 terms; the 2025 update integrates new terminology reflecting emerging AI use cases and governance challenges identified by the IAPP community and its collaborators.
Each definition draws on authoritative sources, including legislative texts, international frameworks, and governmental reports, ensuring alignment with the evolving global AI governance landscape. By codifying shared language and meaning, the IAPP glossary functions as a reference point for practitioners seeking consistency in interpretation and application of AI governance principles across jurisdictions.
#AI#Governance#Law#Ethics#IAPP#Terminology#Compliance#AIGovernance