Skip to content

Build fails when creating conda env #9527

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
nicrie opened this issue Aug 20, 2022 · 8 comments
Closed

Build fails when creating conda env #9527

nicrie opened this issue Aug 20, 2022 · 8 comments
Labels
Needed: design decision A core team decision is required

Comments

@nicrie
Copy link

nicrie commented Aug 20, 2022

Details

Expected Result

Building package documentation.

Actual Result

Build fails when creating the conda environment necessary for my project. It did work in the past when I did the last project update.

readthedocs.yaml

version: 2

sphinx:
   configuration: docs/conf.py


conda:
  environment: docs/environment.yml

environment.yml

name: xeofs
channels:
  - conda-forge
  - defaults
dependencies:
  - python>3.8
  - numpy
  - pandas
  - xarray
  - conda
  - scikit-learn
  - yaml
  - matplotlib
  - seaborn
  - pip:
    - sphinxawesome-theme
    - git+https://github.com/sphinx-gallery/sphinx-gallery.git@master
    - xeofs
@ctb
Copy link
Contributor

ctb commented Aug 21, 2022

we saw this over in sourmash, too - sourmash-bio/sourmash#2227. Issue text copy/pasted below :).


we're getting the following error on readthedocs builds as of about 8 hours ago -

%  conda env create --quiet --name 2225 --file doc/environment.yml 
 Collecting package metadata: ...working... failed

UnavailableInvalidChannel: The channel is not accessible or is invalid.
  channel name: pkgs/main
  channel url: https://repo.anaconda.com/pkgs/main
  error code: 404

You will need to adjust your conda configuration to proceed.
Use `conda config --show channels` to view your configuration's current state,
and use `conda config --show-sources` to view config file locations.

while this channel is not in our doc/environment.yml it looks like it might be something added by RTD, based on free-associating from #8059.

Reading https://server-docs.anaconda.com/en/latest/reference/troubleshooting.html, it appears that anaconda might be blocking the readthedocs build server from accessing that channel - possible reasons given, in order of likelihood, are -

The user has misconfigured their channels in their configuration (for example, the secure location where the token is stored was accidentally deleted (most common)

A firewall or other security device or system is preventing user access (second most common)

We are blocking their access because of a potential terms of service violation (third most common)

I'm not going to do anything more to troubleshoot it just yet, maybe it'll get fixed over the weekend or something...

@nicrie
Copy link
Author

nicrie commented Aug 22, 2022

I confirm that this seems like the same error. While reading through the possible reasons, I came back to my mind that I did update my SSH key which I use to connect to git/pypi.

The user has misconfigured their channels in their configuration (for example, the secure location where the token is stored was > accidentally deleted (most common)

Perhaps this is indeed the reason, however, it surprises me that building the conda environment fails when - to me - it seems more likely that the process of publishing it to pypi would raise an error.

@maresb
Copy link

maresb commented Aug 22, 2022

If all your packages are available on conda-forge, you may be able to change defaults to nodefaults to avoid querying the URL which results in the 404. See the (!) Tip here.

@nicrie
Copy link
Author

nicrie commented Aug 22, 2022

thanks @maresb for me that did the trick! :)

@humitos
Copy link
Member

humitos commented Aug 22, 2022

Hi all and thanks for reporting this issue. I ran some tests to try to debug this deeper and find out a solution.

  • Project: test-builds
  • Version: conda-env-py3.7

On Read the Docs

I triggered a build for this project, https://readthedocs.org/projects/test-builds/builds/17859242/ and the build failed with the error reported in the description.

$ conda env create --quiet --name conda-env-py3.7 --file environment.yml
 Warning: you have pip-installed dependencies in your environment file, but you do not list pip itself as one of your conda dependencies.  Conda may not use the correct pip to install your packages, and they may end up in the wrong place.  Please add an explicit pip dependency.  I'm adding one for you, but still nagging you.
Collecting package metadata: ...working... failed

UnavailableInvalidChannel: The channel is not accessible or is invalid.
  channel name: pkgs/main
  channel url: https://repo.anaconda.com/pkgs/main
  error code: 404

You will need to adjust your conda configuration to proceed.
Use `conda config --show channels` to view your configuration's current state,
and use `conda config --show-sources` to view config file locations. 

On local shell

I ran the commands locally and it works just fine. The environment was created without issues.

On local Read the Docs instance

I triggered a build for the same project and version in my local Read the Docs instance and it worked properly. The environment was created without issues and the build succeeded.

@humitos
Copy link
Member

humitos commented Aug 22, 2022


After these tests, I guess what is happening here is that the Conda version used on Read the Docs 1 is old and it's pointing to an obsolete/deprecated URL for the default channel (see https://server-docs.anaconda.com/en/latest/reference/troubleshooting.html#conda-channel-is-unavailable-missing-or-package-itself-is-missing)

I would suggest you all to upgrade your config file to use build.tools.python: miniconda3-4.7 (see https://docs.readthedocs.io/en/stable/config-file/v2.html#build-tools-python) and build.os: ubuntu-22.04 (see https://docs.readthedocs.io/en/stable/config-file/v2.html#build-os). I guess that will fix your issue.

Please, if you follow this suggestion, let me know if it works for you.

Footnotes

  1. this is only happening on readthedocs/build:latest image, tho. Newer images do not have this problem.

@ctb
Copy link
Contributor

ctb commented Aug 22, 2022

that seems to have worked for us, thank you! sourmash-bio/sourmash#2231

humitos added a commit to readthedocs/time-test that referenced this issue Sep 14, 2022
Use Mamba to check build-large queue.

Related #9
Related readthedocs/readthedocs.org#9527
humitos added a commit to readthedocs/time-test that referenced this issue Sep 14, 2022
Use miniconda to check build-large queue.

Related #9
Related readthedocs/readthedocs.org#9527
@humitos
Copy link
Member

humitos commented Jul 24, 2023

We have documented how users can upgrade the conda version manually in case they require it: https://docs.readthedocs.io/en/latest/build-customization.html#update-conda-version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needed: design decision A core team decision is required
Projects
None yet
Development

No branches or pull requests

4 participants