#python #venv #pip #uv #conda 0️⃣ introduction well, I don't usually work with python. at least it's not my primary language. so i recently found out my entire mac was running under a default base Conda environment. I had to dig to understand python environments and package managers. 1️⃣ what is an environment official venv doc says 1: " lightweight “virtual environments”, each with their own independent set of Python packages installed in their site directories." A virtual environment is a lightweight isolated space where Python packages are installed. if 2 projects have different sets of Python packages, they would not cross-over. 2️⃣ what is a package manager? Python defaults to pip. Pip is a "a package manager (package management system) written in Python and is used to install and manage software packages" 2 A package manager installs and manages packages. Dependency, subdependency, versioning, install, remove, info etc. Virtual Environment only contains the installed packages. 2️⃣ put it together To properly work with a Python project, I would create a virtual environment. Then I would install necessary packages inside the virtual environment. ✨ venv + pip ✨ 3️⃣ Conda Conda is an alternative to venv + pip * manages everything Python and etc needed for your project. * widely used in data science - or so i've heard. I'm not sure on this. * relies on Anaconda and PyPl for the packages. Other options don't have access to Anaconda, it seems. 4️⃣ uv uv is also an alternative to venv + pip uv is super fast * widely used in software development * LangChain and LangGraph uses this 5️⃣ why do we have multiple options? i read this great article https://lnkd.in/eJ3_UsjC basically had the same question as me. 6️⃣ Quick overview I also went to #Gemini for an answer. img below is the table overview. 7️⃣ conclusion much of these would come to me more naturally when i work with Python heavily. but at least I know that I don't need to have a base Conda environment running at my root - it's convenient though. And I know that I can use venv+pip or uv for any projects I'm thinking of. #softwareengineer #softwaredevelopment #softwareengineering #softwaredeveloper #swe #sde #computerscience 1 : https://lnkd.in/ejTmWqyZ 2 : https://lnkd.in/ewiaHyRS)
Understanding Python environments and package managers
More Relevant Posts
-
Introducing rpycbench, an open source python RPC profiler/benchmark. We do a lot of remote AI workload monitoring for CXL.mem at Micron Technology. Our internal application suite taught me a lot about RPyC, a very slick python extension that treats remote objects and functions as if they are local. I thought it would be cool to put together an open source tool to run experiments on how RPyC performs compared to HTTP/REST. You can benchmark your own network topology with bandwidth, latency, server forking/threading strategies, run locally or remotely with zero deployment, visualize recursive network round trips, get telemetry and stats on stack frames and netref object resolution from the command line with no code. THEN, you can turn right around and use the python API to profile + optimize your existing app code using all the same tools. https://bit.ly/3JTGFR3
To view or add a comment, sign in
-
It’s always tempting to upgrade to the newest Python release as soon as it’s out — but for Python 3.13 and 3.14, it’s worth pausing for a closer look. These versions aren’t just “routine updates.” They mark the beginning of a major shift: the introduction of Free-Threaded Python, a build of CPython without the Global Interpreter Lock (GIL). Removing the GIL allows true parallel execution across CPU cores — an exciting step forward for performance and concurrency. But this change also alters how the interpreter interacts with native C/C++ extensions, and many popular libraries (like NumPy, Pandas, TensorFlow, and Pillow) were originally built assuming the GIL existed. Before upgrading, it’s crucial to know whether your dependencies are ready for this new world. The PSF has introduced a helpful tool for that: ft-checker.com It provides a clear heatmap showing which Python packages are currently compatible with the Free-Threaded builds of Python 3.13 and 3.14 — and which ones still need work. #Python #GIL #FreeThreaded #Concurrency #ParallelComputing #SoftwareEngineering #OpenSource #Python314 #Python315 #CPython
To view or add a comment, sign in
-
🔧 Everyone's using monkey-patching in Python, but these alternatives are 10x safer Here are 3 game-changing tools for modifying Python code at runtime that most developers don't know about: 1. Modshim (New!) → Surgical precision code modification without the mess → 70% less likely to cause runtime errors vs traditional monkey-patching → Free & open source 2. pytest-mock → Clean mocking with automatic cleanup → Prevents test pollution and memory leaks → Free community edition 3. unittest.mock → Built-in solution that's seriously underrated → Zero dependencies, works out of the box → Native Python support 💡 Pro tip: Modshim's isolated execution context means your patches won't leak into other parts of your codebase. No more mysterious bugs! 🔥 Why this matters: • Safer code modifications • Better testing isolation • Cleaner debugging • Production-ready stability Save this before it becomes mainstream! 📌 Which tool are you trying first? 📖 Read full article: https://lnkd.in/eUbnh4AU #Python #Programming #SoftwareEngineering #DevTools #CodeQuality #Testing #PythonDevelopment #TechTips
To view or add a comment, sign in
-
🎥 Python just removed the GIL after 33 years. It will change everything for multi-threaded code Python 3.14 ships with a free-threaded version that unlocks true multi-core performance. No more single-threaded bottlenecks. No more heavy multi-processing overhead. (🎥 Full breakdown with code examples in my new video, link in comments👇🏽) 𝗧𝗵𝗲 𝗯𝗮𝗰𝗸𝘀𝘁𝗼𝗿𝘆 Python was created in 1991. Multi-core processors didn't exist until 2001 (IBM's Power4). When they added threading support in 1992, they used the Global Interpreter Lock (GIL) to keep things simple and thread-safe. The GIL is a single lock that only allows one thread to execute at a time. Launch 10 threads or 1 thread? Same performance on a 16-core machine. 𝗪𝗵𝘆 𝘄𝗲 𝗸𝗲𝗽𝘁 𝗶𝘁 👉🏽 Low overhead for single-threaded programs 👉🏽 Simple memory management (reference counting) 👉🏽 Compatibility with non-thread-safe C libraries 👉🏽 Easy to implement (one lock vs fine-grained locking) 𝗧𝗵𝗲 𝗽𝗿𝗼𝗯𝗹𝗲𝗺 Your multi-threaded code runs sequentially. Thread 1 executes, releases the GIL, Thread 2 executes, releases the GIL. Zero parallelism. You had to use multi-processing with massive memory overhead and separate interpreters. 𝗣𝘆𝘁𝗵𝗼𝗻 𝟯.𝟭𝟰 𝗰𝗵𝗮𝗻𝗴𝗲𝘀 𝘁𝗵𝗲 𝗴𝗮𝗺𝗲 Two versions ship together: - Standard Python (with GIL) - Free-threaded Python (no GIL) Same code. Actual parallelism. Multi-core performance with threading. 𝗛𝗼𝘄 𝘁𝗼 𝘁𝗿𝘆 𝗶𝘁 Install: - Install with UV in seconds: - uv python install 3.14t Run your code: - No GIL: PYTHON_GIL=0 python script[.]py - With GIL: PYTHON_GIL=1 python script[.]py That's it. Same threading code, multi-core performance unlocked. 𝗣𝗲𝗿𝗳𝗲𝗰𝘁 𝗳𝗼𝗿 - Data processing pipelines - Scientific computing - Image/video processing - Any CPU-bound workload After 30+ years, Python finally leverages all your cores with threading. No more choosing between simple threading and heavy multi-processing. 𝘈𝘳𝘦 𝘺𝘰𝘶 𝘶𝘴𝘪𝘯𝘨 𝘊𝘗𝘜-𝘪𝘯𝘵𝘦𝘯𝘴𝘪𝘷𝘦 𝘵𝘢𝘴𝘬𝘴 𝘪𝘯 𝘗𝘺𝘵𝘩𝘰𝘯? 𝘛𝘩𝘪𝘴 𝘪𝘴 𝘺𝘰𝘶𝘳 𝘱𝘦𝘳𝘧𝘰𝘳𝘮𝘢𝘯𝘤𝘦 𝘶𝘯𝘭𝘰𝘤𝘬. 🎥 Full breakdown with code examples in my new video (link in comments). 👇🏽 #python #ai #performance #opensource
To view or add a comment, sign in
-
-
🧩 5 Hidden Python Built-ins That Even Pros Forget Exist Most Python devs know zip() and enumerate(). But Python hides some real treasures — tools that can save hours once you discover them. Here are 5 deep built-ins that deserve your attention 👇 1️⃣ vars() — The instant object explorer: Returns an object’s __dict__ — basically, its attributes and values. Perfect for debugging, serialization, or logging class data cleanly. 2️⃣ callable() — To check if something can be called: Ever got an error calling a non-function? callable() safely checks whether an object is a function, method, or callable class before you run it. 3️⃣ id() — For memory-level debugging: Every object in Python has a unique memory identity. id() helps you detect aliasing bugs, reference issues, and subtle logic errors when working with mutable data. 4️⃣ hash() — For immutability & performance: Want to know if an object can be used in a set or dict key? If it’s hashable — you can. hash() tells you instantly. It’s also used under the hood in Python’s data structures. 5️⃣ import() — The dynamic import trick: Yes, you can import modules at runtime using this. It’s the secret behind dynamic workflows, plugin systems, and meta-programming tools. 💡 Bonus: Try pairing getattr() and setattr() for dynamic variable or method access — pure Python magic. 💡 Knowing these isn’t just “clever” — it’s what makes your code meta-programming ready. 👉 Which of these blew your mind the most? #Python #PythonTips #PythonTricks #CodeNewbie #LearnPython #DeveloperLife #HiddenGems #SmartCoding #BuildInPublic #100DaysOfCode #DidYouKnow #HiddenGems #MindBlownCode #CodeMagic #SmartCoding #GeekThings #TechReel #CodingReel #BuildInPublic #100DaysOfCode
To view or add a comment, sign in
-
-
𝗣𝘆𝘁𝗵𝗼𝗻 𝟯.𝟭𝟰: 𝗙𝗶𝗻𝗮𝗹𝗹𝘆, 𝗬𝗼𝘂 𝗖𝗮𝗻 𝗗𝗶𝘀𝗮𝗯𝗹𝗲 𝘁𝗵𝗲 𝗚𝗜𝗟! Big news for Python devs: Python 3.14 lets you turn off the Global Interpreter Lock (GIL) - a historic step in the language. --- What’s the GIL? The Global Interpreter Lock (GIL) prevents true multi-threading in standard Python: even with multiple threads, only one executes Python code at a time. It’s been a pain for devs building high-performance or parallel apps. What’s new in Python 3.14? • You can now run Python without the GIL! • Multiple threads can finally run real Python code in parallel on multiple CPU cores. Which means... • Multi-threaded code (e.g., concurrent web servers, data crunching, agent apps) gets a major speedup -> no more C extensions/hacks needed. • You can better use multi-core hardware: just like Java, C++, and Go. --- How to use it (very simply): • With Python 3.14 the default interpreter build remains the traditional GIL-enabled version, so existing Python code and libraries should work as before. • If you’re working on new parallel or CPU-bound threading workloads, you can optionally install or build the free-threaded (GIL-disabled) version of Python. Caveats: Not all third-party libraries are yet fully compatible with the GIL-free build. Also, single-threaded workloads may run slightly slower in this build, so the benefit is primarily for multi-threaded, core-saturating tasks. --- Overall: Python 3.14 lets you choose:- classic simplicity or full-power concurrency. It makes Python more future-proof for fast, modern applications. ♻️ Share it with your network if you find it useful, and follow Mayank Sultania for more practical AI tips. Video by: DailyDoseofDS.com #Python #Concurrency #GIL #Python314 #Developers #Performance
To view or add a comment, sign in
-
This comprehensive guide covers the essentials of parsing, manipulating, and generating JSON in Python. JSON is a crucial format for data exchange in various applications, making this knowledge invaluable for developers. I found it particularly interesting how this article highlights practical examples that can enhance our day-to-day work with APIs. What are your go-to resources for mastering JSON and API interactions?
To view or add a comment, sign in
-
Just tackled a fun little code challenge 💻: generating a contiguous string of integers from 1 to n (e.g., 5 -> "12345"). While the solution itself is concise, the choice of implementation is a great discussion point for **performance and memory management** in Python. My pythonic solution uses the incredibly efficient **str.join()** method along with a **generator expression**: ```python def sequence(n: int) -> str: return "".join(str(num) for num in range(1, n + 1)) ``` This one-liner is both highly readable and guarantees **optimal time complexity** O(N) (where N is the length of the final string). 🤿 Technical Deep Dive: Generator vs. List Although the time complexity remains **O(N)** whether you use the list comprehension or the generator expression with str.join() the core difference between my solution and the common alternative (**"".join([str(num) for num in range(1, n + 1)])**) is how memory is handled. For joining sequences of strings in Python, the choice between a list comprehension and a generator expression primarily impacts memory efficiency when dealing with data at a larger scale. For small datasets, the performance of both methods is virtually identical. The time complexity for both solutions is O(N), where N is the total length of the final concatenated string (e.g., for n=10, N=11 for "12345678910"). However, when processing large datasets where **n** is substantial, the list comprehension becomes significantly less efficient because it must build and store the entire intermediate list of strings in memory before the **str.join()** operation can even begin, resulting in an **O(N)** memory footprint that can be massive. In contrast, the generator expression is much more efficient because it creates a lightweight iterator that yields one string at a time as **join()** requests it, resulting in a minimal, near **O(1)** memory overhead (excluding the final output string). What other coding techniques do you use to conserve memory in Python? Let's discuss! 👇 Find the full code on my GitHub: https://lnkd.in/gwqy5_n5 Go to freeCodeCamp's daily coding challege to solve it yourself. While you're there checkout their Certified Full Stack Developer Curriculum: https://lnkd.in/g7i6Tc5s #CodingChallenge #Python #DataStructures #Algorithms #SoftwareDevelopment
To view or add a comment, sign in
-
When Your Python Environment Turns Into a Mess — And How I Fixed Mine Ever stare at your terminal in pure confusion? Yesterday, your code worked perfectly. Today? Errors everywhere. 🤦♂️ "Everywhere go first BLURRRRRRRRRRRRRRRRRR!!! " like a popular Nigerian mantra #laughingoutloud Welcome to the world of environment conflicts; Python's sneaky way of humbling developers. What's an Environment? Think of your Python environment like a kitchen. Each package (pandas, langchain, anthropic) is an ingredient you install to "cook" your app. Now imagine mixing ingredients from different recipes , adding cake baking soda into your stew. Disaster, right? That's what happens when packages clash. The Problem One project needs httpx==0.24.1. Another needs httpx==0.28.1. Python picks one version and crashes the other project. You'll see weird errors like: TypeError: Client.__init__() got unexpected keyword argument 'proxies' I've been there. One innocent pip install silently broke three other projects. 😅 Why This Happens By default, Python installs packages globally ; shared by every project. Update one library? You just affected everything on your machine. The Solution: Virtual Environments Virtual environments (venv) are like mini kitchens for each project. What you install inside, stays inside. Create one: bash python -m venv venv Activate it: bash # Windows: venv\Scripts\activate # Mac/Linux: source venv/bin/activate Install packages: bash pip install langchain anthropic No more clashes. Clean. Isolated. Beautiful. ✨ My Emergency Fix When things break: Create fresh venv: python -m venv venv_new Reinstall dependencies: pip install -r requirements.txt Test immediately Key Lessons Always work in virtual environments (never system-wide) Keep requirements.txt updated Test after every library upgrade Bottom Line Environment conflicts are invisible landmines. One small update triggers chaos. Once I mastered isolation, panic attacks stopped. Now I just smile at tracebacks — because I know exactly where to look. 😎 We've all broken projects learning this. You're not alone. 🚀 #learn #data #analytics #dataliteracy #python #DataAnalysis #DataScience #python #programming #coding #software #engineer #problem #solver #saturday #weekend #tips #mentorship #AI #ArtificialIntelligence #AItools #TechTrends #LinkedInPoll
To view or add a comment, sign in
-
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development
I've used python a bunch in my Ai boot camp its pretty handy for a lot of backend projects !