{"action":"created","issue":{"url":"https://api.github.com/repos/rtfd/readthedocs.org/issues/1364","labels_url":"https://api.github.com/repos/rtfd/readthedocs.org/issues/1364/labels{/name}","comments_url":"https://api.github.com/repos/rtfd/readthedocs.org/issues/1364/comments","events_url":"https://api.github.com/repos/rtfd/readthedocs.org/issues/1364/events","html_url":"https://github.com/rtfd/readthedocs.org/issues/1364","id":89982838,"number":1364,"title":"Alter order of processing dependencies","user":{"login":"NYKevin","id":1929766,"avatar_url":"https://avatars.githubusercontent.com/u/1929766?v=3","gravatar_id":"","url":"https://api.github.com/users/NYKevin","html_url":"https://github.com/NYKevin","followers_url":"https://api.github.com/users/NYKevin/followers","following_url":"https://api.github.com/users/NYKevin/following{/other_user}","gists_url":"https://api.github.com/users/NYKevin/gists{/gist_id}","starred_url":"https://api.github.com/users/NYKevin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NYKevin/subscriptions","organizations_url":"https://api.github.com/users/NYKevin/orgs","repos_url":"https://api.github.com/users/NYKevin/repos","events_url":"https://api.github.com/users/NYKevin/events{/privacy}","received_events_url":"https://api.github.com/users/NYKevin/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rtfd/readthedocs.org/labels/Needed:%20design%20decision","name":"Needed: design decision","color":"54473F"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-06-22T01:00:31Z","updated_at":"2015-07-11T06:20:41Z","closed_at":null,"body":"See [this build](https://readthedocs.org/builds/nbtparse/2980385/), and in particular, note this information:\r\n\r\n    Collecting alabaster<0.8,>=0.7 (from sphinx==1.3.1)\r\n      Using cached alabaster-0.7.5.tar.gz\r\n\r\nMy documentation does not build with Alabaster 0.7.5 because of #1350.  But my requirements explicitly specify 0.7.4:\r\n\r\n    Collecting alabaster==0.7.4 (from -r doc_reqs.txt (line 1))\r\n\r\nRead The Docs, ideally, should not install things the user did not ask for.  I asked for 0.7.4, so I should get 0.7.4, not some other version.  These docs build fine locally, because I have the right version of Alabaster.  I imagine this problem affects everyone on Python 3.\r\n\r\nAccording to the output, this is likely because Read The Docs is installing Sphinx into the virtualenv before it installs my requirements, so it ends up grabbing something I didn't ask for.  **Option one** would be to install project requirements first, and the basic Sphinx etc. requirements afterwards.  This is trivially accomplished; just move [this function call](https://github.com/rtfd/readthedocs.org/blob/master/readthedocs/projects/tasks.py#L346) down to [here](https://github.com/rtfd/readthedocs.org/blob/master/readthedocs/projects/tasks.py#L379), and remove the `-U` flag.  Since the virtualenv is created anew every time, that flag isn't doing anything anyway (Pip will already replace an existing package with a different version if asked).  The downside is that this will override the versions of Sphinx etc. specified in the project's requirements, which is bad.\r\n\r\nIf we removed the version specifiers from the list [here](https://github.com/rtfd/readthedocs.org/blob/master/readthedocs/projects/tasks.py#L331) (so it's just a list of package names), that wouldn't happen, but then Read The Docs wouldn't have a consistent environment.  On the other hand, the `-U` flag suggests you actually *want* that, so I'm not entirely sure what the intent here is in the first place.\r\n\r\nAs a compromise, we could change those version specifiers into a different kind of specifier, such as [`sphinx~=1.3.1`](http://legacy.python.org/dev/peps/pep-0440/#compatible-release) (basically meaning \"You can specify your own version of Sphinx, but it can't be too old or too new, and we'll use the latest compatible one if you don't ask for anything,\" assuming we also move the call down as described above).  Note that Pip never installs pre-releases unless explicitly asked with `--pre`, so this won't grab some randomly broken trunk snapshot by mistake.\r\n\r\n**Option two** would be to check whether Sphinx (etc.) is already installed in the project requirements, and skip it if so.  We can do this by calling `pip show sphinx` and checking for output, or grepping the output of `pip freeze` for packages we need.  This has the downside of being significantly more involved (more code, checking the output of commands, etc.).\r\n\r\nGoing the really crazy route (**option three**), we could parse the user's requirements file and try to merge it with Read The Docs' requirements.  I think this is a Bad Idea because it's particularly convoluted compared to the other solutions with no obvious upside.  Pip already knows how to read these files.  Trying to outsmart it is, I think, a poor choice.\r\n\r\nThe \"quick fix\" (**option four**?) is to specify `alabaster==0.7.4` in the list, but that's #1350, not this bug, and a variation of this has [already been rejected](https://github.com/rtfd/readthedocs.org/issues/1350#issuecomment-113069610).\r\n\r\nI originally reported this as #1359, but I badly misdiagnosed the issue and did a poor job of explaining the problem, so I'm re-reporting it with a brand-new description.  I apologize if opening multiple issues is excessive in this case."},"comment":{"url":"https://api.github.com/repos/rtfd/readthedocs.org/issues/comments/120583907","html_url":"https://github.com/rtfd/readthedocs.org/issues/1364#issuecomment-120583907","issue_url":"https://api.github.com/repos/rtfd/readthedocs.org/issues/1364","id":120583907,"user":{"login":"rbtcollins","id":499678,"avatar_url":"https://avatars.githubusercontent.com/u/499678?v=3","gravatar_id":"","url":"https://api.github.com/users/rbtcollins","html_url":"https://github.com/rbtcollins","followers_url":"https://api.github.com/users/rbtcollins/followers","following_url":"https://api.github.com/users/rbtcollins/following{/other_user}","gists_url":"https://api.github.com/users/rbtcollins/gists{/gist_id}","starred_url":"https://api.github.com/users/rbtcollins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rbtcollins/subscriptions","organizations_url":"https://api.github.com/users/rbtcollins/orgs","repos_url":"https://api.github.com/users/rbtcollins/repos","events_url":"https://api.github.com/users/rbtcollins/events{/privacy}","received_events_url":"https://api.github.com/users/rbtcollins/received_events","type":"User","site_admin":false},"created_at":"2015-07-11T06:20:41Z","updated_at":"2015-07-11T06:20:41Z","body":"@NYKevin that error indicates that there is a versioned setup-requires on a newer setuptools than you have, and setuptools is bailing out (it can't handle that situation itself). upgrading your virtualenv package should get you a newer bundled setuptools, and that should get things going."}}