Что делать если нужно поставить какую-то 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
Bitcoin Miner's Wallet Strategy Explained
A 15-year-old Bitcoin enthusiast reveals a four-wallet strategy: 1️⃣ *Cold Wallet* holds 60%+ for core assets. 2️⃣ *Warm Wallet* with 20-30% manages cash flow. 3️⃣ *Hot Wallet* for risky assets like NFTs. 4️⃣ *Fiat Wallet* follows a withdraw-only policy for living expenses. This approach balances security and access, aiming for financial independence. Read more here.
#Bitcoin#Wallets#Finance#Investing#Crypto
Wallets: February headlines
- Algorand (ALGO)-Based Crypto Wallet MyAlgo Urges Users To Withdraw Assets After $9,600,000 Attack, Algorand Foundation CTO John Woods says about 25 wallets were affected by the attack (source)
- Mastercard Rolls Out System Allowing for Stablecoin Payments Directly From Crypto Wallet, a collaboration between financial services giant Mastercard and web3 tech company Immersve is set to offer a new option for paying physical, digital and metaverse purchases using crypto assets (source)
- Multicoin, Sequoia Lead $6M Round in Solana-based Crypto Wallet TipLink, Circle Ventures, Solana Ventures, and Paxos also participated in the round (source)
- Addressable raises $7.5M to match crypto wallets to Twitter accounts, the solution allows marketers to promote games or conferences etc. to crypto wallet holders on Twitter, thus increasing the return on ad spend by targeting audiences that are more likely to buy products, and introducing higher efficacy/ROI (source)
- Coinbase Adds New Wallet Security Features To Protect Against Phishing and Scams, including transaction previews, token approval alerts, and a new “enhanced layers of protection” (source)
#February2023#wallets#trends
Wallets: January headlines
- Robinhood rolls out its MetaMask competitor called Robinhood Wallet to 1 million users (source)
- 1inch launches hardware wallet which supports multiple seed phrases and transparent transaction signing, as opposed to blind signing offered by some other devices (source)
- Life DeFi Wallet, a non-custodial digital wallet service, is now available on the Google Play store, making it the first multi-blockchain wallet in the world that allows users to make digital asset transfers to usernames (source)
- DeFi protocol Frontier started an in-browser wallet extension that allows crypto users to interact with staking, transactional and non-fungible token (NFT) activities over 35 supported blockchains (source)
- MSafe raises $5 million seed for developing multi-signature wallet solutions on Aptos, the round was led by Jump Crypto with participation from Circle Ventures, Coinbase Ventures, Superscrypt (founded by Temasek), Redpoint Ventures, SV Angel, Shima Capital, Spartan Group and more (source)
#January2023#wallets#trends
Wallets: December headlines:
- Crypto wallet BitKeep loses $8 million in ongoing hack - Bitkeep points to malicious APK packages (source)
- Anonymous crypto wallet moves $80 million worth of Bitcoin onto Coinbase - cryptocurrency transfers from wallets to exchanges is typically a bearish signal (source)
- Senator Warren introduces new crypto bill targeting self-custody wallets, the bill would expand KYC requirements for crypto network participants, is descibed by critics as “opportunistic” and “unconstitutional” (source)
- Huobi releases a report on crypto wallet usage, highlights that crypto wallets users grew to 85 million in 2022 (6% increase) (source)
- SafePal integrates support for TON - SafePal users will now be able to store and send the native $TON token within their hardware and software wallets. Additionally, it will be possible to directly interact with the Decentralized Applications (DApps) that currently exist on the TON blockchain (source)
#wallets#December2022#trends
Wallets: November headlines:
- Twitter may possibly be working on it own crypto wallet (source), while some sources claim that the work on crypto wallet was halted (source)
- As of November 2022, Reddit users opened 2.5 million crypto wallets following the launch of NFT marketplace (source)
- Trust Wallet token soared 47% in value after Binance CEO tweeted about the importance of self-custody and prompted users to use the Trust wallet. Other self-custody wallet provider tokens also rallied, including SafePal (SFP), which increased by 27% in value (source)
- Cold wallets moon after FTX collapse: Ledger saw its highest askes week in November, Trezor also reported a similar surge in demand (source)
- JPMorgan registered trademark for crypto wallet: “J.P. Morgan Wallet” will see the legacy bank offer crypto and bitcoin services to its existing pool of customers (source)
- Yahoo Finance released a new industry report: crypto wallet market size was valued at $6127.2 million in 2021 and is expected to expand at a CAGR of 30.78% reaching $30659.33 million by 2027 (source)
#wallets#November2022#trends
Phantom Wallet Dismisses Token Rumors
Phantom Wallet team clarifies: no plans for a native token or airdrop. Focus remains on improving the token and app discovery mechanism. More details: Read here
#Phantom#airdrops#wallets#Crypto#VC
🚀 TON Declines Over 24% Year-to-Date Despite Wallet Accumulation and Network Upgrade
TON has experienced a decline of over 24% since the beginning of the year. According to NS3.AI, despite this downturn, the top 100 wallets have accumulated an additional 189,730 TON in the past three months. This week, TON implemented the Catchain 2.0 upgrade, which has reduced confirmation times to less than one second for Telegram mini-apps, payments, and high-frequency activities. The network's seven-phase roadmap includes plans for future fee reductions.
#TON#cryptocurrency#blockchain#wallets#networkupgrade#Catchain2#Telegram#cryptoaccumulation#feereduction#highfrequencytransactions
Bitcoin Continues Strong Performance Trend
Bitcoin shows best performance among major assets for 10 of the last 13 years. On January 10, Bitcoin spot ETFs faced a $149M net outflow, while Fidelity's ETF FBTC saw an inflow of $16.57M in one day. More details in this article.
#Bitcoin#ETF#Fidelity#Finance#Investment#Markets#Trading#Assets#Crypto#AI#News#Blockchain#Bullish#Economy#Trends#Wallets#Volatility#MarketCap
Satoshi Nakamoto Identity Clue?
Coinbase's Conor Grogan claims Kraken may hold clues to Satoshi Nakamoto’s identity. Analysis of wallet clusters revealed a past transaction from the Canadian exchange CaVirtEx, acquired by Kraken in 2016. Doubts arise over KYC compliance; transaction may involve any user, not necessarily Satoshi. Current Arkham data shows Satoshi’s 22,000 wallets contain 1.09M BTC, valued at $107B.
Links: News | AI | YouTube
#Satoshi#Kraken#AI#Crypto#Blockchain#Bitcoin#Coinbase#P2P#Wallets#Arkham#BTC#KYC
🙊 “On.. went.. on..” – we are learning to distinguish swear words from terms from the crypto world!
Cryptocurrencies are an unusual and challenging market. Over the years, Cryptans have invented many words to describe what is happening around them. And we have compiled a dictionary of the most important of them for you:
➖#Wallets are a key vault for different cryptocurrencies. There is no crypt on the wallet itself, it is located in the blockchain and is assigned to your addresses. Wallets can be "cold" and "hot".
➖#DeFi – decentralized finance. Such crypto projects do not have a specific “manager” or “supervisor”. Interactions between users are managed by smart contracts.
➖#Smart contract - algorithms in the blockchain that control user actions and execute commands and conditions embedded in them.
➖#Proof-of-Work (POW, proof of work) is an algorithm for confirming transactions in the blockchain (achieving consensus) using the computing power of its participants (mining)
➖#Proof-of-Stake (POS, proof of stake) – all transactions in the blockchain are confirmed using cryptocurrency in the wallets of participants
➖#Staking – placement of POS-blockchain tokens in a wallet for a reward. The POS system needs coins to function. A more convenient and effective form is liquid staking.
➖#Gas – payment for transactions on the blockchain. When the activity on the network increases, so does the gas charge.
➖#Fork – updating/changing the blockchain: its technologies and rules
➖#Mixers are platforms that mix tokens of different users, hiding the history of transactions and previous owners.
➖#Bridges (cryptomostes, cross-chain bridges) is a service for transferring crypts from one blockchain to another. Without them, different blockchains and crypto projects cannot communicate with each other.
➖#NFT is a unique digital certificate confirming the ownership of a digital object: anything, but most often a song, a picture, an object from a game.
➖#Stablecoins are coins backed by reliable real assets (dollars, government bonds), and therefore stable in price: 1 to 1 with the dollar.
➖#Memcoins are often coins created “for fun". They are popular among speculators, but some coins “grow up” and try to create full-fledged projects.
➖#Profitability farming is earning money by providing your tokens for trading to other users in liquidity pools on a decentralized crypto exchange.
➖#Airdrop – free distribution of crypto project coins for user activity: try out the project, tell about it on social networks
🚀 AI TRENDS | University of California Study Reveals Security Risks in Third-Party LLM Routers
Researchers at the University of California have identified security vulnerabilities in 26 third-party large language model (LLM) routers, which can potentially inject malicious code or steal credentials from AI agent traffic. According to NS3.AI, the study highlighted that one of these routers was able to drain Ether from a decoy wallet, although the reported financial loss remained under $50. The research paper cautioned developers who utilize AI coding agents for smart contracts or wallets, noting that private keys or seed phrases could be exposed when requests are routed through unscreened routers.
#AI#securityrisks#thirdpartyLLM#maliciouscode#credentials#AIagents#UCstudy#smartcontracts#wallets#privatekeys#seedphrases#cybersecurity#ETH