I am a mac user with operating system, macOS Mojave 10.14.6. I have installed bcftools in my conda environment py3.9 (Python 3.9).
The following code is my installing command line:
conda install -c bioconda bcftools
but when I try to use it, the shell told me there is something wrong with it.
dyld: Library not loaded: #rpath/libdeflate.so
Referenced from: /opt/anaconda3/envs/py3.9/bin/bcftools
Reason: image not found
Abort trap: 6
when I went the path (/opt/anaconda3/envs/py3.9/bin/bcftools), I found there is only a binary file.
I hope that someone can help me, thanks!
Bioconda has very specific channel requirements, namely, it builds packages using Conda Forge builds, not Anaconda (defaults). The correct ad hoc installation command for Bioconda packages is:
conda install -c conda-forge -c bioconda -c defaults bcftools
However, if you have an Anaconda base (as opposed to Miniforge), it is usually not a good idea to prioritize the conda-forge channel when installing in base (can lead to lots of channel switching and long solves). Instead, create a new environment and configure it to use the correct channels:
# create new environment
conda create -n my_env
# activate environment
conda activate my_env
# set channels for environment
conda config --env --add channels defaults
conda config --env --add channels bioconda
conda config --env --add channels conda-forge
# no need to use ad hoc `-c` flags
conda install bcftools
I am trying to create a conda environment with some required packages which are not in the official channels:
create --name stat_learn --file requirements.txt
However it fails with the following error:
PackagesNotFoundError: The following packages are not available from current channels:
I am using ubuntu 18.04, but I don't think it is related to my system. Here you can find a sample requirements file to reproduce the error:
# This file may be used to create an environment using:
# $ conda create --name <env> --file <this file>
# platform: linux-64
r-plotroc=2.2.0=r34hd3e613b_0
Is there a way to either i) produce a requirements file with channels included that would make the creation automatic or ii) let conda search itself for unofficial channels and find the required packages?
Thank you in advance, hope the question is clear :)
I tried to update or install new packages from anaconda and lately, this message has appeared:
The environment is inconsistent, please check the package plan carefully
The following package are causing the inconsistency:
- defaults/win-32::anaconda==5.3.1=py37_0
done
I tried with conda clean --all and then conda update --all but it persists.
Conda Info
active environment : base
active env location : C:\Users\NAME\Continuum
shell level : 1
user config file : C:\Users\NAME\.condarc
populated config files : C:\Users\NAME\.condarc
conda version : 4.6.11
conda-build version : 3.17.7
python version : 3.7.3.final.0
base environment : C:\Users\NAME\Continuum (writable)
channel URLs : https://repo.anaconda.com/pkgs/main/win-32
https://repo.anaconda.com/pkgs/main/noarch
https://repo.anaconda.com/pkgs/free/win-32
https://repo.anaconda.com/pkgs/free/noarch
https://repo.anaconda.com/pkgs/r/win-32
https://repo.anaconda.com/pkgs/r/noarch
https://repo.anaconda.com/pkgs/msys2/win-32
https://repo.anaconda.com/pkgs/msys2/noarch
package cache : C:\Users\NAME\Continuum\pkgs
C:\Users\NAME\.conda\pkgs
C:\Users\NAME\AppData\Local\conda\conda\pkgs
envs directories : C:\Users\NAME\Continuum\envs
C:\Users\NAME\.conda\envs
C:\Users\NAME\AppData\Local\conda\conda\envs
platform : win-32
user-agent : conda/4.6.11 requests/2.21.0 CPython/3.7.3 Windows/10 Windows/10.0.17763
administrator : False
netrc file : None
offline mode : False
I had faced the same problem. Simply running
conda install anaconda
solved the problem for me.
saw this on Google Groups
This message was added in conda 4.6.9, previously there was no indication when conda detected an inconsistent environment unless conda was run in debug mode. It is likely that your environment was inconsistent for some time but the upgrade to conda made it visible. The best option it to run "conda install package_name" for the inconsistent packages to let conda try to restore consistency.
and it really works for me.
Maybe you should try conda install anaconda in your situation.
The inconsistencies are caused due to different versions of the packages, and their clashing dependencies.
conda update --all
This command updates all the packages, and then conda solves the inconsistency on its own.
Had this same problem and none of the other solutions worked for me. Ended up having to uninstall and reinstall conda, then reinstall all of my libraries.
Ultimate solutions:
conda activate base
conda install anaconda
conda update --all
Works on Windows 10 and Ubuntu 18.04 (credits to #MF.OX for ubuntu).
Removed following problems for me:
The environment is inconsistent
WARNING conda.base.context:use_only_tar_bz2(632)
If the other solutions don't work, reverting the environment can fix this.
Use conda list --revisions, pick a revision number, and use conda install --revision [#] going back step-by-step until everything works again.
Given a situation like the following,
> conda update -c intel --all
Collecting package metadata: done
Solving environment: |
The environment is inconsistent, please check the package plan carefully
The following packages are causing the inconsistency:
- intel/win-64::ipython==6.3.1=py36_3
- intel/win-64::prompt_toolkit==1.0.15=py36_2
done
As mentioned in other answers, the idea is to have some sort of re-installation to occur for the inconsistent packages.
Thus, with a few copy-&-paste's, you could:
> conda install intel/win-64::ipython==6.3.1=py36_3
Collecting package metadata: done
Solving environment: /
The environment is inconsistent, please check the package plan carefully
The following packages are causing the inconsistency:
- intel/win-64::ipython==6.3.1=py36_3
- intel/win-64::prompt_toolkit==1.0.15=py36_2
done
## Package Plan ##
environment location: c:\conda
added / updated specs:
- ipython
The following NEW packages will be INSTALLED:
jedi intel/win-64::jedi-0.12.0-py36_2
parso intel/win-64::parso-0.2.0-py36_2
pygments intel/win-64::pygments-2.2.0-py36_5
wcwidth intel/win-64::wcwidth-0.1.7-py36_6
Proceed ([y]/n)? y
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
(and you would have to repeat for all the packages)
My “Shortcut”
Alternatively, cook up an (ugly) one-liner (this should work for Windows as well as other platforms)
Note: by "ORIGINAL_COMMAND", I'm referring to any command that gives you the error message (without any other side-effects, ideally)
<ORIGINAL_COMMAND> 2>&1 | python -c "import sys,re,conda.cli; conda.cli.main('conda','install','-y',*re.findall(r'^\s*-\s*(\S+)$',sys.stdin.read(),re.MULTILINE))"
Expanding the above one-liner:
from re import findall, MULTILINE
from sys import stdin
from conda.cli import main
main(
"conda", "install", "-y",
"--force", # Maybe add a '--force'/'--force-reinstall' (I didn't add it for the one-liner above)
*findall(r"^\s*-\s*(\S+)$", stdin.read(), MULTILINE) # Here are the offenders
)
I was getting an environment is inconsistent error when I tried to update my base conda environment. I'm using miniconda. Unfortunately, none of the answers above worked for me.
What did work for me was:
conda activate base
conda install conda --force-reinstall
conda install conda --force-reinstall
conda update --all
(Yes, for some reason it was necessary to run conda install conda --force-reinstall twice!)
The command conda install -c anaconda anaconda did the trick for me. For my setup, I need to specify the channel otherwise it would not work. After running the command in the terminal, I was prompted to update a list of packages that was found to be inconsistent. Without this step, I was not able to install or update any packages with conda install <package_name> or conda update <package_name respectively.
What worked for me was to
`conda remove <offending_packagename>`,
`conda update --all`
and then finally
`conda install <offending_packagename>`.
I had this problem for ages. The conda install anaconda might work, but it takes just way too long -- more than 24 hours on my machine.
Here is a solution that worked for me in under 5 minutes:
Remove all the unneeded packages -- being careful to leave the ones that are essential for conda to operate.
Then, use conda install anaconda.
But how?? there is a lot of them!
This is what I have done:
Make a fresh envinroment with python, fairly bare-bone. then, list the packages in there:
conda create -n fresh python
conda activate fresh
conda list
Save the output, you will need it.
1b. go back to the base envinroment:
conda deactivate
use the following snippet to generate a conda command that will remove all the inconsistent packages:
(good packages are)
exclusion_text = '''
_libgcc_mutex 0.1 main
_openmp_mutex 4.5 1_gnu
anyio 2.2.0 py39h06a4308_1
argon2-cffi 20.1.0 py39h27cfd23_1
async_generator 1.10 pyhd3eb1b0_0
...
... and more! get this from a good environment.
Note the usage of triple quotes (''') to use a multiline-string in python.
bad_packages_text = '''
- https://repo.continuum.io/pkgs/main/linux-64/networkx-2.1-py36_0.tar.bz2/linux-64::networkx==2.1=py36_0
- https://repo.continuum.io/pkgs/main/linux-64/spyder-3.2.6-> py36_0.tar.bz2/linux-64::spyder==3.2.6=py36_0
py36h4c697fb_0.tar.bz2/linux-64::jdcal==1.3=py36h4c697fb_0
- defaults/noarch::jupyterlab_server==1.1.4=py_0
- defaults/linux-64::argh==0.26.2=py37_0
...
... and more! get this by copy-pasting the "The following packages are causing the inconsistency." message.
then, in python, process this:
exclusions = [line.split(' ')[0] for line in exclusion_text_lines if line !='']
bad_packages_lines = bad_packages_text.split('\n')
bad_packages = [line.split('::')[1].split('==')[0] for line in bad_packages_lines if line!='']
exclusions.append('conda') # make sure!
exclusions.append('tqdm')
finally, construct the life-saving command:
command_line = 'conda remove '
for bad_package in bad_packages:
if bad_package not in exclusions:
command_line = f'{command_line} {bad_package}'
command_line
Since in solving the environment, all the packages on the remove list can be ignored, conda no longer needs to consider their versions, and the process is fast.
Possibly someone can refactor this method to make it easier -- or better yet, upgrade conda to enable quick reset base command.
This worked for me -- it took me longer to write this post than to execute these actions.
Good luck!
To those of us who have miniconda and can't/don't want to install anaconda: the accepted answer works when adapted.
conda install conda
conda update --all
Would have commented, but my rep is too low.
conda install anaconda
conda clean --all
conda update --all
fix the problem for me
To solve this message I had to run conda update --all in my base environment three times after each other.
Every time the number of inconsistent packages decreased until conda said:
# All requested packages already installed.
I'm on macOS Big Sur 11.6 using conda version 4.10.3.
In my case, none of the above worked. But this did the trick in less than a minute:
1- I downloaded again the lastest installer (miniconda in my case)
2- Run the installer with the -u option:
bash Miniconda3-py39_xxxx-Linux-x86_64.sh -u
3- Answer yes to all questions and let the installer finish
4- Then I could run conda update conda -all
Hope this helps...
You probably installed anaconda with python 2.7 but later you used python 3.x. Thus, you are getting an error message. In my case, I solved the problem by activating anaconda with python 2.7:
conda create --name py2 python=2.7
Try to have a look to the environment management
https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html
By using something along the lines
conda create --name astra python=3.5
conda activate astra
conda install -c astra-toolbox astra-toolbox
You can see that you can even specify target python version. Now play with the new packages installed. When unsatisfied, you can always do
conda deactivate
conda env remove -n astra
If you install everything to the base env and something gets broken, then probably better is not to install conda at all and go with default python managing it through pip.
In my environment.
1.
conda install anaconda
conda update --all
Then it works correctly.
I create a conda environment without specifying any packages using the following command:
conda create --name test_env
I can then use all the packages in the root environment inside test_env (but they do not appear in the outputs of conda list and conda env export). This is already unexpected to me but the real problems begin when I then install something inside that environment, e.g.:
conda install pywavelets
Afterwards, pywavelets is usable but all the other packages which are no dependencies of pywavelets disappear inside the environment (e.g. pandas). I don't understand why that happens. Does anybody have an explanation for that?
More importantly, what does this mean for best practices for working with conda environments? Should I always create my environments specifying at least python (conda create --name test_env python)? However, then I have to install everything by hand in that environment which is quite cumbersome. So, my idea now is to specify anaconda for all environments I create:
conda create --name test_env anaconda
The disadvantage, however, is that the list of dependencies listed by conda list and conda env export gets unnecessarily long (e.g. even listing the Anaconda Navigator). Does anybody have a better solution for this?
The reason you can use all the packages from the root environment when you don't specify a Python version during environment creation is because you're actually using the root environment's Python executable! You can check with which python or python -c "import sys; print(sys.executable)". See also my other answer here.
When you install pywavelets, one of the dependencies is (probably) Python, so a new Python executable is installed into your environment. Therefore, when you run Python, it only picks up the packages that are installed in the test_env.
If you want all of the packages from another environment, you can create a file that lists all the packages and then use that file to create a new environment, as detailed in the Conda docs: https://conda.io/docs/user-guide/tasks/manage-environments.html#building-identical-conda-environments
To summarize
conda list --explicit > spec-file.txt
conda create --name myenv --file spec-file.txt
or to install into an existing environment
conda install --name myenv --file spec-file.txt
Since that's just a text file, you can edit and remove any packages that you don't want.
How can I install a package under development to an Anaconda environment?
With pip:
pip install -e /path/to/mypackage
or with regular setuptools:
python /path/to/mypackage/setup.py develop
There is also conda develop available now.
http://conda.pydata.org/docs/commands/build/conda-develop.html
Update in 2019: conda develop hasn't been maintained and is not recommended. See https://github.com/conda/conda-build/issues/1992
Recommendation is to use python setup.py develop or pip install -e .
Using either of those will work with Anaconda. Make sure that you have pip or setuptools installed into the conda environment you want to install into, and that you have it activated.
This is the equivalent to pip install -e .
conda install conda-build
conda develop .
As explained in this gh issue thread, because of build isolation and dependency installation, Anaconda developers recommend using:
pip install --no-build-isolation --no-deps -e .
Build / Host Environment
To create build and host environments and a build script go to your recipe directory and use
conda debug /path/to/your/recipe-directory
as documented here. This will print an instructive message like
################################################################################
Build and/or host environments created for debugging. To enter a debugging environment:
cd /home/UserName/miniconda3/conda-bld/debug_1542385789430/work && source /home/UserName/miniconda3/conda-bld/debug_1542385789430/work/build_env_setup.sh
To run your build, you might want to start with running the conda_build.sh file.
################################################################################
(The message might tell you incorrectly, that it created a test environment.) Your source code has been copied to the .../work directory and there is also a conda_build.sh script. Note, that sourcing the build_env_setup.sh will load both build and host environments.
You can work on your code and your recipe and build with the conda_build.sh, but you won't get a proper conda package, as far as I know. When you are finished, you can remove the debug environment:
conda deactivate # maybe twice
conda build purge
Test Environment
To get the test environment, you have to build the package first and then debug that. This might be useful to fix your test files.
conda build /path/to/your/recipe-directory # creates mypackage*.tar.bz2
# find file location of mypackage*.tar.bz2 with:
conda search --info --use-local mypackage # look at the url row for the path
cd /path/to/miniconda3/conda-bld/linux-64/ # go to that path, can be different
conda debug mypackage*.tar.bz2
This will print e. g.:
################################################################################
Test environment created for debugging. To enter a debugging environment:
cd /home/UserName/miniconda3/conda-bld/debug_1542385789430/test_tmp && source /home/UserName/miniconda3/conda-bld/debug_1542385789430/work/conda_test_env_vars.sh
To run your tests, you might want to start with running the conda_test_runner.sh file.
################################################################################
Again, remove with
conda deactivate
conda build purge
Run Environment
This is actually no debugging, but the general process of building and installing a local package. With the run environment you can check, whether all dependencies are specified in the requirements/run section. Also pinning can be an issue.
(base) $ conda build /path/to/your/recipe-directory
(base) $ conda create --name package-env --use-local mypackage
(base) $ conda activate package-env
(package-env) $ python
>>> import mypackage
You can also list the dependencies of your package with (man page)
conda search --info --use-local mypackage
A last hint: If you want to know the versions of the dependencies and see, whether pinning works, try (man page)
conda render /path/to/your/recipe-directory