10

When I use 'conda install' to install packages, I always get an annoying error:

Collecting package metadata (current_repodata.json): failed

The detailed report can be seen through this link: error report

My machine info: win 10 (64 bit), Anaconda 2020.02 for Windows.

I tried to reinstall the previous version of anaconda, but it doesn't work. I would appreciate it if you could give me any suggestions.

C:\Users\ZY>conda install geopandas

    Collecting package metadata (current_repodata.json): failed

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

    Traceback (most recent call last):
      File "D:\Anaconda3\lib\site-packages\conda\exceptions.py", line 1079, in __call__
        return func(*args, **kwargs)
      File "D:\Anaconda3\lib\site-packages\conda\cli\main.py", line 84, in _main
        exit_code = do_call(args, p)
      File "D:\Anaconda3\lib\site-packages\conda\cli\conda_argparse.py", line 82, in do_call
        return getattr(module, func_name)(args, parser)
      File "D:\Anaconda3\lib\site-packages\conda\cli\main_install.py", line 20, in execute
        install(args, parser, 'install')
      File "D:\Anaconda3\lib\site-packages\conda\cli\install.py", line 265, in install
        should_retry_solve=(_should_retry_unfrozen or repodata_fn != repodata_fns[-1]),
      File "D:\Anaconda3\lib\site-packages\conda\core\solve.py", line 117, in solve_for_transaction
        should_retry_solve)
      File "D:\Anaconda3\lib\site-packages\conda\core\solve.py", line 158, in solve_for_diff
        force_remove, should_retry_solve)
      File "D:\Anaconda3\lib\site-packages\conda\core\solve.py", line 262, in solve_final_state
        ssc = self._collect_all_metadata(ssc)
      File "D:\Anaconda3\lib\site-packages\conda\common\io.py", line 88, in decorated
        return f(*args, **kwds)
      File "D:\Anaconda3\lib\site-packages\conda\core\solve.py", line 415, in _collect_all_metadata
        index, r = self._prepare(prepared_specs)
      File "D:\Anaconda3\lib\site-packages\conda\core\solve.py", line 1011, in _prepare
        self.subdirs, prepared_specs, self._repodata_fn)
      File "D:\Anaconda3\lib\site-packages\conda\core\index.py", line 228, in get_reduced_index
        repodata_fn=repodata_fn)
      File "D:\Anaconda3\lib\site-packages\conda\core\subdir_data.py", line 105, in query_all
        result = tuple(concat(executor.map(subdir_query, channel_urls)))
      File "D:\Anaconda3\lib\concurrent\futures\_base.py", line 598, in result_iterator
        yield fs.pop().result()
      File "D:\Anaconda3\lib\concurrent\futures\_base.py", line 435, in result
        return self.__get_result()
      File "D:\Anaconda3\lib\concurrent\futures\_base.py", line 384, in __get_result
        raise self._exception
      File "D:\Anaconda3\lib\concurrent\futures\thread.py", line 57, in run
        result = self.fn(*self.args, **self.kwargs)
      File "D:\Anaconda3\lib\site-packages\conda\core\subdir_data.py", line 98, in <lambda>
        package_ref_or_match_spec))
      File "D:\Anaconda3\lib\site-packages\conda\core\subdir_data.py", line 110, in query
        self.load()
      File "D:\Anaconda3\lib\site-packages\conda\core\subdir_data.py", line 174, in load
        _internal_state = self._load()
      File "D:\Anaconda3\lib\site-packages\conda\core\subdir_data.py", line 276, in _load
        _internal_state = self._process_raw_repodata_str(raw_repodata_str)
      File "D:\Anaconda3\lib\site-packages\conda\core\subdir_data.py", line 349, in _process_raw_repodata_str
        json_obj = json.loads(raw_repodata_str or '{}')
      File "D:\Anaconda3\lib\json\__init__.py", line 348, in loads
        return _default_decoder.decode(s)
      File "D:\Anaconda3\lib\json\decoder.py", line 337, in decode
        obj, end = self.raw_decode(s, idx=_w(s, 0).end())
      File "D:\Anaconda3\lib\json\decoder.py", line 353, in raw_decode
        obj, end = self.scan_once(s, idx)
    json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 41 (char 40)

  $ D:\Anaconda3\Scripts\conda-script.py install geopandas

  environment variables:
                 CIO_TEST=<not set>
               CONDA_ROOT=D:\Anaconda3
                 HOMEPATH=\Users\ZY
          MOZ_PLUGIN_PATH=D:\Foxit Reader\plugins\
                     PATH=C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\Sys
                          tem32\WindowsPowerShell\v1.0\;C:\windows\System32\OpenSSH\;C:\Program
                          Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program
                          Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files
                          (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA
                          Corporation\NVIDIA NvDLISR;C:\Program Files\Intel\WiFi\bin\;C:\Program
                          Files\Common Files\Intel\WirelessCommon\;C:\WINDOWS\system32;C:\WINDOW
                          S;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\
                          ;C:\WINDOWS\System32\OpenSSH\;D:\Python\Python37;D:\Python\Python37\Li
                          b\site-packages;C:\Program Files (x86)\Microsoft SQL
                          Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL
                          Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL
                          Server\100\DTS\Binn\;D:\MATLAB\R2018a\bin;D:\SQL2019\Microsoft SQL
                          Server\x86\150\Tools\Binn\;D:\SQL2019\Microsoft SQL
                          Server\150\Tools\Binn\;D:\SQL2019\Microsoft SQL
                          Server\x86\150\DTS\Binn\;D:\SQL2019\Microsoft SQL
                          Server\150\DTS\Binn\;D:\SQL2019\Microsoft SQL Server\Client SDK\ODBC\1
                          70\Tools\Binn\;D:\Anaconda3\Scripts;C:\Users\ZY\AppData\Local\Microsof
                          t\WindowsApps;D:\Python\Python37;D:\Python\Python37\Scripts;C:\Users\Z
                          Y\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Anaconda3
                          (64-bit);D:\Python\Python37\Lib\site-packages;D:\Anaconda3\Lib\site-pa
                          ckages;D:\Anaconda3\Lib\;D:\Anaconda3\Library\bin;D:\Anaconda3\Scripts
                          ;
             PSMODULEPATH=C:\Program Files\WindowsPowerShell\Modules;C:\WINDOWS\system32\Windows
                          PowerShell\v1.0\Modules;D:\SQL2019\Microsoft SQL
                          Server\x86\150\Tools\PowerShell\Modules\
       REQUESTS_CA_BUNDLE=<not set>
            SSL_CERT_FILE=<not set>

     active environment : None
       user config file : C:\Users\ZY\.condarc
 populated config files : C:\Users\ZY\.condarc
          conda version : 4.8.2
    conda-build version : 3.18.11
         python version : 3.7.6.final.0
       virtual packages : __cuda=10.2
       base environment : D:\Anaconda3  (writable)
           channel URLs : https://anaconda.org/win-64
                          https://anaconda.org/noarch
                          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
          package cache : D:\Anaconda3\pkgs
                          C:\Users\ZY\.conda\pkgs
                          C:\Users\ZY\AppData\Local\conda\conda\pkgs
       envs directories : D:\Anaconda3\envs
                          C:\Users\ZY\.conda\envs
                          C:\Users\ZY\AppData\Local\conda\conda\envs
               platform : win-64
             user-agent : conda/4.8.2 requests/2.22.0 CPython/3.7.6 Windows/10 Windows/10.0.17763
          administrator : False
             netrc file : None
           offline mode : False
Bruce
  • 119
  • 1
  • 1
  • 6
  • If you are running Windows and have successfully installed Anaconda, there are a couple ways to resolve your issue. You need to activate the environment you are trying to install 'geopandas'. The easiest way to do so, open Anaconda Navigator, select the environment you want, on 'Home' install or open CMD.exe Prompt. This will automatically open a terminal in the environment. You can then run 'conda install geopandas'. You could also look at [this](https://stackoverflow.com/questions/20081338/how-to-activate-an-anaconda-environment) – Michael Longstreth Apr 10 '20 at 06:33
  • Thank you. I tried to activate environment, and used conda install command, but it always don't work. Here is the [image of the results](https://github.com/bruce0828/error/blob/master/img-1.png) – Bruce Apr 10 '20 at 06:47
  • also reported here: https://github.com/conda/conda/issues/9590 – cel Apr 10 '20 at 09:04

9 Answers9

12

I think Bruce is right ! I also had this problem. The error message was like Collecting package metadata (current_repodata.json): failed ... json.decoder.JSONDecodeError: Unterminated string starting at: line 54584 column 7 (char 1704072). I removed the .condarc file and ran the previous command again with -d flag, and then this error message disappeared. I typed conda config --set show_channel_urls true in anaconda prompt to regenerate the .condarc file and then modified it. The problem was solved as expected !!

steps:

  1. run command conda clean -i to see if it works first
  2. remove the .condarc file
  3. run command conda config --set show_channel_urls true in anaconda prompt to regenerate the .condarc file and then modify it

Important Note: If you encounter this problem, you should try running command conda clean -i first (especially when you haven't changed anything about channels). If it doesn't work, then you can try these steps. If you encounter this problem again after these steps, just try running command conda clean -i to see if it works. That's all I know so far.

user15798110
  • 121
  • 1
  • 6
3

Try removing ~/.condarc file and try again.

Gru
  • 817
  • 13
  • 20
1

I have tried to find solutions for almost five days. And I finally solved my problems with the help of others.

For my case, when I reinstalled anaconda on my machine, a .condarc file was automatically generated. Then error occurred when I used conda install and conda create command.

After I delete .condarc file, everything goes well. Hope this way can help others with the same problem. Use the following command to check the path of the .condarc file, then delete it/them.

conda config --show-sources

Here is the solution in detail.

Bruce
  • 119
  • 1
  • 1
  • 6
0

Disable your system proxy. It will work properly if you have installed anaconda correctly and set the environmental variables correctly.

  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Oct 06 '21 at 17:14
0

For MacOs, I resolved the issue by prefixing impacted conda commands with sudo. So in your case:

sudo conda install geopandas

I have not used Windows for software engineering for a little bit but I presume Windows has a similar "Run as Administrator" alternative.

k0L1081
  • 159
  • 1
  • 4
0

I am a macOS user. I have encountered the same problem. For me the problem is caused by setting conda config --env --set subdir x86-64 When I turned it to conda config --env --set subdir osx-arm64, the problem disappears.

0

On my mac connected to my company VPN, I had to add a custom_channels section to my .condarc. The custom channel is an url to my company's repo for Python packages:

# .condarc
# added these lines:
custom_channels:
  conda-forge: https://mycompany.com/path_to_local_conda_forge

See the docs for more info: https://docs.conda.io/projects/conda/en/latest/configuration.html

0

error

had the same error, got it resolved by switching off proxy and removing the .condarc file

jathin
  • 1
  • 1
0

I also solved such problem by this way.

conda config --show-sources
  • 1
    Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Aug 04 '23 at 04:49