How to downgrade Python from 3.7 to 3.5 in Anaconda
Interview Questions practice on Codemia
Over 8,000 real interview questions from top companies, searchable by company and role.
Introduction
With Conda, the safest way to "downgrade Python" is usually not to modify your current environment in place. It is to create a new environment that uses the older interpreter. That matters even more for Python 3.5, which is long end-of-life and may no longer be available with many current packages.
Prefer a New Environment Instead of Downgrading Base
If you simply need one project to run on Python 3.5, create a separate environment:
This is better than downgrading your base environment because:
- it does not break other projects
- it avoids dependency conflicts spreading across your setup
- it makes rollback trivial
Conda environments are designed exactly for this kind of interpreter isolation.
If You Must Downgrade an Existing Environment
It is possible to ask Conda to change Python inside an existing environment:
But this is riskier. Conda has to solve a new dependency graph, and packages that worked with Python 3.7 may not have compatible builds for Python 3.5. In practice, this is where downgrade attempts often fail or produce a heavily changed environment.
That is why "create a new environment" is usually the better answer than "downgrade this one in place."
Export Before You Change Anything
Before modifying an existing environment, export it:
That gives you a record of what was installed. If the solver changes more packages than expected, you have something to inspect or rebuild from later.
You can also list environments and package state:
This makes it easier to verify which environment you are actually changing.
Python 3.5 Availability Is the Real Problem
The command syntax is simple. The harder issue is that Python 3.5 is obsolete. Many modern channels and packages no longer publish builds for it. So the downgrade can fail even if your Conda commands are correct.
Typical problems include:
- solver conflicts
- packages with no Python 3.5 builds
- security and compatibility concerns
- channels no longer carrying older artifacts
That means a downgrade may require you to relax package versions or rebuild the environment around a much older dependency set.
A Practical Rebuild Strategy
If the target really must be Python 3.5, a cleaner approach is:
- create a fresh Python 3.5 environment
- install only the packages the project truly needs
- verify imports one by one
Example:
If a package is unavailable, that problem is easier to diagnose in a fresh environment than inside a downgraded one full of unrelated packages.
Know When Not to Downgrade
Sometimes the correct answer is not to downgrade at all. If the project only fails because of one library or one piece of code, upgrading that dependency or fixing the code may be better than forcing the whole environment back to Python 3.5.
This matters especially because Python 3.5 no longer receives normal security support. Running it should be a deliberate compatibility decision, not a default development choice.
Common Pitfalls
- Downgrading the base Conda environment instead of creating a project-specific one.
- Expecting all packages from a Python 3.7 environment to have Python 3.5 equivalents.
- Changing an existing environment without exporting a backup first.
- Assuming the failure is a Conda syntax issue when the real problem is package availability for Python 3.5.
- Treating Python 3.5 as a normal target instead of a legacy-compatibility target.
Summary
- In Conda, the safest "downgrade" is usually a new environment with
python=3.5. - In-place downgrades are possible but often create dependency conflicts.
- Export the current environment before changing anything important.
- The hardest part is often package availability, not the Conda command itself.
- Because Python 3.5 is long end-of-life, use it only when you truly need legacy compatibility.
Related reading
- How to download datasets for sklearn? - python
- How to download image using requests
- How to drop a list of rows from Pandas dataframe?
- How to drop rows of Pandas DataFrame whose value in a certain column is NaN
- How to drop rows of Pandas DataFrame whose value in a certain column is NaN
- How to dump a dict to a JSON file?
- How to dynamically create a class?
- How to dynamically load a Python class
.png&w=3840&q=75)
Tackling System Design Interview Problems
A short course that equips you with the skills to approach system design interviews methodically.
Start the free courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
Interview Questions practice on Codemia
Over 8,000 real interview questions from top companies, searchable by company and role.