Stéphane
Stéphane

Reputation: 1344

conda returns 'Solving environment: failed'

I can not use the conda utility anymore. I use it regularly since years but lately, since I installed the python module scp (with the command conda install scp, I don’t know if it matters) without anything visibly unusual, I get the error below whatever the command as soon as I use conda (conda install …, conda update …, conda uninstall …, … , the message is always the same):

Solving environment: failed

# >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<

    Traceback (most recent call last):
      File "/Users/steph/anaconda/lib/python3.5/site-packages/conda/exceptions.py", line 819, in __call__
        return func(*args, **kwargs)
      File "/Users/steph/anaconda/lib/python3.5/site-packages/conda/cli/main.py", line 78, in _main
        exit_code = do_call(args, p)
      File "/Users/steph/anaconda/lib/python3.5/site-packages/conda/cli/conda_argparse.py", line 77, in do_call
        exit_code = getattr(module, func_name)(args, parser)
      File "/Users/steph/anaconda/lib/python3.5/site-packages/conda/cli/main_update.py", line 14, in execute
        install(args, parser, 'update')
      File "/Users/steph/anaconda/lib/python3.5/site-packages/conda/cli/install.py", line 235, in install
        force_reinstall=context.force,
      File "/Users/steph/anaconda/lib/python3.5/site-packages/conda/core/solve.py", line 506, in solve_for_transaction
        force_remove, force_reinstall)
      File "/Users/steph/anaconda/lib/python3.5/site-packages/conda/core/solve.py", line 439, in solve_for_diff
        final_precs = self.solve_final_state(deps_modifier, prune, ignore_pinned, force_remove)
      File "/Users/steph/anaconda/lib/python3.5/site-packages/conda/core/solve.py", line 180, in solve_final_state
        index, r = self._prepare(prepared_specs)
      File "/Users/steph/anaconda/lib/python3.5/site-packages/conda/core/solve.py", line 580, in _prepare
        self.subdirs, prepared_specs)
      File "/Users/steph/anaconda/lib/python3.5/site-packages/conda/core/index.py", line 215, in get_reduced_index
        new_records = query_all(spec)
      File "/Users/steph/anaconda/lib/python3.5/site-packages/conda/core/index.py", line 184, in query_all
        return tuple(concat(future.result() for future in as_completed(futures)))
      File "/Users/steph/anaconda/lib/python3.5/site-packages/conda/core/subdir_data.py", line 94, in query
        self.load()
      File "/Users/steph/anaconda/lib/python3.5/site-packages/conda/core/subdir_data.py", line 148, in load
        _internal_state = self._load()
      File "/Users/steph/anaconda/lib/python3.5/site-packages/conda/core/subdir_data.py", line 216, in _load
        mod_etag_headers.get('_mod'))
      File "/Users/steph/anaconda/lib/python3.5/site-packages/conda/core/subdir_data.py", line 416, in fetch_repodata_remote_request
        timeout=timeout)
      File "/Users/steph/anaconda/lib/python3.5/site-packages/requests/sessions.py", line 501, in get
        return self.request('GET', url, **kwargs)
      File "/Users/steph/anaconda/lib/python3.5/site-packages/requests/sessions.py", line 479, in request
        prep.url, proxies, stream, verify, cert
      File "/Users/steph/anaconda/lib/python3.5/site-packages/requests/sessions.py", line 654, in merge_environment_settings
        env_proxies = get_environ_proxies(url) or {}
      File "/Users/steph/anaconda/lib/python3.5/site-packages/requests/utils.py", line 617, in get_environ_proxies
        if should_bypass_proxies(url):
    TypeError: should_bypass_proxies_patched() missing 1 required positional argument: 'no_proxy'

