• 6

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191


File: /home/prodcxja/public_html/questions/application/views/question.php
Line: 191
Function: _error_handler

File: /home/prodcxja/public_html/questions/application/controllers/Questions.php
Line: 433
Function: view

File: /home/prodcxja/public_html/questions/index.php
Line: 315
Function: require_once

I have a python library. Unfortunately I have not updated it to work with python 3 yet.

in its setup.py, I added


My intent was to not allow this package to be installed / used under python 3, because I know it doesn't (yet) work. I don't think this is the right way to do it, because pip then tries to download and install python 2.7.3 (which is already the installed version!).

How should I specify my library dependency on a particular range of python interpreter versions? Should I add a Programming Language :: Python :: 2 :: Only tag? Will this actually prevent installation under python 3? What if I also want to restrict the minimum version to python 2.6?

I'd prefer a solution that works everywhere, but would settle for one that only works in pip (and hopefully doesn't cause easy_install to choke).

a possible solution is to test for the python version, since pip can't satisfy the python version except for the version it's currently running in (it installs in the current python environment):

import sys
if not sys.version_info[0] == 2:
    sys.exit("Sorry, Python 3 is not supported (yet)")

  • 19
Reply Report
      • 2
    • True, that would work. It'd be much nicer to have something built into the dependencies though, so that pip would know up-front not to bother downloading and running the installer.
      • 2
    • Why not both? Your answer is what one should not do but rather rely on the builtin features, although using this answer additionally to the python_requires would be great! You may update that?

Trending Tags