To install to my own directory I can use
pip install --user package
Alternatively I can use
conda install package
How do I ask conda
to install to my home directory since conda does not take a --user
flag?
To install to my own directory I can use
pip install --user package
Alternatively I can use
conda install package
How do I ask conda
to install to my home directory since conda does not take a --user
flag?
See -p
option here:
-p PATH, --prefix PATH
Full path to environment prefix.
So to install to, say, local
under your home directory, do:
conda install -p $HOME/local packagename
Note, however, this is not a "clean" install as it adds a bunch of conda-related files.
To install conda packages on your own directory you can follow these steps:
Create a blank environment
conda create -y -n my-conda-env
Replace the name my-conda-env
with any name you want to give the environment.
Activate the environment
source activate my-conda-env
Don't forget to replace my-conda-env
with the name you gave the conda environment from the previous step
Install your package
conda install -c bioconda epa-ng
And that's it, the package should be installed on your own directory
Simply:
sudo conda install -c conda-forge package
Or:
sudo chmod -R 777 ./
conda install -c conda-forge package
I don't know of an exact match for the --user flag, but a reasonable analogue is to use a virtual environment.
What I do when I have to install to a shared CentOS server where I don't have admin access:
First I run
conda env list
will list all conda virtual environments and display the path to each. Once you have the environment created and can see it in the conda env list
, copy the path to the environment.
If you need to create one, you can do that with conda create
or by running anaconda-navigator
and using the GUI.
Activate your environment (if not active) with
conda activate [environment_name]
or
activate [environment_name]
depending on your system (most linux systems use the first, Windows and CentOS use the latter).
Now you can use
conda install -p [environment_path] [package_name]
and you are off to the races.
This is really a work around; it's not the best but it does install the package to the selected virtual environment.
The current Anaconda Install Individual Edition, when run in a linux local account, installs in a local directory. So all the subsequent installs should install there, too.
Besides the method mentioned by Andrey Portnoy, you can also define the default environment path in the .condarc
file.
You can check the environment directories conda
currently uses by checking the key envs directories
with
conda info
When creating a new named environment, conda will place the environment in the first writable environment in the list.
So, to change my default environment path, I have added the following lines to my .condarc
file in my $HOME
directory.
envs_dirs:
- /Users/myusername/.conda/envs
- /usr/local/Caskroom/miniconda/base/envs
According to the documentation:
--use-local