`$ /Users/steph/anaconda/bin/conda update conda`

  environment variables:
                 CIO_TEST=<not set>
                CLASSPATH=/Users/steph/workspace
               CONDA_ROOT=/Users/steph/anaconda
          LD_LIBRARY_PATH=/opt/local/lib:/opt/local/lib/gcc5:/usr/lib:/usr/local/lib:/Users/step
                          h/anaconda/pkgs/qt-4.8.7-1/lib
                     PATH=/Library/Frameworks/Python.framework/Versions/3.5/bin:/Library/Framewo
                          rks/Python.framework/Versions/3.6/bin:/opt/local/bin:/opt/local/sbin:.
                          :/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/Te
                          X/texbin:/Developer/usr/bin:/Users/steph/anaconda/bin
               PYTHONPATH=/Users/steph/python_work:/Users/steph/python_lib
       REQUESTS_CA_BUNDLE=<not set>
            SSL_CERT_FILE=<not set>

     active environment : None
       user config file : /Users/steph/.condarc
 populated config files : 
          conda version : 4.5.6
    conda-build version : 3.10.5
         python version : 3.5.5.final.0
       base environment : /Users/steph/anaconda  (writable)
           channel URLs : https://repo.anaconda.com/pkgs/main/osx-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/free/osx-64
                          https://repo.anaconda.com/pkgs/free/noarch
                          https://repo.anaconda.com/pkgs/r/osx-64
                          https://repo.anaconda.com/pkgs/r/noarch
                          https://repo.anaconda.com/pkgs/pro/osx-64
                          https://repo.anaconda.com/pkgs/pro/noarch
          package cache : /Users/steph/anaconda/pkgs
                          /Users/steph/.conda/pkgs
       envs directories : /Users/steph/anaconda/envs
                          /Users/steph/.conda/envs
               platform : osx-64
             user-agent : conda/4.5.6 requests/2.12.4 CPython/3.5.5 Darwin/15.6.0 OSX/10.11.6
                UID:GID : 504:20
             netrc file : None
           offline mode : False


An unexpected error has occurred. Conda has prepared the above report.
If submitted, this report will be used by core maintainers to improve
future releases of conda.
Would you like conda to send this report to the core maintainers?
…

I tried to look at my .condarc file and even removed it but it doesn't change the pb. Do you know what I can do to go back to a working conda ?

Upvotes: 46

Views: 144928

Answers (7)

DELETE to C:\Users\<YOUR_USERNAME>\.condarc and then update Conda. This will solve it in Windows.

conda update conda

Upvotes: 22

Gokulakrishnan
Gokulakrishnan

Reputation: 137

I have the same issue, I just fixed it by

1.uninstall the anaconda and download latest version

2.create a new environment and try installing packages in that environment

Upvotes: -1

Kindson The Genius
Kindson The Genius

Reputation: 67

I have tried to solve this problem for some time now. Finally I figure out that you should use pip install instead of conda install. Normally we use pip install in windows command prompt and conda install in Anaconda Prompt. But for me I solved the problem by using pip install in Anaconda prompt. The output is shown below enter image description here

Upvotes: 0

apYan
apYan

Reputation: 119

I got the same problem and solved. In Anaconda prompt, use pip install scp, not conda install scp

Upvotes: -1

happy_to_help
happy_to_help

Reputation: 33

Okay. I was facing the same problem with the Anaconda 3 2018 ver. So what I did is that I used Anaconda prompt. It automatically links the base conda files to the required proxies. just type "conda --version" in the prompt to check the prompt. Then type "conda install numpy". Voila! you are done.

Upvotes: 0

St&#233;phane
St&#233;phane

Reputation: 1344

thank you, that works ! in case the link grows old, here is the simplified copy:

  1. Navigate to your conda base environment, as given by conda info.
  2. Open the file lib/pythonX.Y/site-packages/conda/gateways/connection/init.py. Where X.Y is the python major-minor version.
  3. Replace the function 'should_bypass_proxies_patched' with :

    def should_bypass_proxies_patched(should_bypass_proxies_func, url, no_proxy=None):
        if url.startswith("file://"):
            return True
        try:
            return should_bypass_proxies_func(url, no_proxy)
        except TypeError:
            return should_bypass_proxies_func(url)
    

Upvotes: 5

junichiro
junichiro

Reputation: 5482

Downgrading to conda 4.5.5 fixed this for me.

And with a ranting hat on: This is the third time in the space of about 18 months that a conda update has resulted in an error that causes builds to fail, and there's been plenty of other issues too. I presume it will be fixed by the core conda people at some point, and maybe it is caused by a particular combination of third party dependencies, but one way or another conda always seems extremely buggy. There was once an update that caused conda install conda to delete itself!

Upvotes: 20

Related Questions