TransWikia.com

Building a python egg, first letter is incorrectly removed from root file/folder name

Stack Overflow Asked by Tim496 on July 22, 2020

I’m trying to build an egg for my python project using setuptools, however, whenever I build an egg all of the contents are built with the first letter if each file/folder removed.

For example, my parent folder is called dp which gets renamed to p. I.e. when I unzip the egg file, I see a parent folder named p and another folder named GG-INFO (these should be named dp and EGG-INFO respectively). All of the other folders inside folder p are named correctly.

This is an issue because I reference functions in modules within that folder – e.g. from dp.module import function which doesn’t work because it complains about not finding the folder dp (which is true since for some reason it’s been renamed p).

My setup.py file looks like this:

from setuptools import setup, find_packages
setup(
    name="dp",
    version="1.0",
    author="XXXX",
    author_email="XXXX",
    description="Data pipeline for XXX algorithm.",
    long_description_content_type="text/markdown",
    url="XXXX",
    packages=find_packages(),
    package_data={'': ['*.sql', '*.json', '*.txt']},
    include_package_data=True,
    classifiers=[
        "Programming Language :: Python :: 3"
    ],
    python_requires='>=3.6',
    install_requires=['argparse', 'boto3', 'datetime', 'mmlspark', 'pandas', 'pyspark', 'pypandoc', 'scikit-learn',
                      'numpy', 'googleads', 'mlflow']
)

I’ve tried renaming the parent directory and the same thing happens. I’m running this via PyCharm (updated to the latest version) on Mac OS Mojave.

Would appreciate any ideas on how to fix this.

File Structure

Renamed folders

One Answer

Give the wheel a try.

pip install wheel setuptools pip -U
pip wheel --no-deps --wheel-dir=build .

Answered by Nathan Buckner on July 22, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP