Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does `setup.py develop` not work?

I would like to install my Python module in development mode. As I have seen in many examples python setup.py develop is supposed to do that. But the develop command does not exist for my setup.py file:

from distutils.core import setup
from distutils.extension import Extension
from Cython.Build import cythonize
from Cython.Distutils import build_ext

import os

src = ["_NetworKit.pyx"]    # list of source files
modules = [Extension("_NetworKit",
                    src,
                    language = "c++",
                    extra_compile_args=["-fopenmp", "-std=c++11", "-O3", "-DNOGTEST"],
                    extra_link_args=["-fopenmp", "-std=c++11"],
                    libraries=["NetworKit-Core-O"],
                    library_dirs=["../"])]

for e in modules:
    e.cython_directives = {"embedsignature" : True}

setup(name="_NetworKit",
     cmdclass={"build_ext": build_ext},
     ext_modules=modules,
     py_modules = ["NetworKit.py"])

(Note the Cython extension module).

What am I missing? Do I need to modify the setup.py?

like image 452
clstaudt Avatar asked Jan 08 '14 13:01

clstaudt


People also ask

How do I run python 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.

Is setup py outdated?

py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools. I found a very detailed write-up explaining this issue: "Why you shouldn't invoke setup.py directly" (October 2021).

What does python setup py develop?

For your own stuff, you want to first install your package and then be able to frequently edit the code without having to re-install the package every time — and that is exactly what python setup.py develop does: it installs the package (typically just a source folder) in a way that allows you to conveniently edit your ...

Does pip install use setup py?

@joeforker, pip uses setup.py behind the scenes.


1 Answers

The develop command is a part of setuptools. Install setuptools and replace the first line in setup.py with this:

from setuptools import setup
like image 152
tuomur Avatar answered Oct 22 '22 13:10

tuomur