Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
I am encountring the following issue. When creating a brand new environment in conda and installing
pip
, the default version of
python3
is switched from
3.7
to
3.8
. Why is this and how can I avoid this? The exact steps are below.
Thank you
conda create -n myenv
conda activate myenv
# python3 --> python3.7.4
conda install pip
# python3 --> python3.8.2
# pip -V --> pip 20.0.2 from /mypath/conda/miniconda3/envs/myenv/lib/python3.8/site-packages/pip (python 3.8)
You never installed python
explicitly into your new env, so what you see after conda activate myenv
is still the same python from your base env. Now when you do conda install pip
, conda
recognizes that python
is a requirement of pip
and therefore downloads and installs python (also check the output of the conda install pip
call, where it will list python
under the The following NEW packages will be INSTALLED
). Since it has no further info, it just grabs the latest one. So your python version is never actually changed, there just never was a python in your venv when you created it.
To fix, explicitly install python into your environment with required version when creating it:
conda create -n myenv python=3.7
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.