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.
Related
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.
I'm running installing a conda env:
conda env create -f python/env/foobar.yml && . "$(conda info --base)/etc/profile.d/conda.sh" && conda activate foobar
Then running the python command:
/usr/local/envs/foobar/bin/python foobar.py
This command works locally (macos) but for some reason in the github ci (ubuntu), this gives the following error:
"Cannot run program "/usr/local/envs/foobar/bin/python": error=2, No such file or directory"
Why is this not working?
Generally, I would not recommend directly pointing at binaries in Conda environments as shown. This is because environments often have activation steps that set shell variables, and expected behavior of binaries can be dependent on those settings.
Typically, users activate the environment, then allow the software to be resolved by the shell. Something like,
conda activate foobar
python foobar.py
Alternatively, the conda run command allows for executing within an environment without manipulating the active shell. For example,
conda run -n foobar python foobar.py
Note that conda run defaults to buffering output (i.e., not interactive), but there are flags (see conda run -h) that can enable alternative modes.
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
There seem to be other similar questions, but none that seem to be exactly this.
I have created a conda install on a machine. I want to create the exact same install on a 2nd machine. I could export the environment and then create an environment using that exported information. But in all the examples, I'm creating an environment that is a clone of the root. Not a new root that is a clone of the root.
So how to I create a true clone of a conda install? The idea would be
Export the environment of the root on machine 1
conda [something...] > configuration.yml
Install miniconda using Miniconda....sh on machine 2
Recreate the original environment
conda [install all the stuff including enironments] configuration.yml
I can't seem to find any explicit instructions for doing this. The closest I found suggests:
conda env export > environment.yml
conda env update -n root -f environment.yml
However the first command draws an error:
balter#server:/home/.../Applications$ conda env export > environment.yml
CondaEnvException: Conda Env Exception: Unable to determine environment
Please re-run this command with one of the following options:
* Provide an environment name via --name or -n
* Re-run this command inside an activated conda environment.
balter#server:/home/.../Applications$ conda -h
usage: conda [-h] [-V] command ...
conda is a tool for managing and deploying applications, environments and packages.
Options:
...
...
One of the posts I found on the interwebs discusses two points that I'm unclear about:
1) Whether pip installs also carry over, and
2) The difference between
conda env create
and
conda create
Conda environments exist as an easy solution to this sort of problem. However, it is possible to do what you ask.
Step 1: confirm you are in the root environment on the first machine, then export a list of the installed packages:
$ source activate root
$ conda list -e > root.yml
Step 2: on the other machine, download and install Miniconda, then install the packages from root.yml:
$ wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
$ bash Miniconda3-latest-Linux-x86_64.sh
$ conda install --file root.yml