How can I speed up my Perl program?

This is really two questions, but they are so similar, and to keep it simple, I figured I'd just roll them together: Firstly: Given an established Perl project, what are some decent ways to speed...

Getting the lesser n elements of a list in Python

I need to get the lesser n numbers of a list in Python. I need this to be really fast because it's in a critical part for performance and it needs to be repeated a lot of times. n is usually no...

Creating a wrapper for a C library in Python

I'm trying to create a wrapper of my own for FLAC, so that I can use FLAC in my own Python code. I tried using ctypes first, but it showed a really weird interface to the library, e.g. all the...

Pros & Cons of Google App Engine

[An Updated List 21st Aug 09] Help me Compile a List of all the Advantages & Disadvantages of Building an Application on the Google App Engine Pros: No need to buy servers or server space (no...

What are the different options for interfacing C (or C++) with Python?

I know there are many ways to interface C function into Python: the Python C API, scipy.weave, ctypes, pyrex/cython, SWIG, Boost.Python, Psyco... What are each of them best for? Why should I use a...

setup.py for packages that depend on both cython and f2py

I would like to create a setup.py script for a python package with several submodules that depend on both cython and f2py. I have attempted to use setuptools and numpy.distutils, but have so far...

How do you convert a char * with 0-value bytes into a python string?

Using the ctypes module I can easily import a POINTER(c_char) or a c_char_p type into python, but neither of these provides a way to end up with a python string that contains zero value...

Cython : pure C loop optimization

Quoting the Cython documentation: Cython recognises the usual Python for-in-range integer loop pattern: for i in range(n): ... If i is declared as a cdef integer type, it will optimise...

As of June 2014, what tools should one consider for improving Python code performance?

I have written a small scientific experiment in Python, and I now need to consider optimizing this code. After profiling, what tools should I consider in order to improve performance. From my...

Efficient way of computing dot product inside double sum in python3

I'm looking into how to compute as efficient as possible in python3 a dot product inside a double sum of the form: import cmath for j in range(0,N): for k in range(0,N): sum_p +=...

Testing for python module by importing in a Makefile

I am trying to create a generate Makefile. Is there a way to test whether a python module exists and then perform different actions in the Makefile based on that? I have tried something like...

Cython: Initialize Structured Numpy Array ValueError

I want to use Cython to speed up my Python code in analogy to the Cython's Numpy tutorial. I give you a MWE of what I intended: Test Function: import pyximport pyximport.install() import...

Mint17.2 install py2exe

I tried downloading the .exe files (problem: can't find a version 2.7 of python on computer + can't add the directory) I tried using the: pip install...

How to fix error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

I'm trying to install odoo on a fresh installation of Linux on a VirtualBox machine. I have entered in the commands found here as is: Odoo Development Read the Docs. The following command is what...

Installing pypcap on Windows 10 python 2.7 (64 bit)

I'm trying to install pypcap from: https://github.com/dugsong/pypcap/blob/master/INSTALL#L75 I'm trying to install it on Windows 10 - 64 bit and python 2.7.11 64 bit. I downloaded the source and...

fatal error: 'mymodule.h' file not found - Cython compile fails to find header

so I've been trying to get a simple script running, where I incorporate C-code into my python project using Cython 0.24 under MacOS 10.11.5 (El Capitan). I edit the code with PyCharm with Python...

TA-Lib Install Error

I am trying to install TA-Lib on Debian Jessie using pip. However I am encountering the following error: #include "ta-lib/ta_defs.h" ^ compilation terminated. error:...

Installing Scrapy throws exceptions again and again

I've tried to install Scrapy the usual way: Python 2, pip, pip install Scrapy I read that Python3, Windows10 and 64bit are not so good for Scrapy so I've installed 32bit Ubuntu to Oracle...

apt-get upgrade, apt-get install not working.

I recently updated Python 2.7.6 to Python 2.7.12. Since then, when I run apt-get upgrade or apt-get install or apt-get autoremove` I get the following error: Reading package lists... Done Building...

mysql malformed packet error after running makemigrations django

The issue that we are getting is : we have run manage.py makemigrations and manage.py migrate successfully, after which we start getting the below error: File...

Error while installing sentry on server python

I looked up all over the google, installed many packages. sudo apt-get install build-essential autoconf libtool pkg-config python-opengl python-imaging python-pyrex python-pyside.qtopengl...

Python netCDF4 install error

I'm trying to install netCDF4 package for python 2.7 on Ubuntu 14.04 with sudo pip install --user netCDF4 The installation crashes with the following error: error: unknown file type '.pyx' (from...

Cythonizing specific methods of a class written in Python

I have an A* planning algorithm written purely in Python (using this excellent resource on path planning). The grid class with associated methods for movement and costs is defined as...

Pyrex - 'PyFrameObject' is not declared

I'm trying to migrate one secret c-based library from CentOS 6.5/Python 2.6 to CentOS 7.4/Python 2.7. This library has python interface which based on Pyrex. The problem is, when I execute 'pyrex...

import cython code in python

I have an Cython code "rotate_polygon_nms.pyx" and I tried to import it in python code but it gives me an error: The *Cython* code is:: import numpy as np cimport numpy as np assert sizeof(int)...

Installing tsne in Google Colab notebook: error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

I am trying to install the tsne library in a Google Colab notebook. Based on other questions, I have tried installing the following to no avail: !apt-get install libblas-dev libatlas-base-dev...

Python C++ Wrapper API

Short question: Are anyone aware of a C++ API for Python (A C++ wrapper for the Python C API) Long question: I have used the following for wrapping C/C++ for Python usage: Manual wrapping using...

Ignore ssl certs for easy install python

I have my lib which has setup as setup.py from setuptools import setup setup( setup_requires=['pbr>=0.11.0'], pbr=True ) setup.cfg [metadata] name = MyLib [options] zip_safe =...

Spyder 2.2.5 is giving "You should import from qtconsole instead.", ShimWarning

my issue, spyder 2.2.5 stopped running any code. first of all, I have wanted to install ipywidgets but I can't because of python 2.7.6. I updated python 2.7.6 to 2.7.12, then installed ...

Apache Airflow : airflow initdb results in "ImportError: No module named json"

On Ubuntu 16.04 with Python 2.7 default version, I am trying to install Apache airflow but ran into several issues and currently I see on apache initdb Traceback (most recent call last): File...