distutils

python setuptools install_requires is ignored when overriding cmdclass

旧城冷巷雨未停 提交于 2019-11-26 20:11:41
问题 I have a setup.py that looks like this: from setuptools import setup from subprocess import call from setuptools.command.install import install class MyInstall(install): def run(self): call(["pip install -r requirements.txt --no-clean"], shell=True) install.run(self) setup( author='Attila Zseder', version='0.1', name='entity_extractor', packages=['...'], install_requires=['DAWG', 'mrjob', 'cchardet'], package_dir={'': 'modules'}, scripts=['...'], cmdclass={'install': MyInstall}, ) I need

pip ignores dependency_links in setup.py

时光总嘲笑我的痴心妄想 提交于 2019-11-26 19:45:09
I have dependency_links in my setup.py: ... dependency_links = ['http://github.com/robot-republic/python-s3/tarball/master.tar.gz#egg=python-s3'], ... But it doesn't work. However install_requires works fine. Maybe there are another method to set up git repo as required for setup.py? Laur Ivan This answer should help. In a nutshell, you need to specify the version (or "dev") for the #egg=python-s3 so it looks like #egg=python-s3-1.0.0 . Updates based on @Cerin's comment: Pip 1.5.x has a flag to enable dependency-links processing: --process-dependency-links . I haven't tested it because I agree

How to tell distutils to use gcc?

雨燕双飞 提交于 2019-11-26 19:36:55
I want to wrap a test project containing C++ and OpenMP code with Cython, and build it with distutils via a setup.py file. The content of my file looks like this: from distutils.core import setup from distutils.extension import Extension from Cython.Build import cythonize from Cython.Distutils import build_ext modules = [Extension("Interface", ["Interface.pyx", "Parallel.cpp"], language = "c++", extra_compile_args=["-fopenmp"], extra_link_args=["-fopenmp"])] for e in modules: e.cython_directives = {"embedsignature" : True} setup(name="Interface", cmdclass={"build_ext": build_ext}, ext_modules

Make distutils look for numpy header files in the correct place

本小妞迷上赌 提交于 2019-11-26 19:11:27
问题 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 the following distutils setup.py (copied from the Cython user guide): from distutils.core import setup from distutils.extension import Extension from Cython.Distutils import build_ext ext_modules = [Extension("hello", ["hello.pyx"])] setup( name =

Collapse multiple submodules to one Cython extension

让人想犯罪 __ 提交于 2019-11-26 19:04:57
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', 'myext/algorithms/dumb.py', 'myext/algorithms/combine.py']) ) setup( name='myext', ext_modules=cythonize(extensions) ) Doesn't have the intended effect. I want it to produce a single myext.so , which it does; but when I invoke it via python -m myext.so I get: ValueError: Attempted relative import in non-package due to the fact that myext attempts to refer to .algorithms . Any idea how

Is it possible to require PyQt from setuptools setup.py?

99封情书 提交于 2019-11-26 18:22:38
问题 I'm building a small app that uses PyQt and tought it'd be nice to declare that dependency in setup.py. However, according to this blog (first hit on google for pyqt setuptools) says it can't be done, and the last paragraph here doens't try to do it either. Ideas? Perhaps I should switch to PySide which is on PyPi? Update: The obvious install_requires = [ 'pyqt >= 0.7' ] in setup.py gives me: D:\3rd\BuildBotIcon\my-buildboticon\python>setup.py test running test install_dir . Checking .pth

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

天大地大妈咪最大 提交于 2019-11-26 16:40:52
问题 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 because I'm using their specific framework anyway) How do I tell setup.py to pass this flag to gcc? I tried this, but it doesn't seem to work (it compiles, but then complains of undefined symbols when I try to run it): from distutils.core import

Custom distutils commands

 ̄綄美尐妖づ 提交于 2019-11-26 15:38:24
问题 I have a library called "example" that I'm installing into my global site-packages directory. However, I'd like to be able to install two versions, one for production and one for testing (I have a web application and other things that are versioned this way). Is there a way to specify, say "python setup.py stage" that will not only install a different egg into site-packages, but also rename the module from "example" to "example_stage" or something similar? If distutils cannot do this, is

How to copy directory recursively in python and overwrite all?

十年热恋 提交于 2019-11-26 15:29:48
问题 I'm trying to copy /home/myUser/dir1/ and all its contents (and their contents, etc.) to /home/myuser/dir2/ in python. Furthermore, I want the copy to overwrite everything in dir2/ . It looks like distutils.dir_util.copy_tree might be the right tool for the job, but not sure if there's anything easier/more obvious to use for such a simple task. If it is the right tool, how do I use it? According to the docs there are 8 parameters that it takes. Do I have to pass all 8 are just src , dst and

Combine --user with --prefix error with setup.py install

£可爱£侵袭症+ 提交于 2019-11-26 15:10:28
问题 I was trying to install Python packages a system I recently gained access to. I was trying to take advantage of Python's relatively new per user site-packages directory, and the new option --user . (The option is currently undocumented, however it exists for Python 2.6+; you can see the help by running python setup.py install --help .) When I tried running python setup.py install --user on any package I downloaded, I always got the following error: error: can't combine user with with prefix