Questions tagged [distutils]

Distutils is the standard packaging system for Python modules and applications.

Distutils is the standard packaging system for Python modules and applications.

It has many high and low level features used to build, distribute and install Python projects. The official documentation page provides a good overview of its capabilities.

1123 questions
24
votes
1 answer

Using setuptools to create a cython package calling an external C library

I am trying to compile, install and run a package that we'll call myPackage. It contains a *.pyx file that calls the function fftw_set_timelimit() from library fftw. Currently, when I run a script clientScript.py that imports the package I obtain…
Gael Lorieul
  • 3,006
  • 4
  • 25
  • 50
24
votes
5 answers

State of Python Packaging: Buildout, Distribute, Distutils, EasyInstall, etc

The last time I had to worry about installing Python packages was two years ago working with Enthought, NumPy and MayaVi2. That experience gave me lingering nightmares related to quirky behavior installing & updating Python packages in non-standard…
Pete
  • 10,310
  • 7
  • 53
  • 59
24
votes
3 answers

Python "setup.py develop": is it possible to create ".egg-info" folder not in source code folder?

Python has ability to "pseudoinstall" a package by running it's setup.py script with develop instead of install. This modifies python environment so package can be imported from it's current location (it's not copied into site-package directory).…
grigoryvp
  • 40,413
  • 64
  • 174
  • 277
23
votes
1 answer

How to pass flag to gcc in Python setup.py script?

I'm writing a Python extension in C that requires the CoreFoundation framework (among other things). This compiles fine with: gcc -o foo foo.c -framework CoreFoundation -framework Python ("-framework" is an Apple-only gcc extension, but that's okay…
Michael
  • 4,700
  • 9
  • 35
  • 42
23
votes
3 answers

How can I install Python modules programmatically / through a Python script?

Can I download and install Python modules from PyPi strictly inside a script, without using a shell at all? I use a non-standard Python environment, Autodesk Maya's Python interpreter. This does not come with "easy_install," and there is no "shell,"…
DoctorPangloss
  • 2,994
  • 1
  • 18
  • 22
23
votes
1 answer

How to build a Python C Extension so I can import it from a module

I have a Python project with many sub-modules that I package up with distutils. I would like to build some Python extensions in C to live in some of these sub-modules but I don't understand how to get the Python extension to live in a submodule. …
Rich
  • 12,068
  • 9
  • 62
  • 94
22
votes
2 answers

graphlab-create 2.1 installation fails to uninstall 'certifi', a distutils installed project

I have installed Anaconda3 on a Windows 8.1 Laptop and wanted to install GraphLab-Create 2.1. When I follow the Installation procedure from Turi, an Anaconda2 is installed as well, which is not what I want. From within Anaconda3 Navigator 1.8.3 I…
Felix
  • 323
  • 1
  • 2
  • 6
22
votes
2 answers

python/c++ - Compiling shared library with cmake and installing with distutils

I have a boost.python project that I compile using cmake and make. It's part of a python module, and I want to be able to install that module using distutils. I have followed the instructions here to create a CMakeLists.txt file that first compiles…
orentago
  • 578
  • 1
  • 7
  • 13
21
votes
5 answers

Python can't locate distutils_path on Mac OSX

I've been using virtualenv + pip for python development. I'm not sure what happened, but suddenly whenever I try to run a command-line tool or import libraries, I get this error message: Traceback (most recent call last): File…
Kyle Fox
  • 3,133
  • 4
  • 23
  • 26
21
votes
5 answers

Collapse multiple submodules to one Cython extension

This setup.py: from distutils.core import setup from distutils.extension import Extension from Cython.Build import cythonize extensions = ( Extension('myext', ['myext/__init__.py', 'myext/algorithms/__init__.py', …
Reinderien
  • 11,755
  • 5
  • 49
  • 77
21
votes
2 answers

How to specify C++11 with distutils?

I have a module that needs to be compiled with C++11. On GCC and Clang, that means a std=c++11 switch, or std=c++0x on older compilers. Python is not compiled with this switch so Distutils doesn't include it when compiling modules. What is the…
Adam
  • 16,808
  • 7
  • 52
  • 98
21
votes
2 answers

How does `setup.py sdist` work?

I'm trying to make a source distribution of my project with setup.py sdist. I already have a functioning setup.py that I can install with. But when I do the sdist, all I get is another my_project folder inside my my_project folder, a MANIFEST file I…
Ram Rachum
  • 84,019
  • 84
  • 236
  • 374
21
votes
2 answers

Run custom task when call `pip install`

I want to make my python package "pip installable". The problem is that the package has shell script that must be sourced in the user's init shell script (e.g. .bashrc). But after the installation, the user don't exactly know where the script went…
borges
  • 3,627
  • 5
  • 29
  • 44
21
votes
3 answers

python distutils not include the SWIG generated module

I am using distutils to create an rpm from my project. I have this directory tree: project/ my_module/ data/file.dat my_module1.py my_module2.py src/ header1.h …
microo8
  • 3,568
  • 5
  • 37
  • 67
20
votes
2 answers

How does one overwrite the default compile flags for Cython when building with distutils?

I am compiling some cython extensions in linux and noticed that it defaults to using -O2 when building from the distutils mechanism. I was wondering if there was a simple way to change that to a -O3. I have tried using the extra_compile_args on…
Voltaire
  • 1,375
  • 4
  • 17
  • 22