I like having my base
conda environment extremely minimal. I accidentally installed a bunch of packages in this environment so I tried to remove them:
I ran the following command as suggested by conda: remove all installed packages from base/root environment:
conda install --revision 0 -n base
However, when I ran the following script to reinstall the essentials:
conda install -c conda-forge wget rsync pv ipython jupyter jupyterlab pandas numpy biopython r-recommended python=3 -y
conda install -c bioconda pullseq samtools bbmap hmmer ncbi-genome-download -y
It broke and I am unable to even access my conda
-bash-4.1$ which conda
/usr/local/devel/ANNOTATION/jespinoz/anaconda3/condabin/conda
-bash-4.1$ conda -h
Traceback (most recent call last):
File "/usr/local/devel/ANNOTATION/jespinoz/anaconda3/bin/conda", line 12, in <module>
from conda.cli import main
ModuleNotFoundError: No module named 'conda'
A few posts suggested it had something to do with my PYTHONPATH
and PYTHONHOME
environment variables but I don't have those set:
-bash-4.1$ echo $PYTHONHOME
-bash-4.1$ echo $PYTHONPATH
I think it's because my default python
version is now 3.8
which doesn't have conda
installed. However, 3.7
does have conda installed.
-bash-4.1$ ls -l /usr/local/devel/ANNOTATION/jespinoz/anaconda3/lib/python3.8/site-packages/ | grep "conda"
-bash-4.1$ ls -l /usr/local/devel/ANNOTATION/jespinoz/anaconda3/lib/python3.7/site-packages/ | grep "conda"
drwxr-xr-x 2 jespinoz tigr 218 Dec 9 14:49 anaconda_client-1.7.2-py3.7.egg-info
drwxr-xr-x 10 jespinoz tigr 253 Jun 25 13:28 anaconda_navigator
drwxr-xr-x 2 jespinoz tigr 158 Jun 25 13:28 anaconda_navigator-1.9.7-py3.7.egg-info
drwxr-xr-x 6 jespinoz tigr 743 Dec 9 14:51 anaconda_project
drwxr-xr-x 2 jespinoz tigr 218 Dec 9 14:49 anaconda_project-0.8.2-py3.7.egg-info
drwxr-xr-x 11 jespinoz tigr 657 Dec 9 14:51 conda
drwxr-xr-x 2 jespinoz tigr 218 Dec 9 14:49 conda-4.6.11-py3.7.egg-info
drwxr-xr-x 7 jespinoz tigr 1012 Dec 9 14:51 conda_build
drwxr-xr-x 2 jespinoz tigr 218 Dec 9 14:49 conda_build-3.17.8-py3.7.egg-info
drwxr-xr-x 6 jespinoz tigr 295 Dec 9 14:51 conda_env
drwxr-xr-x 2 jespinoz tigr 0 Dec 9 14:59 conda_package_handling
drwxr-xr-x 3 jespinoz tigr 281 Dec 9 14:53 conda_verify
drwxr-xr-x 2 jespinoz tigr 188 Dec 9 14:49 conda_verify-3.1.1-py3.7.egg-info
Can I use this to my advantage to fix the broken setup?
I almost got it to work:
First symlink the conda binaries from the python3.7 site-packages to 3.8
-bash-4.1$ ln -s /usr/local/devel/ANNOTATION/jespinoz/anaconda3/lib/python3.7/site-packages/cond* /usr/local/devel/ANNOTATION/jespinoz/anaconda3/lib/python3.8/site-packages/
When you try to restore python3.7 it doesn't work:
-bash-4.1$ conda install python=3.7
Traceback (most recent call last):
File "/usr/local/devel/ANNOTATION/jespinoz/anaconda3/lib/python3.8/site-packages/conda/common/serialize.py", line 19, in get_yaml
import ruamel_yaml as yaml
ModuleNotFoundError: No module named 'ruamel_yaml'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/devel/ANNOTATION/jespinoz/anaconda3/lib/python3.8/site-packages/conda/common/serialize.py", line 22, in get_yaml
import ruamel.yaml as yaml
ModuleNotFoundError: No module named 'ruamel'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/devel/ANNOTATION/jespinoz/anaconda3/lib/python3.8/site-packages/conda/exceptions.py", line 1003, in __call__
return func(*args, **kwargs)
File "/usr/local/devel/ANNOTATION/jespinoz/anaconda3/lib/python3.8/site-packages/conda/cli/main.py", line 74, in _main
from ..base.context import context
File "/usr/local/devel/ANNOTATION/jespinoz/anaconda3/lib/python3.8/site-packages/conda/base/context.py", line 28, in <module>
from ..common.configuration import (Configuration, ConfigurationLoadError, MapParameter,
File "/usr/local/devel/ANNOTATION/jespinoz/anaconda3/lib/python3.8/site-packages/conda/common/configuration.py", line 40, in <module>
from .serialize import yaml_load
File "/usr/local/devel/ANNOTATION/jespinoz/anaconda3/lib/python3.8/site-packages/conda/common/serialize.py", line 30, in <module>
yaml = get_yaml()
File "/usr/local/devel/ANNOTATION/jespinoz/anaconda3/lib/python3.8/site-packages/conda/_vendor/auxlib/decorators.py", line 59, in _memoized_func
result = func(*args, **kwargs)
File "/usr/local/devel/ANNOTATION/jespinoz/anaconda3/lib/python3.8/site-packages/conda/common/serialize.py", line 24, in get_yaml
raise ImportError("No yaml library available.\n"
ImportError: No yaml library available.
To proceed, conda install ruamel_yaml
Of course, you can't really do conda install ruamel_yaml
because that would be too simple. Instead use pip
:
-bash-4.1$ pip install ruamel_yaml
Collecting ruamel_yaml
Downloading https://files.pythonhosted.org/packages/fa/90/ecff85a2e9c497e2fa7142496e10233556b5137db5bd46f3f3b006935ca8/ruamel.yaml-0.16.5-py2.py3-none-any.whl (123kB)
|████████████████████████████████| 133kB 8.8MB/s
ERROR: conda 4.6.11 requires pycosat>=0.6.3, which is not installed.
ERROR: conda 4.6.11 requires requests>=2.12.4, which is not installed.
ERROR: conda-build 3.17.8 requires beautifulsoup4, which is not installed.
ERROR: conda-build 3.17.8 requires chardet, which is not installed.
ERROR: conda-build 3.17.8 requires filelock, which is not installed.
ERROR: conda-build 3.17.8 requires libarchive-c, which is not installed.
ERROR: conda-build 3.17.8 requires lief, which is not installed.
ERROR: conda-build 3.17.8 requires pkginfo, which is not installed.
ERROR: conda-build 3.17.8 requires psutil, which is not installed.
ERROR: conda-build 3.17.8 requires pyyaml, which is not installed.
ERROR: conda-build 3.17.8 requires requests, which is not installed.
ERROR: conda-build 3.17.8 requires tqdm, which is not installed.
Installing collected packages: ruamel-yaml
Then I tried the following:
-bash-4.1$ conda install python=3.7 -n base
WARNING: The conda.compat module is deprecated and will be removed in a future release.
Collecting package metadata: done
Solving environment: - WARNING conda.common.logic:get_sat_solver_cls(278): Could not run SAT solver through interface 'pycosat'.
failed
CondaDependencyError: Cannot run solver. No functioning SAT implementations available.