how to make "python setup.py install" install source instead of egg file?
Asked Answered
M

1

7

I used to run python setup.py install in a python project, it will just move the source to site-packages, but sometimes it will mv an egg file to site-packages?

#!/usr/bin/env python
# encoding: utf-8

from setuptools import setup,find_packages

setup(
    name = "ipin_rpc_gen_vector",
    version = "0.0.2",
    packages = find_packages("src"),
    package_dir={"":"src"},
    install_requires=[

    ],
)

So what is the difference behind this? When will it install source, when will it just install egg file? How can I force install source instead of egg file?

Maishamaisie answered 8/10, 2015 at 11:24 Comment(5)
What are you actually trying to achieve? If you want to modify the source code and see what changes, use python setup.py develop.Inexorable
Relevant: https://mcmap.net/q/271805/-what-is-the-advantage-of-setting-zip_safe-to-true-when-packaging-a-python-projectAramanta
Relevant: https://mcmap.net/q/666194/-is-zip_safe-only-relevant-for-the-egg-formatAramanta
Relevant: https://mcmap.net/q/635465/-why-does-easy_install-extract-some-python-eggs-and-not-othersAramanta
Relevant: https://mcmap.net/q/666196/-why-doesn-39-t-my-python-2-6-auto-unzip-egg-files-on-importAramanta
D
10

You have to set the zip_safe flag to False if you want to avoid the zip (egg) behaviour.

You can read more about it at https://setuptools.readthedocs.io/en/latest/userguide/miscellaneous.html#setting-the-zip-safe-flag.

Also check out https://setuptools.readthedocs.io/en/latest/userguide/keywords.html#new-and-changed-setup-keywords and the *_package_data flags (also at: https://setuptools.readthedocs.io/en/latest/references/keywords.html).

Donndonna answered 8/10, 2015 at 11:28 Comment(1)
Numpy uses this python instruction to install : setup(**metadata) so I added zip_safe= False, in the metadata dict and ran python setup install but it still produced an egg file instead of installing the module files in /usr/local/lib/python2.7/site-packages/numpy/Marshallmarshallese

© 2022 - 2024 — McMap. All rights reserved.