python – conda create env gives PackageNotFound error for not specified package

Trying to create a conda env with line conda create -n myenv python=3.9

I got this error, showing that it was trying to install a locally built package that I didn’t specify, let’s call it localpackage

Collecting package metadata (current_repodata.json): done
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: failed

PackagesNotFoundError: The following packages are not available from current channels:

  - localpackage

Current channels:

  - https://conda.anaconda.org/conda-forge/linux-64
  - https://conda.anaconda.org/conda-forge/noarch
  - https://repo.anaconda.com/pkgs/main/linux-64
  - https://repo.anaconda.com/pkgs/main/noarch
  - https://repo.anaconda.com/pkgs/r/linux-64
  - https://repo.anaconda.com/pkgs/r/noarch

To search for alternate channels that may provide the conda package you're
looking for, navigate to

    https://anaconda.org

and use the search bar at the top of the page

Found out that this was basically because this package was listed in my conda config,

...
create_default_packages:
  - localpackage

I removed this using
conda config --remove create_default_packages localpackage

and issue is fixed now!

Just sharing with the community!

Read more here: Source link