Cogito Ergo Sum
Cogito Ergo Sum

Reputation: 780

setup.py is not install dependencies

I am trying to create a command line utility that can be installed via pip install git+https://github.com/project/neat_util.git@master#egg=neat_util and I am testing locally with python setup.py install.

import os
import pathlib

import setuptools

with open("README.md", "r", encoding="utf-8") as fh:
    long_description = fh.read()

setuptools.setup(
    name="neat_util",
    version="1.0.0",
    author="Cogito Ergo Sum",
    author_email="[email protected]",
    description="Util for utilization",
    long_description=long_description,
    long_description_content_type="text/markdown",
    url="https://gitlab.com/project/repo",
    classifiers=[
        "Programming Language :: Python :: 3"
    ],
    package_dir={"": "bin"},
    packages=setuptools.find_packages(where="bin"),
    include_package_data=True,,
    dependency_links=['git+https://github.com/company/dependency.git@master#egg=dependency'],
    python_requires=">=3.6",
    scripts=['bin/neat_util']
)

When I test this locally, it installs fine and I can invoke it from the command line but I get a ModuleNotFoundError" No module named dependency error.

The github url appears to be correct based off of the documentation here https://pip.pypa.io/en/stable/topics/vcs-support/ specifically git+https://git.example.com/MyProject.git@master#egg=MyProject

Running pip install git+https://github.com/company/dependency.git@master#egg=dependency actually works as well so I feel confident that the url isn't the issue.

Project structure:

├── bin
│   ├── script1
│   ├── script2
│   ├── script3
│   ├── neat_util
│   ├── script4
│   └── script5
├── collections.csv
├── config.cfg
├── config.cfg.example
├── env.sh
├── env.sh.example
├── example.csv
├── main.py
├── README.md
├── requirements.txt
├── setup.py
└── tests

Any pointers here would be appreciated.

Upvotes: 2

Views: 957

Answers (1)

phd
phd

Reputation: 94406

dependency_links were declared obsolete and finally removed in pip 19.0. The replacement for it is install_requires with special syntax (supported since pip 19.1):

install_requires=[
    'dependency @ git+https://github.com/company/dependency.git@master',
]

See https://www.python.org/dev/peps/pep-0440/#direct-references

This requires pip install including pip install . and doesn't work with python setup.py install.

Upvotes: 2

Related Questions