The sleight-of-hand trick that can simplify scientific computing – Nature.com
Research software is like the tower-building game Jenga tools atop tools atop tools. When developers tweak their individual pieces, this can change the function of the software that depends on them, potentially altering results or causing the software to fail.
Version 3.6.0 of the R programming language, for instance, introduced a replacement algorithm for generating random numbers. This and the older algorithm both work, but not in the same way. If you ran the same code with an older version of R and a newer version of R and it was using any function that needed to generate a random number, you would end up getting different results, says Tiffany Timbers, a data scientist at the University of British Columbia in Vancouver, Canada.
Among other things, that kind of variability can complicate collaboration (see Environmental testing). In 2020, Mine etinkaya-Rundel was working with another author on a statistics textbook, using R and a formatting language called R Markdown to calculate numbers, create figures and format the final document. We wanted to make sure that we were using the same versions, says etinkaya-Rundel, a statistician at Duke University in Durham, North Carolina, and also that when we re-render the book, were rendering it with a given version of the packages. If not, the two authors could have generated slightly different manuscripts.
An example of how variable computing environments can hinder collaboration.
Suppose you have the latest versions of R and Python installed, but your collaborator has been slower to upgrade. They want to share a Python script with you, and you have an R program you want them to use. Will the code work in each others hands?
Between Python 2 and Python 3, the print command that outputs text to the screen changed. The directive print hello, world! is valid in Python 2, but Python 3 requires parentheses print (hello, world!). Similarly, before R 4.0, the function that creates spreadsheet-like data tables treated text as discrete factors by default, whereas later versions do not.
To highlight these differences, we created scripts and environments for Python 2.7, Python 3.11, R 3.6 and R 4.2 (see go.nature.com/4tirjm7). Following the instructions (see go.nature.com/4tnd5ke), install conda. Then, open a terminal window, run the set-up script and execute run.sh. You should see the code working correctly in one environment but not in the other. For instance, although the R script behaves as intended in R 4.2 it changes the gender of a study subject it does something unexpected (and issues a warning) in R 3.6.
To address that challenge, they turned to the R package renv, one of a small group of tools that help developers and researchers to manage their computational environments; other options include venv and virtualenv for Python, and conda, a language-agnostic tool. Most are command-line utilities, although renv is tightly integrated with the RStudio Desktop graphical programming environment. All can help researchers to ensure that their code is reproducible, reusable, documented and shareable.
C. Titus Brown, a bioinformatician at the University of California, Davis, has 187 conda environments on his laptop. Most are one-offs, used to test new tools or to illustrate a point during lectures. His day-to-day work mostly takes place in a development environment that includes a specific version of Python and other programming tools.
Some tasks, however, require a change of computational scenery. For instance, Brown writes blog posts in Markdown, which he renders into HTML, the standard markup language for web pages. But the code that performs that step doesnt work well with newer versions of a crucial software library, and older versions conflict with his development tools. To isolate the problem, Brown created a separate environment. I just fixed the version to something really old that still works, and I run [the rendering software] there, he says.
NatureTech
A conda environment is a computational sleight-of-hand, says Johannes Kster, a computer scientist at the University of Duisburg-Essen in Germany, who founded a bioinformatics-focused software repository called Bioconda. Basically, its just modifying your system path the place where your system searches for executable [applications]. You might have multiple versions of a tool installed, but when conda activates a particular environment, your computer can only see the one you want.
Computational environments offer several benefits, says Timbers. One is reproducibility the ability to analyse the same data with the same software on the same computing infrastructure to get the same results.
It can be very frustrating, tracing down the differences between outputs across different computers, says Ben Marwick, an archaeologist at the University of Washington in Seattle. Some research projects take years to complete, he notes. And although Marwick prefers the newest libraries, his colleagues dont always upgrade at the same pace. Renv ensures that he and his collaborators always run their project codes in the same way. The resulting environment-description file can be version-controlled and shared on GitHub. Collaborators can recreate the environment using the command renv::restore()Conda is a command-line tool that both creates environments and installs software into them. To create a new environment called my_env pinned to a specific version of Python, for instance, use conda create --name my_env python=3.9
Both R and conda allow users to install their own tools rather than having to ask system administrators to do it for them. You dont need root privileges, says Rob Patro, a computational biologist at the University of Maryland in College Park. This is a useful feature when working on shared computing resources.
Environment managers also make software installation easier. Scientific software is often released as source code, which might need to be compiled, configured and installed in a specific location. It might have a network of dependencies, written in multiple programming languages, that must be installed in a particular order. Sometimes, says bioinformatician Fredrik Boulund at the Karolinska Institute in Stockholm, the process can be beyond users skills. That completely changed when solutions like conda entered the scene, he says. Installing a complex set of dependencies is simply reduced to asking conda to create an environment according to an environment specification file.
Cut the tyranny of copy-and-paste with these coding tools
For the Galaxy project an open-source framework for reproducible data analysis those features were a key reason for choosing conda as the projects software installation manager. Bioinformatician Bjrn Grning, who runs the European Galaxy server at the University of Freiburg in Germany, says that the Galaxy community started searching for a cohesive tool-installation strategy in around 2015 because its existing, manual approach was unsustainable. Conda ticked all our requirement boxes, Grning says. It doesnt need root privileges; it is programming-language agnostic; and it uses human-readable package recipes that are easy to understand and maintain. Today, there are more than 9,000 bioinformatics tools available to Galaxy users through the Bioconda channel.
Perhaps the biggest benefit to environments, however, is isolation: environments enable researchers to explore new or updated tools while knowing that their code will still run.
Elana Fertig, a statistician at Johns Hopkins University in Baltimore, Maryland, describes herself as lax when it comes to environments: For me, everything goes in one environment. But larger environments are harder to use, because the environment manager has to resolve a larger network of dependencies to install new tools. (Conda is notorious for poor performance with large environments, but a drop-in resolver called mamba accelerates the process.) Instead, Fertig suggests that her students use one environment per project.
Indeed, most researchers contacted for this article recommend creating environments to accommodate specific workflows or projects and to do so early on. Start your project with a package-management solution in mind, says Joshua Shapiro, senior data scientist at the Childhood Cancer Data Lab for Alexs Lemonade Stand Foundation, based in Wynnewood, Pennsylvania. It has the potential to save a lot of headaches down the line.
Challenge to scientists: does your ten-year-old code still run?
Tommy Tang, director of computational biology at Immunitas Therapeutics, a biotechnology company in Waltham, Massachusetts, uses dedicated environments for different computational tasks processing data from RNA sequencing or working in Google Cloud, for instance.
Users of the Snakemake and Nextflow computational workflow managers can even direct those tools to execute each step in a separate conda environment, says Kster, who leads Snakemake development. Make them as fine-grained and as single-purpose as possible, he advises. Besides being easier to maintain, he explains, small environments are also more transparent. People who want to understand what the analysis actually did immediately see what software stack was used for which step.
Still, environments cant do everything. Tools written in languages such as C, Perl and Fortran can be hard to encapsulate into environments, and dependency differences can make environments difficult to port across operating systems. In that case, users can try software containers, such as those from Docker and Singularity.
Containers, which essentially package a tool with its underlying operating system, are larger and more complicated than environments, but are more portable. They are also easier to share, because although an environment can hold thousands of files, a container has only one. On high-performance systems in which jobs can be run in parallel across hundreds of computing cores, transferring many small files can affect performance.
Computational environments, says Timbers, are the forgotten child of reproducibility. Journals increasingly ask for code and data alongside manuscripts, but full reproducibility requires knowing the environment in which they were run. Its the elephant in the room, she says.
View post:
The sleight-of-hand trick that can simplify scientific computing - Nature.com
- Theres a physical version of the AI singularity, and it matters a lot - The Economist - October 2nd, 2026 [October 2nd, 2026]
- Tech CEOs Say the AI Singularity May Have Already BegunHeres What Happens Next - Popular Mechanics - October 2nd, 2026 [October 2nd, 2026]
- Introducing Posting Through the Singularity - Lawfare - October 2nd, 2026 [October 2nd, 2026]
- The AI Singularity Syllabus - The Ringer - September 26th, 2026 [September 26th, 2026]
- PAX West 2026: Cell to Singularity Hands-On Preview - Hey Poor Player - September 26th, 2026 [September 26th, 2026]
- What is the AI singularity? Some experts say its closer than ever - The Hill - September 24th, 2026 [September 24th, 2026]
- A renowned computer scientist once skeptical of the AI singularity now says humanity is 'certainly at risk' - Business Insider - September 24th, 2026 [September 24th, 2026]
- Future Schlock: A Guide to the Singularity - advisorperspectives.com - September 24th, 2026 [September 24th, 2026]
- Jay Stull's THE SINGULARITY PLAY to be Presented at Actors' Theatre Grand Rapids - BroadwayWorld - September 24th, 2026 [September 24th, 2026]
- MINISTRY Warns Of The Robotic Takeover On New Single Singularity; Music Video - BraveWords - September 24th, 2026 [September 24th, 2026]
- The US discusses the approach of the AI singularity The Hill - UA.NEWS - September 24th, 2026 [September 24th, 2026]
- MINISTRY Warns Of The Robotic Takeover On New Single Singularity From Final Album Hate To Go (Take Out Or Delivery) - Sonic Perspectives - September 24th, 2026 [September 24th, 2026]
- Ministry Debut "Singularity" As The Third Single From Their Upcoming Farewell Album - Theprp.com - September 24th, 2026 [September 24th, 2026]
- MINISTRY Warns Of Robotic Takeover On New Single 'Singularity' From Final Album 'Hate To Go (Take Out Or Delivery)' - BLABBERMOUTH.NET - September 24th, 2026 [September 24th, 2026]
- Singularity AMC Invests INR 120 Crore in Bodycraft Clinic and Salon for Expansion - globallegalchronicle.com - September 24th, 2026 [September 24th, 2026]
- BP takes big stake in Medcast in search of knowledge singularity - healthservicesdaily.com.au - September 24th, 2026 [September 24th, 2026]
- What Is Driving Attention Around Singularity Future Technology (SGLY)? - kalkinemedia.com - September 13th, 2026 [September 13th, 2026]
- Ashes of the Singularity 2 Free Playtest Launched - DSOGaming - September 13th, 2026 [September 13th, 2026]
- Recursive Self-Improvement and Agentic AI: Fear of the AI Singularity - HackerNoon - September 13th, 2026 [September 13th, 2026]
- Ethereum's "Proof Singularity": Real Technology, Inflated Narrative! EIP-8288 - Moomoo - September 13th, 2026 [September 13th, 2026]
- Singularity of the Mind by Nicholas Cristiano Gains Momentum as R - The National Law Review - September 13th, 2026 [September 13th, 2026]
- Fallout From the Singularity Confronts AI, Alien Contact, and Humanity's Uncertain Future - EIN Presswire - September 13th, 2026 [September 13th, 2026]
- Elon Musk: Mass Production of Humanoid Robots Will Trigger an Economic Singularity Global GDP to Double Within a Decade - finance.biggo.com - September 13th, 2026 [September 13th, 2026]
- What Is The Singularity And Are We There Yet? - bernardmarr.com - September 2nd, 2026 [September 2nd, 2026]
- Have we reached the AI singularity? - Yahoo Tech - August 31st, 2026 [August 31st, 2026]
- Have we reached the AI singularity? - Yahoo News UK - August 27th, 2026 [August 27th, 2026]
- Stripe didnt really buy OpenRouter because of the singularity - TechCrunch - August 25th, 2026 [August 25th, 2026]
- Stripe says the singularity has arrived. Here's what they told investors about it. - Business Insider - August 25th, 2026 [August 25th, 2026]
- What If This Was How You Found Out The Singularity Has Begun? - Gizmodo - August 25th, 2026 [August 25th, 2026]
- Stripe's 'Singularity' And The Divergence From Adyen - Seeking Alpha - August 25th, 2026 [August 25th, 2026]
- Singularity Future Technology Raises $6.8 Million in Two Registered Direct Offerings; Ends Allocation Right - TradingView - August 25th, 2026 [August 25th, 2026]
- Have we reached the AI singularity? - The Week - August 25th, 2026 [August 25th, 2026]
- Singularity Spectre Limited Edition: $2,000 Case Integrates Water Cooling, PowerBoard, and PCIe 5.0 - igorsLAB - August 25th, 2026 [August 25th, 2026]
- Stripe Dates The Singularity To Jan. 1 And Prices It At $8 Billion - Forbes - August 25th, 2026 [August 25th, 2026]
- Stripe Agrees to Buy OpenRouter as It Embraces The Singularity - galaxy.com - August 25th, 2026 [August 25th, 2026]
- Stripe declares we're living in the singularity and uses it as a reason not to IPO - the-decoder.com - August 25th, 2026 [August 25th, 2026]
- Sam Altman says we are in the singularity: 'This is the moment' - AOL.com - August 25th, 2026 [August 25th, 2026]
- GTM singularity is forcing RevOps teams to audit how AI intermediaries describe their products - MarketScale - August 25th, 2026 [August 25th, 2026]
- The Singularity and Externalities - SchiffGold.com - August 25th, 2026 [August 25th, 2026]
- Stripe Letter to Investors: The Singularity Has Arrived, Strategic Thinking Behind the OpenRouter Acquisition - TechFlow - August 25th, 2026 [August 25th, 2026]
- Stripe Says AI Singularity Arrived in January as Company Steps Up Bet on AI Economy - Tekedia - August 25th, 2026 [August 25th, 2026]
- Singularity Future Technology Ltd. Announces Pricing of $5.0 Million Registered Direct Offering Priced At-The-Market Under Nasdaq Rules - The Manila... - August 25th, 2026 [August 25th, 2026]
- OpenAI's Sam Altman Says the AI "Singularity" Has Arrived. Here's What That Could Mean for Nvidia and Microsoft Stock. - finance.yahoo.com - August 11th, 2026 [August 11th, 2026]
- Sam Altman Says Were in the Singularity With AI. Heres Why Hes Wrong. - SingularityHub - August 9th, 2026 [August 9th, 2026]
- Welcome to the singularity: AI's architects say the next era of human history is here - Axios - August 9th, 2026 [August 9th, 2026]
- I'm a co-creator of Alexa and an AI expert. If AI singularity ever arrives, everyone will notice heres how. - businessinsider.com - August 9th, 2026 [August 9th, 2026]
- I'm a co-creator of Alexa and an AI expert. If AI singularity ever arrives, everyone will notice heres how. - Yahoo Tech - August 9th, 2026 [August 9th, 2026]
- OpenAI's Sam Altman Says the AI "Singularity" Has Arrived. Here's What That Could Mean for Nvidia and Microsoft Stock. - fool.com - August 9th, 2026 [August 9th, 2026]
- Beyond the Singularity: China owning the physical AI revolution - Asia Times - August 5th, 2026 [August 5th, 2026]
- What Is The Singularity And Are We There Yet? - Forbes - August 5th, 2026 [August 5th, 2026]
- We are living the singularity: why this bold claim is freaking experts out - Futura, le mdia qui explore le monde - August 5th, 2026 [August 5th, 2026]
- What Is the AI Singularity? Why Standards Matter - The ANSI Blog - August 5th, 2026 [August 5th, 2026]
- Dont believe Sam Altman, were not in the AI Singularity - Asia Times - August 5th, 2026 [August 5th, 2026]
- Sam Altman says were in the singularity with AI. Heres why hes wrong - The Conversation - August 5th, 2026 [August 5th, 2026]
- We are already in the midst of the singularity. - 36 Kr - August 5th, 2026 [August 5th, 2026]
- Are we already in the AI singularity? The moment that could make humans obsolete - The Independent - August 5th, 2026 [August 5th, 2026]
- 7 Books That Imagine What Happens After the Singularity - Mental Floss - August 5th, 2026 [August 5th, 2026]
- The singularity and our institutions: What must change? - omanobserver.om - August 5th, 2026 [August 5th, 2026]
- As Sam Altman Celebrates the Singularity, Palantir CEO Alex Karp Warns: There Are Dangers We Are Going to End Up Having to Regulate AI - Yahoo Finance - August 5th, 2026 [August 5th, 2026]
- Forget the Singularity: Universal AI Surveillance Is Here - rstreet.org - August 5th, 2026 [August 5th, 2026]
- OpenAI's Sam Altman says that we've reached the 'singularity' - Yahoo - August 5th, 2026 [August 5th, 2026]
- After OpenAI said its AIs broke out, Sam Altman says 'we are now in the singularity' - The Cool Down - August 5th, 2026 [August 5th, 2026]
- SA experts split on whether the singularity has begun - TechCentral - August 5th, 2026 [August 5th, 2026]
- Elon Musk says 'we are in the singularity,' agrees with Sam Altman - The News International - August 5th, 2026 [August 5th, 2026]
- If The AI Singularity Is Here, Where Is The Evidence? - Forbes - July 28th, 2026 [July 28th, 2026]
- OpenAI CEO Sam Altman claims AI singularity has arrived - ABC News - Breaking News, Latest News and Videos - July 28th, 2026 [July 28th, 2026]
- Sam Altman says we are in the singularity: 'This is the moment' - Business Insider - July 28th, 2026 [July 28th, 2026]
- Sam Altman Says the Singularity Is Here. The Evidence Suggests Otherwise - inc.com - July 28th, 2026 [July 28th, 2026]
- OpenAIs Agent Hacked Hugging Face. Sam Altman Says the Singularity Is Here; Nvidia (NVDA), CrowdStrike (CRWD) Build the Defenses - Yahoo Finance - July 28th, 2026 [July 28th, 2026]
- Sam Altman says humanity already in the singularity, warns of AI authoritarianism - The Indian Express - July 28th, 2026 [July 28th, 2026]
- Sam Altman Says Were In The Singularity. What Does He Actually Mean? - Forbes - July 28th, 2026 [July 28th, 2026]
- Sam Altman Says We Hit The Singularity. No! He Just Forgot The Fence. - Forbes - July 28th, 2026 [July 28th, 2026]
- Sam Altman Saying That We Are In The Singularity Of AI Gets Lost In Translation - Forbes - July 28th, 2026 [July 28th, 2026]
- Why the singularity is trending | CNN Business - CNN - July 28th, 2026 [July 28th, 2026]
- Sam Altman thinks 'we are now in the singularity' and it's going to be 'awesome for the world' - PC Gamer - July 28th, 2026 [July 28th, 2026]
- 'We're already there': Sam Altman claims the singularity has arrived. Does everyone agree? - dev.ua - July 28th, 2026 [July 28th, 2026]
- OpenAI CEO Sam Altman Says AI Has Reached the Singularity - The National CIO Review - July 28th, 2026 [July 28th, 2026]
- OpenAI CEO Sam Altman Says Humanity Has Entered the 'Singularity.' What You Need to Know - July 27 - Central Oregon Daily - July 28th, 2026 [July 28th, 2026]
- Video OpenAI CEO on AI surpassing human intelligence: 'We are now in the singularity' - ABC News - Breaking News, Latest News and Videos - July 28th, 2026 [July 28th, 2026]
- In 6 Words, Sam Altman Just Claimed That Were Already in the Singularity - inc.com - July 28th, 2026 [July 28th, 2026]