-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Support conda for builds #857
Comments
Is there a reason you can't install conda-like packages with pip? I believe pip is the default installer for Python, and is likely the only thing we will support. |
Pip tends not to work well with packages that have non-Python dependencies. This includes a lot of the Numeric/Scientific Python stack (e.g. Pandas.) This community is a decently sized chunk of the Python ecosystem, and would definitely appreciate better support from RTD (which, btw, I <3, thanks!) In regards to default installers you may find it interesting that |
conda is actually still its own org (since it isn't Python specific), but |
Interesting. So it would be a way to install binaries onto the build server? Does it work with virtualenvs, or is it installing things system wide? |
Exactly. It has its own system for virtual environments that relies on linking many packages into environments. Interestingly, because it packages binaries Python is itself just a package, so it's easy to do things like quickly spin up two environments in Python 2 and 3 for simultaneous testing. Many who use it (myself included) vastly prefer it to @asmeurer might have more information. |
pip/virtualenv & conda work at different levels. The PyPA tools are designed to work within a larger system that provides the Python runtime and any external dependencies. That may be a Linux distro package manager, something like homebrew on Mac OS X, or just downloading and running a binary installer from python.org. By contrast, conda is such a larger system - rather than being Python specific, it's a full "cross platform platform", designed to manage arbitrary binaries, including Python runtimes and external dependencies. This means it doesn't integrate with other environments the way pip can, but it also means it can be used to manage components where pip will fail completely. |
Oh, and to answer the "is conda system wide" question, no it isn't. It's designed to be run as an ordinary user, creating installation environments in their own directory space without needing root access. |
👍 this would be a fantastic addition. I figured out how to make the baseline scientific packages (numpy, scipy) + pip to work together to build everything I need for my docs, but it was a real guessing game to figure out which combinations of pip packages could safely install together. I actually tagged and released v0.1 of my package before I realized that I would not be able to build it from scratch on RTD, because it only worked when I changed the |
I agree it would be a great addition. As a matter of fact I'm struggling with installing numpy to build the docs for my project. @shoyer how did you solved the problem? |
@tritemio The trick is to give the virtualenv in which you build your docs access to the global site-packages directory -- see Advanced Settings > Use system packages. RTD has numpy 1.8, scipy and matplotlib installed system wide. I setup my conf.py to print out the versions when building the docs: https://github.com/xray/xray/blob/v0.2/doc/conf.py As for testing, to ensure that you can build your docs from scratch in a new virtualenv (each version of the docs gets its own virtualenv), try deleting the build environment: |
@shoyer thanks! Your suggestions are narrowing down my problems, hope to fix them soon ... |
+1 I'd love to have conda support in RTD. In the same way that Travis CI does it. http://conda.pydata.org/docs/travis.html |
FWIW, if RTD used buildpacks like Heroku and Cloud Foundry, there's a conda-buildpack that can detect a Conda |
I am currently working on a project which uses numba and am trying to upload the project onto RTD. This cannot currently be done as it requires the llvm compiler. Is it possibilt for RTD either to install llvm and include it in the system packages under the Advanced Settings, or add support for conda? |
Using buildpacks or a container tech like Docker to do builds would require fundamentally redesigning the way ReadTheDocs works. On the other hand, that might not be a bad idea at some point, especially as Docker based public cloud services with a grants program for open source projects come online Disclosure: I work for Red Hat, OpenShift Online has a grants program that includes open source projects in its scope, our next generation architecture is based on Docker & Kubernetes, and I personally believe that hosting a valuable service like RTFD would be a great way for us to support the community. So while porting to the current OpenShift architecture likely wouldn't make sense, porting to Docker/Kubernetes would open up both Google Container Engine and a future version of OpenShift Online as hosting options. |
👍 for the addition of conda, I am interested in hosting a package depending on numba too. |
While conda isn't supported, I've tried at least to disable the setup.py running and I'm having this weird error: |
👍 I know a few packages that need a more recent scipy or matplotlib for their docs build and |
Practically, won't this be necessary if you want to build older versions of your documentation that require older versions of NumPy, matplotlib, possibly with different APIs from whatever version of NumPy is installed system-wide? |
@chebee7i practically speaking, matplotlib and numpy have strong backwards compatibility guarantees, so I'm not too worried about API changes for them. Though matplotlib has been talking about a 2.0 release with a new default colormap... |
@shoyer but functionality does change between versions and this can cause the documentation to be wrong, especially if you rely on buildtime-generated documentation through the sphinxext IPython directive. And I am thinking much more generally than matplotlib and numpy, but even extending to just pandas reveals very recent backwards compatibility changes. |
+1 for |
+1, i'm currently trying to update old docs that use both Python, R and rpy2, I can almost trivially have everything working fine in a conda 2.7 env. |
We aren't running conda in an interactive session, so I'm not sure how we could run activate. If there are environment variables that should be supported, we could set them, but we're running these commands independently, so the variables set in the activate script wouldn't apply. The code is here: https://github.com/rtfd/readthedocs.org/blob/master/readthedocs/doc_builder/python_environments.py#L163 |
Yeah, I wouldn't be surprised if this is a problem. The
Right, so if we can just tack them onto whatever environment that is used when shelling out, I think this would be fine.
Thanks for the link. I have been looking at the code. I had a question that I put on the merged PR. |
For the record, here is a diff of environment variables when I run
As you see there's not much to it. The most important is probably the appending of the conda environment's |
Interesting, I don't get this |
Oh, forget it. PYTHONNOUSERSITE is from my own |
Ah, ok. In any event, I think we can safely ignore it here as there should be only this one Python install that we are worried about. |
Should be easy enough to support the conda PATH, as we already have the |
I could be wrong, but I think we want to be able to pass environment variables as a kwarg to something like this ( https://github.com/rtfd/readthedocs.org/blob/aba714e82d218d60773955aec62a3df74173348d/readthedocs/doc_builder/backends/sphinx.py#L156 ). Does |
So, we have to change the environment of a |
So, I tried my hand at a simpler PR ( #1919 ). From what I have gleaned from my brief look at the code here (not an expert), this looks like a workable solution. It probably could use a test or two, but I am a bit unfamiliar with the test suite here and will need guidance for that. Though, I imagine doing something like asserting the variables are there and checking the output of |
Turns out this PR ( #1924 ) ends up being a much better way to go about it. |
So, I think the active environment issue is fixed thanks to @ericholscher and @agjohnson, if people want to try. |
Verified that this works well for me. Thanks all! |
Great :) If there are other issues, please create new tickets for them, as this one is quite old and the main issues seem to be resolved. Woo! |
I just built the docs for poliastro in rtd and it works like a charm 😄 Thanks to @mrocklin and Clinical Graphics for this! |
Just a quick notice: right now RTD uses docutils 0.11, which is not yet available for Python 3.5 for linux. http://readthedocs.org/projects/poliastro/builds/3655474/
Packages: https://anaconda.org/anaconda/docutils/files?version=0.11 |
(Sorry, my above comment was already reported as #1901) |
@Juanlu001, see ( #1933 ). |
#1947 is the fix for that issue. I will get it merged & deployed today. |
I tried the using conda environment with fretbursts to see if I can get rid of the mocking layer. However, building the docs fails on RTD: http://readthedocs.org/projects/fretbursts/builds/3813468/ unless I reintroduce the mocking for scipy: |
@tritemio it would be best if you opened your issue as a bug, we won't be able to track it here. This was a feature addition that has been in production for a few months now. Closing this issue. Please address bugs with additional tickets. |
@agjohnson, it makes sense. I opened a new issue #2074 |
Read the Docs Conda Support
This will add the ability to generate documentation with conda environments on Read the Docs. This is mainly useful for libraries with large C dependencies, including many packages in the Scentific Python ecosystem.
Task List
Abilities
You will be able to specify a conda environment.yml file,
and Read the Docs will install these dependencies in your build environment.
Considerations
Read the Docs will keep seperate virtualenv & conda directories:
Users will be able to define a way to install packages for a project:
Read the Docs will need to change it's build code so that we don't hard-code virtualenv paths. We'll need to vary our environment creation, as well as bin path's for executables, based on the backend environment.
The other main thing is that we'll also need to install Sphinx & other build dependencies into the conda environment. We will continue to use pip for this, and it should be transparent, other than using the pip executable in the conda environment instead of the virtualenv.
It should also be noted that
miniconda
has a different install process from Python 2 and 3 -- also they recommend installing it from their bash scripts instead of pip. I hope that we will be able to use pip, as it will simplify our installation, and won't require an update to a bash script on version upgrades. We will have to see if we hit issues in testing.Cleanup
Read the Docs will manage conda environment deletion on the removal of a project or version.
Documentation
We will need to add information about conda support to our documentation. We might want to add a topic guide around installing requirements, along with adding a specific reference for how to use & enable conda support.
Sponsorship
This work is being funded by Clinical Graphics -- many thanks for their support of Open Source.
The text was updated successfully, but these errors were encountered: