I am new to python and I am trying to install new packages in Anaconda. I am using anaconda prompt and Windows 10.
Can you please explain what is the difference between conda install with -c anaconda and without it? For example conda install -c anaconda mysqlclient and conda install mysqlclient.
Which is better to use when and why?
conda, as you know is a package manager that can install packages to your machine. If you do conda install, it needs a place to search for these packages to download them from. For conda, this is solved with the concept of channels, which are, as #David Kabii has pointed out, like repositories that can exist either locally/a network location or be a url. By default, conda install will try to download packages from repo.anaconda.com, specifically on windows, these locations are searched by default:
https://repo.anaconda.com/pkgs/main/win-64
https://repo.anaconda.com/pkgs/main/noarch
https://repo.anaconda.com/pkgs/r/win-64
https://repo.anaconda.com/pkgs/r/noarch
https://repo.anaconda.com/pkgs/msys2/win-64
https://repo.anaconda.com/pkgs/msys2/noarch
More information on the difference can be found in the docs on using default repositories.
Now if you go to www.anaconda.org and search for a package, let's say numpy, you will see that it is available from different channels. You should only worry about those in case a package is not available from the default channels. This you can also check by running conda search <package name> which will list all available versions in the currently configured channels.
Coming to your question. The -c options specifies an additional channel to search first which is needed if a package is not available from default channels. E.g. some bioinformatics tools are only available by specifying -c bioconda. For those packages that are available from the default channels you should not specify anything and using -c anaconda will make no difference, as the anaconda channel is only a mirror of the default ones and should not be used (see the channel description):
This channel is used internally for mirroring. You should very much prefer https://repo.anaconda.com, which is conda's default and needs no "-c" setting.
When you use the -c option, you are specifying the channel from which to get the package. The default is -c anaconda, so they are similar. To use packages built locally, you would use -c local.
Here is a link for more info:
Docs explaining usage of conda install
Related
I have multiple issues installing packages with having both Python and Anaconda installed. I have now got a clean install of anaconda and previous PIP installations removed.
I am unable to install web3.py still, when installing via the Anaconda environment / VScode I receive this error:
PackagesNotFoundError: The following packages are not available from
current channels:
web3
Current channels:
https://conda.anaconda.org/mamba/osx-arm64
https://conda.anaconda.org/mamba/noarch
https://conda.anaconda.org/conda-forge/osx-arm64
https://conda.anaconda.org/conda-forge/noarch
To search for alternate channels that may provide the conda package
you're looking for, navigate to
https://anaconda.org
and use the search bar at the top of the page.
I can see it is available but receiving this message. Would really appreciate any insight.
I was expecting to install without issue via $
conda install -c conda-forge web3
Conda Forge does not default (yet) to building packages for osx-arm64 platform. Instead, users must request an osx-arm64 build by adding it to the migration list via a Pull Request (see documentation). This has now been done for web3, but will take time to get approved and processed.
In the meantime, alternatives are:
Install from PyPI.
Emulate an osx-64 environment using CONDA_SUBDIR environment variable. Similar procedure as this answer.
I've been using Anaconda for a few years now, but since I started using a Mac with a M1 processor I had to deal with a bunch of problem with the installation of some packages, which left me a little confused about some basic concepts.
For example, I was trying to install Tensorflow, and it turns out the proper way is to install miniforge, and get Tensorflow from the conda-forge channel (which is the default for miniforge), as explained here.
Then, I was wondering whether I could do the same using Anaconda/Miniconda...set up the conda-forge channel as default, and install Tensorflow (or any other arm-compatible package), but I've been told it's not possible
So, now I'm trying to understand how this all works.
If a Tensorflow version compatible with M1 processors exists in the conda-forge channel (and it does exist), why can't I install it by using Anaconda/Miniconda, after configuring it to use said channel? To phrase it in another way, what is the difference between Anaconda/Miniconda and Miniforge, other than the channels they look into for packages (and, as I understand, some licenses)?
Here there is a similar question, but the answers don't seem to address my main concern (why Anaconda/Miniconda with conda-forge as default channel is different than miniforge).
It's not impossible, but you'll have to jump through hoops to get it done.
First, if you have an Anaconda installation, you can't install conda-forge packages into the base environment consistently, because the anaconda package in the base environment of Anaconda will conflict with packages from conda-forge.
Second, since Anaconda is only x86_64 at the moment, you can only install it via Rossetta emulation. After that, you need to tell conda that you need arm64 compatible packages by setting the env variable CONDA_SUBDIR.
CONDA_SUBDIR=osx-arm64 conda create -n native numpy -c conda-forge
will get you a new env with native arm64 packages. However if you want to update this env, you have to prefix all your conda commands with CONDA_SUBDIR=osx-arm64.
To fix this permanently, you can do the following
conda activate native
conda config --env --set subdir osx-arm64
which will make conda use osx-arm64 for this environment.
I just tried to install some packages into a fresh environment. I tend to specify channels for each install e.g. conda install -c <channel> <package>, rather than using conda config --add channels <channel name>; conda install <package>. However, I found that certain packages could only be installed when using multiple channels at once. How can this work?
I think I have a fundamental misunderstanding of how packages and channels work. How can a package install require multiple channels? It was my understanding that a particular channel hosted particular packages, e.g. conda-forge hosts x packages and they (and their dependencies) are installable using just conda-forge.
Thanks for any help.
It was my understanding that a particular channel hosted particular packages, e.g. conda-forge hosts x packages and they (and their dependencies) are installable using just conda-forge.
That is not necessarily true. If there is a package that lower-level package that is required as part of an install, but it is only hosted on, perhaps, the default channels, it is often easier to just list it as a requirement than to try to get the originated to post it to multiple channels.
You can always chain together multiple channels in a single conda command as well.
conda install <package> -c defaults -c conda-forge -c <other channel>
I just upgraded XGBoost to its latest version (0.6). This is giving me all sort of problems with sparse matrices and would like to revert to the old version (0.4).
When I issue the following Ananconda says it can't find the package.
conda install -c anaconda py-xgboost=0.40
Is there a way from terminal to see what old versions of a package are available so that I can the choose one to use with the conda install command?
The command is conda search. You can also add channels to the search with the -c flag. This command only searches channels that you specify or channels configured in your configuration file.
Another option, if you prefer a GUI or an option that searches all available channels, is to use the https://anaconda.org website.
I want to install GSEApy on Anaconda (I use 64bit Windows 10).
https://bioconda.github.io/recipes/gseapy/README.html
https://anaconda.org/bioconda/gseapy
But I get this error:
C:\Windows\system32>conda install gseapy
Using Anaconda Cloud api site https:// api.anaconda.org
Fetching package metadata ...........
Solving package specifications: .
Error: Package missing in current win-64 channels:
- gseapy
You can search for packages on anaconda.org with
anaconda search -t conda gseapy
How can I solve this?
You need to use a channel that has a win-64 version. Use:
conda install -c bioninja gseapy
The option -c or --channel allows to specify a channel.
You can also add a channel permanently via:
conda config --add channels bioninja
This creates a file .condarc in your home directory (on Windows C:\Users\<username>):
channels:
- bioninja
- defaults
You can modify this file manually. The order of the channels determines
their precedence.
Note: Files with a leading . might not be displayed
by certain file browsers. You might need to change settings to display these
files accordingly.
You can find out if a package exits for your platform by searching on Anaconda. Just type gseapy in the search field and you should see the available packages. The column "Platforms" shows if a "win-64" version exists.
Now you could install lastest gseapy through bioconda, too
conda install -c bioconda gseapy
Check the latest version of Keras from the Anaconda Cloud website
https://anaconda.org/search?q=keras
Use command:
conda install -c conda-forge keras=<version>
Maybe it need you to specify a detalied version,so you can just find a version support your environment in Anaconda Clound,just a line of command like "conda install -c dhirschfeld protobuf=3.0.0a3.post418+g0cb84ee ",I select this and it works.