Advanced operation of conda software installation

1. Find the mirror where the software is located

The standard syntax format for installing software with conda is:

$ conda install -c <channel> <software>

Where -cthis parameter is very important, it is specified by the software downloaded image location

For our employees in these bioinformatics, the most common channel (here understood as mirroring) is bioconda, if you want to install bioinformatics, usually first- bioconda official website on the look for the software you want Not in the list of official images of bioconda

 

Here is an example of searching BWA

If the software is in the bioconda official image, everything is fine, just install it directly with the following command

$ conda install -c bioconda bwa

If you have added the bioconda channel to your default channel list, you -ccan also specify no parameters

But what if the software you want is not in bioconda?

Then you can perform anaconda search -t <software>to list all the official target software image to save

For example, if you want to install CNVnator (this is a software that installs god-level pits), it is not in bioconda, execute

$ anaconda search -t cnvnator

得到的检索结果如下:

Using binstar api site https://api.anaconda.org
Run 'anaconda show <USER/PACKAGE>' to get more details:
Packages:
     Name                      |  Version | Package Types   | Platforms
     ------------------------- |   ------ | --------------- | ---------------
     pwwang/cnvnator           |    0.3.3 | conda           | linux-64
                                          : a tool for CNV discovery and genotyping from depth-of-coverage by mapped reads
Found 1 packages

Through the above search results, we know that there is currently only one conda image that saves CNVnator, which is pwwang. This is how you can complete the software installation by specifying the image you just found:

$ conda install -c pwwang cnvnator

2. Python in conda fights with Python that comes with the system

After you install conda (whether Anaconda or Miniconda), it will install the corresponding Python version, and your system originally installed Python. At this time, the two versions of Python will conflict, making you new The installed conda runs with errors, such as simply running conda list, and the following long list of error messages will appear:

Error processing line 1 of /usr/local/lib/python2.7/site-packages/matplotlib-2.1.2-py2.7-nspkg.pth:

Fatal Python error: initsite: Failed to import the site module
Traceback (most recent call last):
  File "/disk2/yut/SOFTWARE/miniconda3/lib/python3.7/site.py", line 168, in addpackage
    exec(line)
  File "<string>", line 1, in <module>
  File "/disk2/yut/SOFTWARE/miniconda3/lib/python3.7/importlib/util.py", line 14, in <module>
    from contextlib import contextmanager
  File "/disk2/yut/SOFTWARE/miniconda3/lib/python3.7/contextlib.py", line 5, in <module>
    from collections import deque
  File "/disk2/yut/SOFTWARE/miniconda3/lib/python3.7/collections/__init__.py", line 27, in <module>
    from reprlib import recursive_repr as _recursive_repr
  File "/usr/local/lib/python2.7/site-packages/reprlib/__init__.py", line 7, in <module>
    raise ImportError('This package should not be accessible on Python 3. '
ImportError: This package should not be accessible on Python 3. Either you are trying to run from the python-future src folder or your installation of python-future is corrupted.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/site.py", line 73, in <module>
    __boot()
  File "/usr/local/lib/python2.7/site-packages/site.py", line 47, in __boot
    addsitedir(item)
  File "/disk2/yut/SOFTWARE/miniconda3/lib/python3.7/site.py", line 207, in addsitedir
    addpackage(sitedir, name, known_paths)
  File "/disk2/yut/SOFTWARE/miniconda3/lib/python3.7/site.py", line 178, in addpackage
    import traceback
  File "/disk2/yut/SOFTWARE/miniconda3/lib/python3.7/traceback.py", line 3, in <module>
    import collections
  File "/disk2/yut/SOFTWARE/miniconda3/lib/python3.7/collections/__init__.py", line 27, in <module>
    from reprlib import recursive_repr as _recursive_repr
  File "/usr/local/lib/python2.7/site-packages/reprlib/__init__.py", line 7, in <module>
    raise ImportError('This package should not be accessible on Python 3. '
ImportError: This package should not be accessible on Python 3. Either you are trying to run from the python-future src folder or your installation of python-future is corrupted.

Read the error message above carefully, you will find that this is the conflict between the system's Python and Python in conda (I like to call this phenomenon pinch and fight), which is also the conda software installation artifact to bring you convenience At the same time bring by-products: it will pollute your environmental variables !

In the case of conflict between the two Python environments, my general solution is to close the system's Python and delete the system's Python path from my environment variables

$ export PYTHONPATH=''

conda listNo error will be reported after execution

3. The software is too big and the download is interrupted

Another problem that is often encountered during the installation of software using conda is:

I want to download a software. Conda will tell me that the bottom layer of this software depends on several other softwares, and they need to be downloaded and installed together. At this time, there may be several large software in this pile of software, hundreds of MB, which is easy to download The network connection is interrupted, and conda has a breakpoint download function. Once the download is interrupted, conda will terminate the installation process and exit.

This time you can try wgetthe next few large local software installation package, and then move them to conda default installation package download path, so then perform conda install, it will skip these download software process

The conda default installation package download and save path is:miniconda3/pkgs

Published 190 original articles · praised 497 · 2.60 million views +

Guess you like

Origin blog.csdn.net/u013066730/article/details/105415296