"Can't get a consistent path to setup script from installation directory"

For future folk, if you're using an older version of setuptools on windows 10 and it looks like it has an extra slash, you need to update the python package 'setuptools' to get around this windows 10 python bug

you can update any number of ways, but one is python -m pip install --upgrade setuptools


You need to have a pyproject.toml file in your package. I have no idea why this makes the error go away, but it works. This file is part of PEP 518 "Specifying Minimum Build System Requirements for Python Projects".

You can have your package in a src subfolder if you have a pyproject.toml in your project:

/src/yourpackage/__init__.py
/setup.py
/pyproject.toml

I have no idea why this works, but it makes the error message go away when you run pip install -e . to install the package in "editable" mode. The file doesn't even have to have anything in it, it can be a blank file and the error goes away.

(To figure this out, I found a working project that had its package stored under a src folder and kept deleting things until I got that error. This is clearly some bug in Pip. I have version 18.1 on Windows 10 for Python 3.7 on my machine.)


It is because the flag -e means "editable", and it is the same doing python setup.py develop, that creates a symbolic link from <PACKAGE_NAME_LOWERCASE> to your site-packages directory and not running an usual installation.

Looking at SpiffWorkflow's setup.py I can see where the problem relies:

srcdir = join(dirname(__file__), 'src')
setup(...,
      package_dir      = {'': srcdir})

It says that the package content is located at src, instead of spiffworkflow (what develop mode expects).

You can just drop the -e flag and be happy:

pip install git+git://github.com/knipknap/SpiffWorkflow.git@master#egg=SpiffWorkflow-dev

References:

  • https://github.com/pypa/pip/issues/126
  • http://packages.python.org/distribute/setuptools.html#develop
  • https://bitbucket.org/tarek/distribute/issue/177/setuppy-develop-