Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I use `pip` instead of `easy_install` for `python setup.py install` dependency resolution?

People also ask

Does setup py use pip?

The arguments and syntax of the various invocations of setup.py made by pip, are considered an implementation detail that is strongly coupled with setuptools. This build system interface is not meant to be used by any other build backend, which should be based on the pyproject. toml build system interface instead.

Does pip install dependencies of dependencies?

Pip will not flag dependency conflicts. As a result, it will happily install multiple versions of a dependency into your project, which will likely result in errors.

What can I use instead of pip to install?

npm, Homebrew, Yarn, RequireJS, and Bower are the most popular alternatives and competitors to pip.

How install pip using setup py?

Installing Python Packages with Setup.py To install a package that includes a setup.py file, open a command or terminal window and: cd into the root directory where setup.py is located. Enter: python setup.py install.


Yes you can. You can install a package from a tarball or a folder, on the web or your computer. For example:

Install from tarball on web

pip install https://pypi.python.org/packages/source/r/requests/requests-2.3.0.tar.gz

Install from local tarball

wget https://pypi.python.org/packages/source/r/requests/requests-2.3.0.tar.gz
pip install requests-2.3.0.tar.gz

Install from local folder

tar -zxvf requests-2.3.0.tar.gz
cd requests-2.3.0
pip install .

You can delete the requests-2.3.0 folder.

Install from local folder (editable mode)

pip install -e .

This installs the package in editable mode. Any changes you make to the code will immediately apply across the system. This is useful if you are the package developer and want to test changes. It also means you can't delete the folder without breaking the install.


You can pip install a file perhaps by python setup.py sdist first. You can also pip install -e . which is like python setup.py develop.


If you are really set on using python setup.py install you could try something like this:

from setuptools import setup, find_packages
from setuptools.command.install import install as InstallCommand


class Install(InstallCommand):
    """ Customized setuptools install command which uses pip. """

    def run(self, *args, **kwargs):
        import pip
        pip.main(['install', '.'])
        InstallCommand.run(self, *args, **kwargs)


setup(
    name='your_project',
    version='0.0.1a',
    cmdclass={
        'install': Install,
    },
    packages=find_packages(),
    install_requires=['simplejson']
)