Instantly share code, notes, and snippets.

import lea
from lea import markov
lea_obj = lea.vals('abcde')
ch = markov.chain_from_seq('abgdkjhagbdffagg')
# To get the probability distribution from an Alea object:
probs = list(zip(,
# To get the transition matrix from a Markov chain object:


After upgrading to pip 10 on Linux, many users are encountering variations of the error ImportError: cannot import name 'main'. These are caused by an incorrect attempt to upgrade pip, which has typically resulted in (parts of) multiple versions of pip being installed in the same Python installation, and those parts being incompatible.

It should be noted that these issues are invariably not problems with pip itself, but are due to incorrect use of pip, or unexpected interactions with system scripts that are not controlled by pip. So while we'll try to help you solve your issue, this is not the "fault" of pip, and you will have to be prepared to do at least some of the debugging and fixes on your own.

General Advice

First, some general advice. It is assumed that anyone encountering issues will have failed to follow some part of this advice. Listing these items here is not intended to imply that "it's your fault and we won't help", but rather to help users to identify what went wrong, so

View rftools_control.json
"pos": {
"x": 0,
"y": 0
"opcode": {
"id": "ev_rs_on",
"primary": "D",
"parameters": [
rom distutils import ccompiler
import setuptools # Needed to monkeypatch msvccompiler for Python 2.7
import os
here = os.path.dirname(os.path.abspath(__file__))
cc = ccompiler.new_compiler()
sources = [

TortoiseHG Silent Install Features

  • MainProgram
  • Locales
  • ShellExtensionX64
  • ShellExtensionX86
  • ThgDocumentation
  • KDiff3
  • SSHUtils
import zipfile
import hashlib
import csv
import sys
import os
import io
oldproj = 'pywin32'
newproj = 'pypiwin32'
filename = sys.argv[1]
from cffi import FFI
ffi = FFI()
HANDLE FindFirstVolume(LPTSTR lpszVolumeName, DWORD cchBufferLength);
BOOL FindVolumeClose(HANDLE hFindVolume);
lib = ffi.verify('''
/* Note - need UNICODE here as ffi won't auto-detect if we need it */
View utils.ps1
# Use this one to load this snippet :-)
function Invoke-URLContent ($url) {
(New-Object Net.WebClient).DownloadString($url) | Invoke-Expression
function Get-URLContent ($url, $path) {
if (!$path) {
$path = Join-Path $pwd.Path ([URI]$url).Segments[-1]
(New-Object Net.WebClient).DownloadFile($url, $path)
View vex.ps1
Param (
[Parameter(Position=0, Mandatory=$true, ParameterSetName="ByName")]
View list.patch
diff --git a/pip/commands/ b/pip/commands/
index 3a0330a..3e4fcc7 100644
--- a/pip/commands/
+++ b/pip/commands/
@@ -45,6 +45,12 @@ class ListCommand(Command):
help=('If in a virtualenv that has global access, do not list '
'globally-installed packages.'),
+ cmd_opts.add_option(
+ '-L', '--location',