Readthedocs.org: Support pip install inside conda environment

Created on 3 Apr 2017  路  9Comments  路  Source: readthedocs/readthedocs.org

Details

Expected Result

I expect my pip requirements file (requirements.txt) to be processed at some point during the build, i.e. to see a pip install -r requirements.txt line, or something similar. I expect this because in my Admin/Advanced Settings page on readthedocs, I set the "Requirements file" field accordingly.

Actual Result

My requirements file is never processed. Consequently, my build fails.

Improvement design decision

Most helpful comment

Running the pip install after the conda env was created and configured shouldn't be a problem at all, I think. Conda support is kind of a new feature in RTD and the core developers don't have too much experience on this topic. So, help on this and a PR with this change would be appreciated for sure.

All 9 comments

@rgerkin hi! You are using a conda environment, that's why. As far as I know, if you use a conda env, you have to put the pip requirements inside the environment.yml used by conda.

Besides, I saw that you are using readthedocs.yml and I think that setting overrides the _Admin/Advanced Settings_.


I took a look at your settings and I can see that you are using the pip option inside the environment.yml and RTD is installing those packages also in the conda env but I don't really understand why the installation of your module fails trying to install again the packages that were already installed.

I need to keep taking a look, but that is what I have now. Sorry :(

As far as I know, if you use a conda env, you have to put the pip requirements inside the environment.yml used by conda.

I did not manage to get that to work: https://readthedocs.org/projects/fpylll/builds/5289709/

My conda env file looks like

dependencies:
  - gmp
  - pip:
    - Cython
    - cysignals
    - git+https://github.com/jdemeyer/sphinx

It would be nice to have an actual working example of this.

As far as I know, if you use a conda env, you have to put the pip requirements inside the environment.yml used by conda.

Is there a structural reason why RTD cannot support both a conda env and a requirements.txt? I mean, it could first install the conda env and then run pip install -r requirements.txt within that env.

Running the pip install after the conda env was created and configured shouldn't be a problem at all, I think. Conda support is kind of a new feature in RTD and the core developers don't have too much experience on this topic. So, help on this and a PR with this change would be appreciated for sure.

Here is the relevant code, and looks like there is an explanation about this issue there.

https://github.com/rtfd/readthedocs.org/blob/393e31ad3a9aafee297df64f1a654ffcda7ef04a/readthedocs/doc_builder/python_environments.py#L369-L372

It would work to to put a URL in the pip sub-section of depencencies in the conda env file, except that the RTD built process calls pip install --ignore-installed ... later on. That means it will complain about any pip packages it can't find on PyPI, even though they're already installed in the conda environment!

I wouldn't add another way to install pip requirements in conda if there is already a way to do it, more maintained, contained in the YAML file and it's standard.

Please, if you think that this is a blocker for your project to build on RTD make a new comment of feel free to reopen explaining the situation. Thanks!

Also reading https://www.anaconda.com/using-pip-in-a-conda-environment/, looks like we shouldn't use pip at all when using conda

Was this page helpful?
0 / 5 - 0 ratings

Related issues

davidfischer picture davidfischer  路  4Comments

goerz picture goerz  路  4Comments

JiaweiZhuang picture JiaweiZhuang  路  3Comments

dxgldotorg picture dxgldotorg  路  3Comments

SylvainCorlay picture SylvainCorlay  路  3Comments