How do I change a python package version in just a specific environment?

Question:

I initially have pandas==1.5 both in my base environment, and in a specific environment

enter image description here

For a project’s purpose, I had to downgrade my pandas version in my project environment to version 1.4. However, when I downgraded the pandas version in that environment, the version in my base environment got downgraded as well.

enter image description here

Why is this so, and how can I keep my package version downgrade to just a specific environment?

Asked By: wanderingcatto

||

Answers:

pip install ‘package-name’==2.1.0

You can use above command

Answered By: Yash Jani

Can you try to installing your packages through Conda rather than pip since you’re activating your environment through Conda itself.

conda install pandas=1.4.4

Remove the existing package and keep the latest one as you had earlier in both base and inside your environment. Then try to downgrade through conda.

You could read up more here, on using pip inside conda environment.

Answered By: Kulasangar
Categories: questions Tags:
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.