Что делать если нужно поставить какую-то 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
US: FTC Takes Action Against Misleading AI Bias Claims
The Federal Trade Commission (FTC) has issued a proposed order targeting IntelliVision Technologies for allegedly misleading claims about its AI facial recognition technology. The California-based company promoted its software as having "zero gender or racial bias" and claimed accuracy rates of over 99%. However, FTC investigations revealed significant gaps in these claims, including insufficient testing data and evidence that its algorithms fell far behind competitors, failing to rank in the top 100 tested by the National Institute of Standards and Technology (NIST) as of December 2023.
IntelliVision also reportedly trained its algorithms using just 100,000 faces, creating image variations to simulate diversity, instead of using millions of real-world data points as advertised. The FTC's proposed order would prohibit the company from making unsubstantiated claims and require rigorous, reliable testing to support any future statements. This case underscores the growing scrutiny of AI providers and the risks of exaggerating bias-free performance in sensitive technologies.
#AIRegulation#AIEthics#FTC
🇺🇸FTC Targets Workado for Misleading AI Accuracy Claims
The U.S. Federal Trade Commission has taken action against AI company Workado for allegedly making false and unsupported claims about its AI Content Detector. Workado advertised its tool as being 98% accurate in identifying whether text was generated by AI or written by a human.
Independent testing revealed a stark contrast: the tool achieved only 53% accuracy on general-purpose content, far below the company's claims. The FTC's order underscores growing regulatory attention on transparency and accountability in AI marketing practices.
#AIRegulation#FTC#AICompliance#AIEthics
US: FTC's New Rule Targets Fake Reviews and Testimonials
The Federal Trade Commission (FTC) has introduced a significant new rule to combat the rise of fake consumer reviews and deceptive testimonials. As businesses increasingly rely on online reviews to influence consumer behavior, the FTC’s regulation marks a crucial step in ensuring that these reviews are authentic and transparent. The rule, which is part of the FTC's broader strategy to protect consumers and promote fair competition, enables courts to impose civil penalties on violators and allows the FTC to seek compensation for those affected by deceptive practices.
Key provisions of the rule prohibit the creation, sale, or purchase of fake consumer reviews and testimonials. This includes AI-generated reviews, which the FTC explicitly addressed, signaling its commitment to preventing the use of artificial intelligence in misleading ways.
Marketers and businesses must now ensure that all reviews are genuine, accurately reflect consumers' experiences, and that any insider connections are fully disclosed. Failure to comply with these regulations could result in significant legal and financial consequences, as the FTC continues to prioritize consumer protection in the digital marketplace.
#AI#FTC#ConsumerProtection
Бренд белья Shapermint получил иск из-за фейковых скидок, поддельных таймеров «заказ сохранён на 59 минут» и автоматического подключения подписок без согласия.
Вот, даже на моем скрине, у них скидка 70%.
Суд отказался отклонить иск, поэтому компания была вынуждена заключить мировое соглашение на $4,7 млн. По подсчётам, юристы получат из этой суммы около $1,4 млн.
Интересный вопрос. Могут ли иностранные компании получить подобные иски в США?
Вот, что отвечает @insider_infor:
Короткий ответ — да. Достаточно иметь “minimum contacts” с США, чтобы американский суд признал личную юрисдикцию, даже если у компании нет офиса в США.
Типичный сценарий: несколько потребителей жалуются на «вечные скидки» или фейковые таймеры распродаж, их адвокаты быстро оформляют class action — и компания рискует многомиллионными выплатами: по $5 каждому пострадавшему и $1 млн — их адвокатам 😁
Но это ещё не всё: на компанию может выйти Федеральная торговая комиссия (#FTC) или генеральный прокурор штата.
Суммы тоже немалые: британская компания Paddle заплатила $5 млн штрафа за нарушение правил автоматического продления подписок.
#США#суд#скидки
Navigating AI Worries: Insights from the FTC
Hello, dear subsribers! The U.S. Federal Trade Commission's Office of Technology has addressed consumers' growing concerns about artificial intelligence in a recent blog post. These concerns encompass the entire AI lifecycle, from its construction to its real-world use by third parties.
Key issues highlighted include the extensive data collection necessary for training AI models and various aspects of users' interactions with AI systems.
#AIandLaw#AIConcerns#FTC#ArtificialIntelligence
US: FTC Empowered in AI Oversight Move
Hello, everybody! In a unanimous vote, the US Federal Trade Commission (FTC) has granted itself authority to demand documents in investigations of products and services claiming AI use. The decision allows the issuance of civil investigative demands (CIDs) during probes into corporate AI activities, streamlining the investigative process. This power, effective for a decade, aims to expedite investigations amid the growing role of AI in trade regulation cases. The FTC highlights the potential for AI to be misused for fraud, deception, privacy infringements, and unfair practices, necessitating robust oversight.
As part of its heightened interest in AI, the FTC has initiated the "FTC Voice Cloning Challenge" to combat voice deepfakes. With a $25,000 prize for winning ideas, the challenge seeks multidisciplinary approaches to detect AI-generated audio. This move reflects the FTC's commitment to addressing the abuse of AI algorithms that mimic voices for fraudulent activities, such as unauthorized access to sensitive information or extortion scams. The challenge aims to encourage innovation while warning of potential regulatory actions if effective solutions don't emerge.
#AIandLaw#FTC#AIOversight#VoiceCloningChallenge
US FTC Hosts Inaugural AI Policy Summit
Greetings everyone! The US Federal Trade Commission (FTC) held its first public summit on AI policy on January 25, 2024, focusing on antitrust and consumer protection challenges posed by AI technology's rapid evolution. The event convened experts from academia, industry, and government to discuss competition and consumer protection considerations in AI.
FTC leaders expressed concerns about anticompetitive practices and consumer protection risks stemming from the adoption of large language models and generative AI. The agency is exploring enhanced enforcement in the AI sector while developing its liability regime.
FTC Chair Lina Khan highlighted worries about incumbent tech companies consolidating control of the AI sector through vertical integration, leveraging their influence over training data and infrastructure. The FTC also signaled intentions to address consumer protection issues related to harmful AI applications and privacy violations in training data collection.
The FTC announced a Section 6(b) inquiry into recent AI investments and partnerships between developers and cloud service providers to study their competitive impact. The summit reflects the FTC's commitment to understanding and regulating AI's impact on competition and consumer welfare.
#FTC#AIPolicySummit#Antitrust#ConsumerProtection
🇺🇸FTC Launches Inquiry into AI Chatbots’ Impact on Children
The Federal Trade Commission has issued 6(b) orders to Google, OpenAI, Meta, xAI, CharacterAI, Snap, and Instagram, demanding detailed information on how these companies test, monitor, and mitigate the risks their AI chatbots pose to children and teens. The inquiry will focus on safety evaluations, age restrictions, disclosure practices, data handling, and the steps taken to comply with the Children’s Online Privacy Protection Act.
The FTC aims to understand how chatbots may impact young users, including risks from monetization strategies and the use of personal data. Depending on the findings, the Commission signaled that enforcement actions could follow to ensure child safety in AI-powered digital environments.
#AIEhics#ChildSafety#FTC#AIRegulation#Chatbots#AIGovernance
FTC bans Rite Aid from using AI facial recognition in stores for 5 years
Hello everybody! The US Federal Trade Commission (FTC) has barred American drugstore giant Rite Aid from utilizing AI facial recognition technology for surveillance purposes over the next five years.
The FTC intervened as Rite Aid allegedly "failed to implement reasonable procedures" in deploying facial recognition across 200 stores over eight years.
Rite Aid's facial recognition system, designed to identify past shoplifters, resulted in numerous false positives. Tens of thousands of individuals were included, often with low-quality images from various sources, leading to unwarranted confrontations and police interventions, disproportionately impacting people of color.
Rite Aid is mandated to delete collected images, algorithms, and related products, notify consumers, enhance data security measures, and provide clear notices regarding any biometric surveillance technology in stores.
Rite Aid, while agreeing to the FTC settlement, expressed fundamental disagreement with the facial recognition allegations. The company halted the technology's use three years prior to the FTC investigation and commits to fortifying information security practices.
#AILaw#PrivacyRights#FacialRecognition#FTC#RiteAid#LegalTech