After uploading a binary distribution of my Python C extension with python setup.py bdist upload
, easy_install [my-package-name]
fails on "error: Couldn't find a setup script in /tmp/easy_install/package-name-etc-etc".
What am I doing wrong?
After uploading a binary distribution of my Python C extension with python setup.py bdist upload
, easy_install [my-package-name]
fails on "error: Couldn't find a setup script in /tmp/easy_install/package-name-etc-etc".
What am I doing wrong?
This may not be related to your specific problem, but I am providing this information in case it is helpful to others.
I hit exactly this error when running easy_install xyz
. The problem turned out to be that I had a subdirectory named xyz
in the current working directory and easy_install was expecting to find a setup script locally in that subdirectory instead of going out to the web to get the real xyz
. Renaming my local xyz directory temporarily fixed the problem.
This is one of a number of situations in which the command line argument you provide can be unintentionally shadowed by a file or folder of the same name. Another example is make
: if you run make test
in an attempt to make your test target and you happen to have a folder named test
then make
will not do what you want. The solution in that case is to indicate Phony Targets.
easy_install expects to find either a source distribution, or an egg. It's best to upload source distributions (sdist
) to PyPI (or whatever distribution server you are using), and only upload eggs if your python package contains C extensions, and then only for Windows eggs (see my answer to Can I create a single egg for multiple versions of python?).
The bdist
command, without additional configuration, creates a .tar.gz
or .zip
archive containing the compiled python files (and any C extensions compiled) for your current platform, sans installer (so not including the setup.py
file). It's intended for unpacking by hand in your site-packages location and pre-dates distribution via eggs. If you were to unzip it, you'll notice it even included the full, absolute path to your site-packages directory in the tarball!
You can configure bdist
to generate a RPM or a .deb file, or a simple Windows installer, but these are again aimed at providing installation bundles for other distribution systems not related to PyPI and easy_install.
So, to summarize, in most cases it's best to upload an sdist
source distribution and have easy_install do the python compilation (into an egg) on installation.
If you do want to upload a pre-compiled distribution (which is then tied to specific Python version and the platform for which it was compiled), use the bdist_egg
command instead.
Sometimes you don't actually really intend to easy_install the 'directory', which will look for a setup.py file.
In simple words, you may be doing easy_install xyz/
while what you really want to do is easy_install xyz
© 2022 - 2024 — McMap. All rights reserved.
cd ..
and trying easy_install again from a different cwd. I'd recommend testing this before looking at Martijn's answer, because it's an easy gotcha. – Zoochore