Remove setuptools dependency on Windows #539

minrk opened this Issue Jun 25, 2011 · 5 comments


None yet

2 participants

minrk commented Jun 25, 2011

setuptools was added as an install and runtime dependency in 0.11 on Windows by PR #536, but when someone has time this dependency should be removed, and plain distutils installation should be fixed, including '.bat' files, etc.

See #351 and #369 for more information.


Going through your for some inspiration I bumped into a mention of this issue.

If you look at how Continuum Anaconda handles Python scripts (.bat files as you mention in Anaconda/Scripts), this suggests a fix for this problem.

Something along these lines does it for me:

def windows_prepare(scripts):
    bat = ['@echo off\n',
          'set PYFILE=%~f0\n',
          'set PYFILE=%PYFILE:~0,\n'
          '"python.exe" "%PYFILE%" %*\n']

    windows_scripts = []
    windows_bat_files = []

    for script in scripts:
        with open(script+'.bat', "w") as f:
            for string in bat:

    for script, script_w in zip(scripts, windows_scripts):
        shutil.copy(script, script_w)

    return windows_scripts+windows_bat_files

if os_name == 'windows':
    scripts = windows_prepare(scripts)

Plus some cleanup of the and .bat files this created.

minrk commented Nov 22, 2013

Thanks, there's hope for dropping the setuptools entry points, yet! Is python.exe right? shouldn't it be sys.executable, since PATH is not trustworty?


Good call and you're most likely correct. In Anaconda/Scripts you'll find that they call the nearest python.exe in a parent directory. This might be safest to do?

minrk commented Nov 22, 2013

that ought to be the right thing to do for an installed script, certainly.

@minrk minrk modified the milestone: 3.0, wishlist Nov 11, 2014
minrk commented Nov 11, 2014

Fixed by #6899

@minrk minrk closed this Nov 11, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment