Skip to content
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

Setuptools install fails with PEP508 URLs #1983

Open
davidwilby opened this issue Jan 30, 2020 · 6 comments
Open

Setuptools install fails with PEP508 URLs #1983

davidwilby opened this issue Jan 30, 2020 · 6 comments

Comments

@davidwilby
Copy link

setuptools v 45.1.0
pip v 20.0.2

Running python setup.py install for a setup.py which includes PEP508 format URLs in the install_requires field results in failure.
for example if keras @ https://github.com/MarcBS/keras/archive/master.zip is in the install_requires field then setuptools fails to find it, and looks on PyPI instead, installing a matching package (in this case 'keras').
However, running pip install . for the same setup.py succeeds, similarly with pip install keras @ https://github.com/MarcBS/keras/archive/master.zip.

If setuptools always uses pip to install dependencies, then why does it fail for PEP508 URL dependencies when pip is able to do this?

In summary:

  • pip install . works ✔️
  • pip install 'keras @ https://github.com/MarcBS/keras/archive/master.zip' works ✔️
  • python setup.py install fails ❌

(further to this, PyPI throws an error when uploading a package with a setup.py containing PEP 508 dependency links)

@iambibhas
Copy link

Been breaking my head over this for few days. Now that dependency_links support is gone, can no longer add a requirement inside setup.py that depends on a github repo.

@semiversus
Copy link

semiversus commented Feb 10, 2020

I had the same problem and was confused, that sometimes you find references that PEP508 urls solves the problem - and it does (at least I think so). I hope the following solution is a help for you. Otherwise, I may support you as I was also digging into the problem for days.

What's important: You need an up to date version of pip and setuptools. And here is the catch: When creating a virtual environment, an old version of pip (9.0.1) and setuptools (39.0.1) is used (also when your system pip is newer). Try to update pip and setuptools after generating your virtual environment:

pip install pip setuptools -U

@semiversus
Copy link

Hold on - I'm wrong. I still have the same problem as @davidwilby reported. Was using pip install . which is working.

What's interesting is that installing a package containing a PEP508 referenced URL is working (this is involving setup.py).

This example is working and setup.py contains a PEP508 urls:

pip install git+https://github.com/davidwilby/nmt-keras.git

@pganssle
Copy link
Member

Our policy to date has been that if using pip install fixes your problem, you should use pip install and we won't fix the issue.

Direct invocations of setup.py install are not the right thing to do, despite the fact that there is a lot of misleading documentation out there indicating that it is.

We to need to work out a plan for actively deprecating and then removing setup.py install to try to get the word out, though.

If someone wants to try to figure out why this is happening, feel free, but it's not clear that we would be willing to accept a PR fixing it if it comes with any additional maintenance burden.

@semiversus
Copy link

@pganssle Thanks for the clarification!

@drj11
Copy link

drj11 commented Feb 10, 2020

hmm, that is an interesting position, given that for many of us python setup.py install is muscle memory and our fingers type it without thinking.

If pip install is the only supported route now, can that policy be documented somewhere?

Does that also apply to pip wheel versus python setup.py bdist wheel too?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants