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
59
votes
2 answers

install_requires based on python version

I have a module that works both on python 2 and python 3. In Python<3.2 I would like to install a specific package as a dependency. For Python>=3.2. Something like: install_requires=[ "threadpool >= 1.2.7 if python_version < 3.2.0", ], How…
iTayb
  • 12,373
  • 24
  • 81
  • 135
57
votes
3 answers

Optional dependencies in distutils / pip

When installing my python package, I want to be able to tell the user about various optional dependencies. Ideally I would also like to print out a message about these optional requirements and what each of them do. I haven't seen anything yet in…
Mike Cooper
  • 2,928
  • 2
  • 26
  • 29
50
votes
3 answers

Make distutils look for numpy header files in the correct place

In my installation, numpy's arrayobject.h is located at …/site-packages/numpy/core/include/numpy/arrayobject.h. I wrote a trivial Cython script that uses numpy: cimport numpy as np def say_hello_to(name): print("Hello %s!" % name) I also have…
Vebjorn Ljosa
  • 17,438
  • 13
  • 70
  • 88
48
votes
4 answers

make distutils in Python automatically find packages

When describing a python package in setup.py in distutils in Python, is there a way to make it so automatically get every directory that has a __init__.py in it and include that as a subpackage? ie if the structure is:…
user248237
47
votes
9 answers

Is it possible to include subdirectories using dist utils (setup.py) as part of package data?

Basically my python package is setup like: module \_examples \_folder1 \_file1.py \_file2.py \_folder2 \_file1.py \_file2.py Basically I want to just use: package_data = { 'module': ['examples/*'], }, because…
xamox
  • 2,599
  • 4
  • 27
  • 30
46
votes
2 answers

How do I point easy_install to vcvarsall.bat?

I already have MSVC++ 2010 Express installed, and my vcvarsall.bat file is at C:\Program Files\Microsoft Visual Studio 10.0\VC, which is in my system PATH. When I run easy_install, it can't find vcvarsall.bat. Is there something I need to set in my…
Mike M. Lin
  • 9,992
  • 12
  • 53
  • 62
45
votes
4 answers

Is it possible to express a platform-specific dependency in setup.py without building platform-specific versions of my egg?

We have a placeholder egg that contains no code and only exists for the sake of pulling down a list of dependent packages from our PyPi repository. Most of these dependent packages are platform-agnostic, however some are only used on Win32…
Daniel Fortunov
  • 43,309
  • 26
  • 81
  • 106
43
votes
3 answers

Python: How to force overwriting of files when using setup.py install (distutil)

I am using distutil to install my python code using python setup.py install I run into problems when I want to install an older branch of my code over a new one: setup.py install won't overwrite older files. A work around is touching (touch…
Jürgen Fuchsberger
  • 581
  • 1
  • 5
  • 10
42
votes
2 answers

How to overwrite pypi package when doing upload from command line?

I want to automate the upload process bug in some cases the python setup.py upload fails because pypi server already have the save version uploaded. How can I force it to upload, from the script (i know I can remove the old variant using the web…
sorin
  • 161,544
  • 178
  • 535
  • 806
42
votes
1 answer

Using Cython To Link Python To A Shared Library

I am trying to integrate a third party library written in C with my python application using Cython. I have all of the python code written for a test. I am having trouble finding an example for setting this up. I have a pyd/pyx file I created…
josephmisiti
  • 9,862
  • 11
  • 56
  • 72
41
votes
4 answers

AttributeError: module 'setuptools._distutils' has no attribute 'version'

I was trying to train a model using tensorboard. While executing, I got this error: $ python train.py Traceback (most recent call last): File "train.py", line 6, in from torch.utils.tensorboard import SummaryWriter File…
Anay
  • 741
  • 1
  • 5
  • 15
41
votes
4 answers

How to extend distutils with a simple post install script?

I need to run a simple script after the modules and programs have been installed. I'm having a little trouble finding straight-forward documentation on how to do this. It looks like I need to inherit from distutils.command.install, override some…
blokkie
  • 5,375
  • 7
  • 24
  • 18
39
votes
1 answer

How do I use data in package_data from source code?

In setup.py, I have specified package_data like this: packages=['hermes'], package_dir={'hermes': 'hermes'}, package_data={'hermes': ['templates/*.tpl']}, And my directory structure is roughly hermes/ | | docs/ | ... | hermes/ | |…
Scott
  • 10,407
  • 13
  • 37
  • 35
39
votes
2 answers

Confused about the package_dir and packages settings in setup.py

Here is my project directory structure, which includes the project folder, plus a "framework" folder containing packages and modules shared amongst several projects which resides at the same level in the hierarchy as the project folders: Framework/ …
Steve Sawyer
  • 1,785
  • 4
  • 18
  • 21
37
votes
2 answers

Is `setup.cfg` deprecated?

It's not completely clear to me, what is the status of setup.cfg. I am looking for solutions for my other question about PEP 508 environment markers, and I became totally confused. To me it seems that setup.cfg is an improvement over setup.py,…
toriningen
  • 7,196
  • 3
  • 46
  • 68
1 2
3
74 75