On my Ubuntu I installed a fresh miniconda following the instructions from https://docs.conda.io/projects/conda/en/latest/user-guide/install/linux.html and downloading the .sh file from https://docs.conda.io/en/latest/miniconda.html#linux-installers (Python version= Python3.10; Name=Miniconda3 Linux 64-bit).
Everything seems to work fine. If I activate the base environment
conda activate base
I get, as expected, the following python executable
which python
~/miniconda3/bin/python
When I create a new conda env without specifying the python version
conda create -n myenv
And activate it
conda activate myenv
I see that the corresponding python points to the Ubuntu 'plain' (non conda) python
which python
/usr/bin/python
Instead of
~/miniconda3/envs/myenv/bin/python
Actually, if I
cd ~/miniconda3/envs/myenv
it's almost empty, except for a conda-meta folder, that contains only a file called 'history', containing the following two rows
# cmd: ~/miniconda3/bin/conda create -n env_test
# conda version: 23.1.0
Basically, the environment myenv that I just created is not an actual conda environment, it's just like a pointer to Ubuntu's python. (***)
But if I create a conda env SPECIFYING the python version (even the version 3.10.9, which is the python version of the conda base env), everything is fine
conda deactivate
conda create -n myenv2 python=3.10.9
conda activate myenv2
which python
I get, as expected, the path
~/miniconda3/envs/myenv2/bin/python
And now myenv2 works properly, as an isolated environment.
Is this behaviour expected? That is, I always have to specify the python version, even if it is the same as the base environment? Or there is a bug in my specific installation?
I had analogous (but different) problems on windows, see my related question here: conda create --name myenv entangled with base environment I start to think that the command "conda create" without specifying the python version is simply bugged.
(***)--------------- EDIT ----------------------
if I install any package with conda (e.g. conda install numpy, with the myenv environment activated), everything 'magically' fixes: all the typical folder structure of the conda environmet appears under ~/miniconda3/envs/myenv
and the package is installed in the myenv env and
which python
goves, as expected
~/miniconda3/envs/myenv/bin/python
I think this is a weird behaviour. An environment should be created correctly from the beginning and not after a conda install (someone may need to use a pip install before a conda install, and this wouldn't work)