I installed a Conda environment in a Ubuntu terminal to do some bioinformatic process.
At the begining I was working in the Ubuntu terminal, now i want to improve the process combining bash and python usind Spyder 4.2.5 IDE, so i would like to activate my environment but I got a wrong.
I try to activate with the next comand:
Conda activate MY-ENV
I got the next message:
To initialize your shell, run
$ conda init <SHELL_NAME>
Currently supported shells are:
- bash
- fish
- tcsh
- xonsh
- zsh
- powershell
See 'conda init --help' for more information and options.
IMPORTANT: You may need to close and restart your shell after running 'conda init'.```
I tried to use "$ conda init <SHELL_NAME>" but i got the same result.
Related
I'm on a mac, and I'm trying to download a software called DLITE (which can be found here https://github.com/AllenCellModeling/DLITE). However, the instructions provided don't work I'm using Anaconda, and when I try and activate the environment that I've created, I get the following error message :
conda init dlite
ArgumentError: Invalid shells:
dlite
Currently available shells are:
bash
fish
powershell
tcsh
xonsh
zsh
I haven't used Anaconda or python much before, and I have no idea what to do to fix this, although I've tried a few things.
$ conda create --name dlite python=3.7
$ conda activate dlite
The command above will create the environment (as written in the dlite tutorial.
$ git clone https://github.com/AllenCellModeling/DLITE.git
$ cd DLITE
$ pip install -e .[all]
This will install the needed packages.
Hope this helped.
I was trying to install miniconda and use it but I get issues on Mac Os. I use their official installation dmg (https://docs.conda.io/en/latest/miniconda.html) and used that to install miniconda. It install it in ~./opt. Then I do:
conda init bash
it says nothing was changed:
(base) brandBrandoParetoopareto~/automl-meta-learning $ conda init bash
no change /Users/brandBrandoParetoopareto/opt/miniconda3/condabin/conda
no change /Users/brandBrandoParetoopareto/opt/miniconda3/bin/conda
no change /Users/brandBrandoParetoopareto/opt/miniconda3/bin/conda-env
no change /Users/brandBrandoParetoopareto/opt/miniconda3/bin/activate
no change /Users/brandBrandoParetoopareto/opt/miniconda3/bin/deactivate
no change /Users/brandBrandoParetoopareto/opt/miniconda3/etc/profile.d/conda.sh
no change /Users/brandBrandoParetoopareto/opt/miniconda3/etc/fish/conf.d/conda.fish
no change /Users/brandBrandoParetoopareto/opt/miniconda3/shell/condabin/Conda.psm1
no change /Users/brandBrandoParetoopareto/opt/miniconda3/shell/condabin/conda-hook.ps1
no change /Users/brandBrandoParetoopareto/opt/miniconda3/lib/python3.7/site-packages/xontrib/conda.xsh
no change /Users/brandBrandoParetoopareto/opt/miniconda3/etc/profile.d/conda.csh
no change /Users/brandBrandoParetoopareto/.bash_profile
No action taken.
but then when I try to start a new bash session it says their are issues:
(base) brandBrandoParetoopareto~/automl-meta-learning $ bash
CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
To initialize your shell, run
$ conda init <SHELL_NAME>
Currently supported shells are:
- bash
- fish
- tcsh
- xonsh
- zsh
- powershell
See 'conda init --help' for more information and options.
IMPORTANT: You may need to close and restart your shell after running 'conda init'.
brandBrandoParetoopareto~/automl-meta-learning $
and then deactivates my previous environment. Why is that?
There is definitively something wrong with this miniconda because when I do:
python script.py
it says there is a syntax error which means its using a different version of python despite me telling my env to use python3.7 why? Why doesn't it use the version I said?
Related question with nearly no details: conda init not initialising new shell
As far as I know the best thing is to not trust installations blindly, specially if they modify your files (since figuring out if they are changing your bash code correctly is equivalent to the halting problem). So read the output of the installation and conda init <Shell> carefully. For more detail see this: Why is conda init updating my .bash_profile incorrectly?
I have already created my own environment using conda in linux. When I check conda info --envs, it gives a list of environment like
# conda environments:
#
base * /home1/sriparna/anaconda3
copy_Env_deepgo /home1/sriparna/anaconda3/envs/copy_Env_deepgo
deepgo_2 /home1/sriparna/anaconda3/envs/deepgo_2
deepgo_3 /home1/sriparna/anaconda3/envs/deepgo_3
enzy /home1/sriparna/anaconda3/envs/enzy
parth /home1/sriparna/anaconda3/envs/parth
protein_struc /home1/sriparna/anaconda3/envs/protein_struc
py2 /home1/sriparna/anaconda3/envs/py2
But I cant activate a particular environment. e.g. when I tried conda activate parth it shows
CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
To initialize your shell, run
$ conda init <SHELL_NAME>
Currently supported shells are:
- bash
- fish
- tcsh
- xonsh
- zsh
- powershell
See 'conda init --help' for more information and options.
IMPORTANT: You may need to close and restart your shell after running 'conda init'.
Please help me regarding this.
This worked for me:
source {path_to_anaconda}/anaconda3/etc/profile.d/conda.sh
conda activate parth
Conda is not initialized in your shell. Run the following commands in an interactive shell,
conda init
Conda will detect the type of your shell, and write init scripts into the shell's configuration file. (Running it once is enough.)
Detail
Conda updated its environment activation after 4.6.
Quote from conda 4.6 release log
Conda 4.4 allowed “conda activate envname”. The problem was that setting up your shell to use this new feature was not always straightforward. Conda 4.6 adds extensive initialization support so that more shells than ever before can use the new “conda activate” command. For more information, read the output from “conda init –help”
In previous conda, the binaries installed by the default env "base" are exposed into the shell.
After conda init is introduced in conda 4.6, conda only expose command
conda into the PATH. And environment switch is unified by conda activate env-name and conda deactivate on all platforms. But to make these commands work, you have to do an additional initialization with conda init.
Read the conda 4.6 release log for more detail.
I had installed anaconda in Ubuntu VM environment but base was not loading, tried adding the PATH to .bashrc, didn't solve as Conda:not found was error.
Then I solved through:
Press F1>>Terminal: Select Default Profile
You might have available options :
bash
fish
tcsh
xonsh
zsh
powershell
Choose YOUR_SHELL_NAME
Run:
eval "$(/home/mishra/anaconda3/bin/conda shell.YOUR_SHELL_NAME hook)"
#example
eval "$(/home/mishra/anaconda3/bin/conda shell.bash hook)"
Immediately (base) will show
The source activate command in conda is suddenly no longer working for me. When I type source activate py3 in my Mac terminal, I get this error -bash: _conda_activate: command not found.
I recently created a new conda environment for TabPy (Tableau python server); I'm not sure if that changed anything. I have checked that the conda environments I'm trying to activate exist by using conda info --envs, here is that output:
# conda environments:
#
base * /Users/applemacbook/anaconda
Tableau-Python-Server /Users/applemacbook/anaconda/envs/Tableau-Python
Server
py3 /Users/applemacbook/anaconda/envs/py3
I already have the following in my bash profile from my initial installation of anaconda awhile ago export PATH="/Users/applemacbook/anaconda/bin:$PATH".
Based on some comments from related threads, here is some additional information:
The output of which conda is /Users/applemacbook/anaconda/bin/conda.
The output of type source is source is a shell builtin.
The output of which activate is /Users/applemacbook/anaconda/bin/activate.
When I was in Ubuntu installing Anaconda and activating a virtual environment modified my prompt to look like that:
(current-env)user#machine:dir
or as you define in .bashrc.
Now that I installed Anaconda in MacOS my prompt remain the same. I tried to configure that from Anaconda doing:
conda config --set changeps1 no
but nothing changed.
How can I modify my .bash_profile to have the current environment in PS1?
I managed to have that changing my shell from bash to zsh.
You can install zsh from here.
In recent versions, Conda has provided automated configuration for a number of shells via the conda init command. This command will edit relevant .*rc files to enable such features of PS1 change. Please see conda init --help for details.