setup.py

Compiling an optional cython extension only when possible in setup.py

无人久伴 提交于 2019-12-07 10:56:51
问题 I have a python module fully implemented in python. (For portability reasons.) The implementation of a small part has been duplicated in a cython module. To improve perfomance where possible. I know how to install the .c modules created by cython with distutils . However if a machine has no compiler installed, I suspect the setup will fail even though the module is still usable in pure python mode. Is there a way to compile the .c module if possible but fail gracefully and install without it

How to instrument setup.py to use wheel packages

孤者浪人 提交于 2019-12-07 10:18:42
问题 In my setup.py I have a dependency for numpy (in install_requires ). Is it possible to instrument the setup function to use wheel packages rather then source ones and not compile the whole numpy? Note: When I do pip install numpy it downloads the binary package of numpy. However python setup.py install gets the source package. 回答1: The wheel package was introduced with the purpose of fixing the problems with source distributions that were used by setuptools . Although setuptools had their own

How should I handle importing third-party libraries within my setup.py script?

我的未来我决定 提交于 2019-12-07 05:37:22
问题 I'm developing a Python application and in the process of branching off a release. I've got a PyPI server set up on a company server and I've copied a source distribution of my package onto it. I checked that the package was being hosted on the server and then tried installing it on my local development machine. I ended up with this output: $ pip3 install --trusted-host 172.16.1.92 -i http://172.16.1.92:5001/simple/ <my-package> Collecting <my-package> Downloading http://172.16.1.92:5001

How might one specify or add a directory to the Python.h search path during a module build/install using setup.py?

断了今生、忘了曾经 提交于 2019-12-06 21:57:45
问题 I'm running Linux, and have downloaded a python module I must install without access to any but my particular /home/user directory (I have no root privileges nor the option to pursue them). This of course requires the Python source. This I've downloaded and have laying around in said user directory. While asking the admin to copy the proper files into /usr/include/python2.7 is easiest way to go about this, I am hoping for a more general and portable solution to this kind of problem. Changing

Having trouble with setup.py

徘徊边缘 提交于 2019-12-06 16:35:56
I've been using python for a while but I can't remember how I used to install modules, I haven't needed to in forever. I recently reinstalled ubuntu so now I need to. Firstly, I try to run setup.py and get this: nicholas@nicholas-K53E:~$ python setup.py install python: can't open file 'setup.py': [Errno 2] No such file or directory I tried using synaptic to install BeautifulSoup but it didn't work either and python tells me there's no modules named that. Some forums said that it had to do with being in the wrong working directory so I cd'd into my Python26 folder and tried to run python .

Compiling an optional cython extension only when possible in setup.py

大兔子大兔子 提交于 2019-12-05 16:59:31
I have a python module fully implemented in python. (For portability reasons.) The implementation of a small part has been duplicated in a cython module. To improve perfomance where possible. I know how to install the .c modules created by cython with distutils . However if a machine has no compiler installed, I suspect the setup will fail even though the module is still usable in pure python mode. Is there a way to compile the .c module if possible but fail gracefully and install without it if compiling is not possible? I guess you will have to make some modification both in your setup.py and

How to instrument setup.py to use wheel packages

巧了我就是萌 提交于 2019-12-05 13:04:17
In my setup.py I have a dependency for numpy (in install_requires ). Is it possible to instrument the setup function to use wheel packages rather then source ones and not compile the whole numpy? Note: When I do pip install numpy it downloads the binary package of numpy. However python setup.py install gets the source package. The wheel package was introduced with the purpose of fixing the problems with source distributions that were used by setuptools . Although setuptools had their own Egg format for built distributions that predated wheel by 8 years, wheel is currently considered the

How should I handle importing third-party libraries within my setup.py script?

有些话、适合烂在心里 提交于 2019-12-05 11:42:14
I'm developing a Python application and in the process of branching off a release. I've got a PyPI server set up on a company server and I've copied a source distribution of my package onto it. I checked that the package was being hosted on the server and then tried installing it on my local development machine. I ended up with this output: $ pip3 install --trusted-host 172.16.1.92 -i http://172.16.1.92:5001/simple/ <my-package> Collecting <my-package> Downloading http://172.16.1.92:5001/packages/<my-package>-0.2.0.zip Complete output from command python setup.py egg_info: Traceback (most

distutils ignores changes to setup.py when building an extension?

时间秒杀一切 提交于 2019-12-05 08:57:40
I have a setup.py file that builds an extension. If I change one of the source files, distutils recognizes this and rebuilds the extension, showing all the compile / link commands. However, if the only thing I change is setup.py (I'm fiddling trying to make library dependencies work), then it doesn't seem to rebuild (e.g., none of the compile/link commands show up). I've tested this by removing one of the source files in the line sources = ['foo.c', 'bar.c' ...] and when I pip install -e . or python setup.py install , it still creates a new file for the extension, but it must be a version

How to install MySQL-python on Amazon Web Services EC2 instance?

孤街浪徒 提交于 2019-12-05 04:34:15
问题 I have a EC2 instance created on AWS and use PuTTY to connect to it. I'm unable to install MySQL-python using python pip command as follows: pip install MySQL-python (via root privileges) Here is the console output of the error Collecting MySQL-python Using cached MySQL-python-1.2.5.zip Complete output from command python setup.py egg_info: sh: mysql_config: command not found Traceback (most recent call last): File "<string>", line 20, in <module> File "/tmp/pip-build-JGbAEI/MySQL-python