distutils

How can I make setuptools install a package from another source that's also available on pypi with the same version number?

こ雲淡風輕ζ 提交于 2019-11-30 08:03:39
It's a similar question to How can I make setuptools install a package that's not on PyPI? but not the same. As I would like to use the forked version of some package, setuptools ignore the dependency link (as it has the same version number). Is there a way to force using the link from the dependency_links? Or is the only way to change the version number in the forked repo? requires = [ ... 'pyScss==1.1.3' ... dependencies = [ 'https://github.com/nadavshatz/pyScss/zipball/master#egg=pyScss-1.1.3' ] Update Weird, apparently it works if this package is the only one in the required list, that is

Python runtime_library_dirs doesn't work on Mac

混江龙づ霸主 提交于 2019-11-30 05:42:49
I have a Python extension module that needs to link against some dynamic libraries at runtime, so I need to tell it where to look for them. I'm doing this by specifying runtime_library_dirs in my setup.py. This works fine on Linux, but seems to have no effect on Mac. I get an ImportError when I try to import my module, and the only way I've found to make it go away is to add the library directory to DYLD_LIBRARY_PATH before starting python. What do I need to do to make this work? I finally figured this out. The solution has two parts. First, setup.py needs to use extra_link_args to tell the

LNK1181: cannot open input file 'm.lib'

孤街浪徒 提交于 2019-11-30 04:02:27
问题 When trying to install a certain Python geophysical toolkit, I get this error: LINK : fatal error LNK1181: cannot open input file 'm.lib' I believe it is due to my use of the MSVC's buildtools. In their setup.py I found: setup(…, ext_modules=[ Extension(…, […], libraries=['m'], … ]) What do I need to change in this setup.py —and related files?—to make this work. IIRC there is a library other than m which I am to use. 回答1: On Windows, the standard math functions are handled by MSVCR: >>> from

2 techniques for including files in a Python distribution: which is better?

邮差的信 提交于 2019-11-30 04:01:55
I'm working on packaging a small Python project as a zip or egg file so that it can be distributed. I've come across 2 ways to include the project's config files, both of which seem to produce identical results. Method 1: Include this code in setup.py: from distutils.core import setup setup(name='ProjectName', version='1.0', packages=['somePackage'], data_files = [('config', ['config\propFiles1.ini', 'config\propFiles2.ini', 'config\propFiles3.ini'])] ) Method 2: Include this code in setup.py: from distutils.core import setup setup(name='ProjectName', version='1.0', packages=['somePackage'] )

Running custom setuptools build during install

若如初见. 提交于 2019-11-30 03:23:05
问题 I've tried to implement Compass compiling during setuptools' build , but the following code runs compilation during explicit build command and doesn't runs during install . #!/usr/bin/env python import os import setuptools from distutils.command.build import build SETUP_DIR = os.path.dirname(os.path.abspath(__file__)) class BuildCSS(setuptools.Command): description = 'build CSS from SCSS' user_options = [] def initialize_options(self): pass def run(self): os.chdir(os.path.join(SETUP_DIR,

How can I get my setup.py to use a relative path to my files?

a 夏天 提交于 2019-11-30 01:50:36
问题 I'm trying to build a Python distribution with distutils . Unfortunately, my directory structure looks like this: /code /mypackage __init__.py file1.py file2.py /subpackage __init__.py /build setup.py Here's my setup.py file: from distutils.core import setup setup( name = 'MyPackage', description = 'This is my package', packages = ['mypackage', 'mypackage.subpackage'], package_dir = { 'mypackage' : '../mypackage' }, version = '1', url = 'http://www.mypackage.org/', author = 'Me', author_email

Shared library dependencies with distutils

被刻印的时光 ゝ 提交于 2019-11-30 00:23:36
I'm a newbie to distutils and I have a problem that really has me stuck. I am compiling a package that requires an extension, so I make the extension thus: a_module = Extension( "amodule", ["initmodule.cpp"], library_dirs=libdirs, extra_objects = [ "unix/x86_64/lib/liba.so" "unix/x86_64/lib/lib.so", "unix/x86_64/lib/libc.so"], ) I then run the setup method: setup(name="apackage", version="7.2", package_dir = {'':instdir+'/a/b/python'}, packages=['apackage','package.tests'], ext_modules=[hoc_module] ) The package distribution is made properly and I can "python setup.py install" fine but when I

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

我只是一个虾纸丫 提交于 2019-11-30 00:13:24
问题 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 my project always has people adding examples and I want it to be easy to list them from within my application. I can get it work for any FILE within examples, but not re-curse down through sub-directories. Is this possible? 回答1: I believe what you're looking for is something like this

install_requires based on python version

荒凉一梦 提交于 2019-11-29 22:53:13
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 can one make that? setuptools has support for this using environment markers . install_requires=[ 'enum34;python_version<"3.4"', 'pywin32 >= 1.0;platform_system=="Windows"' ] Use of this is detailed in the official documentation . Based on the change log was added in v20.5, but the implementation wasn't stable until v20.8.1 (which was only a gap of 15 days).

pip 10 and apt: how to avoid “Cannot uninstall X” errors for distutils packages

纵然是瞬间 提交于 2019-11-29 22:12:40
I am dealing with a legacy Dockerfile. Here is a very simplified version of what I am dealing with: FROM ubuntu:14.04 RUN apt-get -y update && apt-get -y install \ python-pip \ python-numpy # ...and many other packages RUN pip install -U pip RUN pip install -r /tmp/requirements1.txt # includes e.g., numpy==1.13.0 RUN pip install -r /tmp/requirements2.txt RUN pip install -r /tmp/requirements3.txt First, several packages are installed using apt , and then several packages are installed using pip . pip version 10 has been released, and part of the release is this new restriction: Removed support