setup.py

Distutils appharently fails with a (working) SWIG extension

拜拜、爱过 提交于 2019-12-05 03:52:57
I am wrapping via SWIG a C library in a python module, here called "myExample". If I compile: $swig -python myExample.i $gcc -c myExample_wrap.c -I /usr/lib/python2.7 -fPIC -std=c99 $ld -shared myExample_wrap.so -llapacke -o _myExample.so I obtain a full working module (liblapacke is necessary for some functions I used). Now I'd like to make this module installable via "pip install". According to the distutils section ( https://docs.python.org/2.7/distutils/setupscript.html ), I wrote my setup.py file: from distutils.core import setup, Extension setup(name='myExample', version='0.1', ext

Setup in virtualenv: `pip install -e .` vs `python setup.py install`

女生的网名这么多〃 提交于 2019-12-04 19:21:14
问题 I'm following a Flask tutorial that has me using virtualenv , and with it I built an app directory tree that looks like this: app/ |__app/ |__app.egg-inf/ |__setup.py |__venv/ Inside my venv the tutorial tells me to run pip install -e . which appears to be using my setup.py to install dependencies and my application. Why does the tutorial have me running pip install -e . ? Why not python setup.py install ? What are the differences? (FWIW, export FLASK_APP=app; flask run works fine after pip

Install new regex module with setup.py

半腔热情 提交于 2019-12-04 17:03:55
I'm trying to install the new Regex module The readme.txt says::: To build and install regex for your default Python run python setup.py install To install regex for a specific version run setup.py with that interpreter, e.g. python3.1 setup.py install I type in python setup.py install and get back /Library/Frameworks/Python.framework/Versions/7.3/Resources/Python.app/Contents/MacOS/Python: can't open file 'setup.py': [Errno 2] No such file or directory I'm looking for the answer but people keep referring me to the Python docs and they are confusing. I know it is really simple but I'm just not

How to chmod files within a python setup.py?

有些话、适合烂在心里 提交于 2019-12-04 14:55:03
I created a python package installation with a setup.py, and i want it to copy a data file in the folder (created for the occasion) ~/.did. The problem is that i have to call setup.py with sudo rights, as it writes in /usr/local/... So when my data file is copied in ~/.did, only the root user has write access to the file. I decided then to add a call to os.chmod() after the setup() function, but i'd like to know if anyone had a more clean way to do so. Here is my setup.py file : #!/usr/bin/env python from distutils.core import setup import os home=os.path.expanduser('~') setup(name='did',

How to Build a 32-bit Python Module Distribution w/ Setup.py on x86_64 Host

孤街浪徒 提交于 2019-12-04 13:12:52
I need to compile a 32-bit distribution of PyEphem . It does not seem like this should be difficult, however, I'm running into some compiler issues. $ CFLAGS=-m32 python setup.py bdist -p i386 running bdist running bdist_dumb running build running build_py running build_ext building 'ephem._libastro' extension gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -m32 -fPIC -Ilibastro-3.7.3 -I/usr/include/python2.6 -c extensions/_libastro.c -o build/temp.linux-x86_64-2.6/extensions/_libastro.o In file included from /usr/include/python2.6/Python.h:58, from

Compiling & installing C executable using python's setuptools/setup.py?

淺唱寂寞╮ 提交于 2019-12-04 10:36:25
问题 I've got a python module that calls an external binary, built from C source. The source for that external executable is part of my python module, distributed as a .tar.gz file. Is there a way of unzipping, then compiling that external executable, and installing it using setuptools/setup.py? What I'd like to achieve is: installing that binary into virtual environments manage compilation/installation of the binary using setup.py install , setup.py build etc. making the binary part of my python

python, change user site directory or install setup.py --prefix with --user

雨燕双飞 提交于 2019-12-04 08:03:17
I'd want to install python modules as non-root user like this $ pip install -I --install-option="--prefix=~/usr" scipy Unfortunately this usually does not work unless you specify --user . But --user can't be used together with --prefix . Using --user only (without --prefix ) installs to ~/.local which I find ugly because I have a well maintained ~/usr and don't want to add even more stuff to my env to make ~/.local usable too. So my questions: How can I let --prefix and --user work together for setup.py or how else could setup.py succeed without using --user ? Or can I change the user site

setup.py check if non-python library dependency exists

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-04 07:29:01
I'm trying to make a setup.py for cgal-bindings . To install this, the user needs to have at least a certain version of CGAL. In addition, CGAL has a few optional targets that should be built if the user has some libraries (like Eigen3). Is there a cross-platform way in Python to check for this? I can use find_library in ctypes.util to check if the library exists, but I don't see any easy way to get the version . <-- This doesn't actually work all the time, some libraries are header-only like eigen3, which is a C++ template library. Using the install_requires argument of setup() only works for

How do I include non-.py files in PyPI?

孤街浪徒 提交于 2019-12-04 06:42:08
I am a newb to PyPI...so let me qualify with that. I am trying to put a package on PyPI but having a bit of trouble when I try to install it with pip. When I upload the file to PyPI, I get a warning (but the setup.py script finishes with not fatal errors and a 200 status): 'my_package/static/my_folder' not a regular file -- skipping And then when I go to install it in pip, I get an error: "error: can't copy 'my_package/static/my_folder': doesn't exist or not a regular file. From other answers on SO, I've tried changing up my MANIFEST.in and my setup.py files, with no luck. Here is my current

Passing the library path as a command line argument to setup.py

落爺英雄遲暮 提交于 2019-12-04 02:56:54
modules = [Extension("MyLibrary", src, language = "c++", extra_compile_args=["-fopenmp", "-std=c++11", "-DNOLOG4CXX"], # log4cxx is not currently used extra_link_args=["-fopenmp", "-std=c++11"], include_dirs=[os.path.join(os.path.expanduser("~"), (os.path.join(gtest, "include"))], library_dirs=[log4cxx_library, os.path.join(os.path.expanduser("~"), gtest)], libraries=["log4cxx", "gtest"])] This is a part of my setup.py script. How do I pass options like include_dirs or library_dirs through command line arguments, so that path could be set up by the user? Think this may be what you're looking