Что делать если нужно поставить какую-то 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
🖥HunyuanImage 2.1 теперь доступна в квантизованной версии!
Это text-image модель, которая может генерировать изображения в 2K.
Теперь модель можно запускать локально. Для этого необходимо минимум 24GB VRAM.
🟢Hugging Face: https://huggingface.co/tencent/HunyuanImage-2.1)
🟢Подробнее про модель: https://t.me/machinelearning_interview/2161
@ai_machinelearning_big_data
#AI#HunyuanImage#StableDiffusion#ImageGeneration
⚡️ Релиз Flux 2
Модель получила значительный апгрейд . Теперь она учитывает до десяти референсов сразу, лучше понимает свет, материалы и оптику, аккуратнее рендерит текст и выдаёт качество до 4k.
Генерации выглядят ровнее и реалистичнее, без пластикового блеска.
Можно генерировать, редактировать и совмещать изображения.
Веса открытые, так что при желании можно запускать локально (65 ГБ).
🟠Demo: https://playground.bfl.ai/image/generate
🟠Weights: https://huggingface.co/black-forest-labs
🟠HF: https://huggingface.co/black-forest-labs/FLUX.2-dev
@ai_machinelearning_big_data
#AI#Flux2#ImageGeneration#AIGraphics
🤖 OpenAI unexpectedly shook the AI image world with Studio Ghibli style memes.
Here are some mindblowing examples so far (100% AI-generated)
➖➖➖➖🔻
💎@Chatgpt_OfficialNews – Stay Updated! ⚡️
🧠 BOT: @Chatgpt_OfficialBOT
#️⃣#OpenAI #N#AI #GPT#ChatGPT#Chatbot#ImageGeneration#Design
➖➖➖➖🔺
this is a meme created by GPT when I asked it to make a meme about humans using AI to make memes. I think it has potential.
➖➖➖➖🔻
💎@Chatgpt_OfficialNews – Stay Updated! ⚡️
🧠 BOT: @Chatgpt_OfficialBOT
#️⃣#OpenAI #N#AI #GPT#ChatGPT#Chatbot#ImageGeneration#Design
➖➖➖➖🔺
🖼Big Update: Smarter, Sharper AI Images!
Hey NeuralHub fam!
We just rolled out a major upgrade to our image generation system — and it's 🔥
✨What’s new?
1️⃣More accurate prompts
2️⃣Sharper, cleaner visuals
3️⃣Fewer weird hands 🐸
4️⃣Better understanding of faces, scenes, and details.
Whether you're creating a logo, a character, or just having fun — the results are now way more realistic and on-point.🎯
Go try it now and see the difference for yourself!
➖➖➖➖🔻
🧠 BOT: @Chatgpt_OfficialBOT
💎@Chatgpt_OfficialNews
#️⃣#AIImages#NeuralHubAI#ImageGeneration#AIPower
➖➖➖➖🔺
🚀 BREAKING NEWS! 🚀
AI just got smarter, faster, and more powerful! 💡⚡️
We’re thrilled to introduce Advanced Prompting & Custom Responses! 🧠💬
🎯 What’s New?
🔠 Smarter AI responses – More context-aware and accurate!
🔠 Customizable AI tone – Want formal, fun, or technical? You decide!
🔠 Faster replies – No more waiting, just instant AI-powered answers!
✨ How does it work?
Just chat as usual, and let the AI adapt to your style & needs!
💬 Try it now & experience next-level AI conversation!
🔹 Need help? @OpenAI_helpdesk
🔹 Join the discussion: https://t.me/chatgpt_officialchat
🚀 Your AI assistant just got an upgrade—test it out now! ⚡️🎉
➖➖➖➖🔻
💎@Chatgpt_OfficialNews – Stay Updated! ⚡️
🧠 BOT: @Chatgpt_OfficialBOT
#️⃣#AIArt#ImageGeneration#OpenAI#AI#Creativity#NextGen
➖➖➖➖🔺
🚀 NEW FEATURE ALERT! 🚀
Hey there, creative minds! 🎨✨
We’re taking things to the next level – Image Generation is NOW LIVE! 🖼️🧠
Unleash your imagination and let AI bring your ideas to life! Generate stunning, high-quality images right inside Telegram! 🎉
✨ What can you do?
🔠 Create unique AI-generated images with just a text prompt!
🔠 Fast and high-quality results – No waiting, just magic! ✨
🔠 Bring your ideas to life – Whether it’s art, fantasy, or fun, we’ve got you covered!
🖼️ Try it now and let AI turn your words into masterpieces! 🎨
💬 Have questions or need help? Reach out at:
👉@OpenAI_helpdesk
🔥 Join our community and show off your creations:
🔗https://t.me/chatgpt_officialchat
Stay inspired, stay creative, and enjoy AI-powered art! 🚀✨
➖➖➖➖🔻
💎@Chatgpt_OfficialNews – Stay Updated! ⚡️
🧠 BOT: @Chatgpt_OfficialBOT
#️⃣#AIArt#ImageGeneration#OpenAI#AI#Creativity#NextGen
➖➖➖➖🔺
Hey AI lovers! Big news in the world of AI creativity: with GPT-4o, you can now create and customize images just by describing what you want! Whether it’s a specific aspect ratio, exact colors (using hex codes like #FF5733 for a vibrant orange), or even a transparent background—GPT-4o makes it happen with a simple chat.
Imagine designing a futuristic cityscape in neon blues (#00C4FF) and purples (#800080), or a minimalist logo with a 1:1 aspect ratio and a transparent background for your next project—all without touching a design tool! The possibilities are endless.
➖➖➖➖🔻
💎@Chatgpt_OfficialNews – Stay Updated! ⚡️
🧠 BOT: @Chatgpt_OfficialBOT
#️⃣#OpenAI #N#AI #GPT4o#ImageGeneration#CreativeTech#Design
➖➖➖➖🔺
⭕️ New DALL·E Prompt!
Want a stunning, high-quality 3D-rendered image with your name looking elegant and luxurious? Follow these steps:
1️⃣ Use /photo to select DALL·E 3 and set the resolution to 1024x1024.
2️⃣ Copy and paste this magic prompt into /genphoto:
📜 Prompt:
A high-resolution, professional 3D-rendered image displaying the name 'Your Name' in a modern, elegant, and luxurious font. The text should be crystal clear, perfectly sharp, and beautifully designed with a premium aesthetic. The background should feature a sleek, futuristic style with soft lighting, subtle gradients, or a metallic/glass effect to enhance the name's visual impact. The composition must be balanced, with the name centered and artistically framed to ensure consistency across multiple generations. The overall look should be minimalistic yet visually striking, conveying sophistication and exclusivity.
⭕️ Tap on the prompt to copy it instantly! 🎨✨
💡 More Bot Commands:
📸 /photo – Choose your generation model and adjust settings.
🎨 /genphoto [prompt] – Instantly create an image with your custom prompt!
⚡️Example:
/genphoto A neon-lit cyberpunk city at night with flying cars
💬 Try it GPT4.5 now & experience next-level AI conversation: @Chatgpt_OfficialBOT
🔹 Need help? @OpenAI_helpdesk
🔹 Join the discussion: https://t.me/chatgpt_officialchat
🚀 Your AI assistant just got an upgrade—test it out now! ⚡️🎉
➖➖➖➖🔻
💎@Chatgpt_OfficialNews – Stay Updated! ⚡️
🧠 BOT: @Chatgpt_OfficialBOT
#️⃣#GPT4.5 #GPT#Model#OpenAI#AI#Creativity#NextGen#image#AIArt#ImageGeneration
➖➖➖➖🔺