pyzmq missing when running ipython notebook

Arg. The ipython install is a little idiosyncratic. Here’s what I had to do to resolve this: $ pip uninstall ipython $ pip install “ipython[all]” The issue is that notebooks have their own set of dependencies, which aren’t installed with pip install ipython. However, having installed ipython, pip doesn’t see the need to add anything … Read more

pip broken after upgrading

One reason can be remembed locations. You can clear the cached locations by issuing following command: hash -r SIDENOTE: Instead of which, using type command, you can see the hashed location: $ type pip pip is /usr/local/bin/pip $ pip -V pip 1.5.6 from /usr/local/lib/python2.7/dist-packages (python 2.7) $ type pip pip is hashed (/usr/local/bin/pip)

How to prepend a path to sys.path in Python?

This is not recommended, as it hard-codes a path and makes it difficult to run the script elsewhere, but you can do >>> import sys >>> sys.path.insert(0,’/home/anand/’) >>> print(sys.path) [‘/home/anand/’, ”, ‘/usr/local/lib/python2.7/dist-packages/_pdbpp_path_hack’, ‘/usr/local/lib/python2.7/dist-packages/goose-0.0.1-py2.7.egg’, ‘/usr/local/lib/python2.7/dist-packages/jieba-0.33-py2.7.egg’, ‘/usr/local/lib/python2.7/dist-packages/cssselect-0.9.1-py2.7.egg’, ‘/usr/local/lib/python2.7/dist-packages/nanoservice-0.1.5-py2.7.egg’, ‘/usr/local/lib/python2.7/dist-packages/nanomsg-1.0a2-py2.7-linux-x86_64.egg’, ‘/usr/local/lib/python2.7/dist-packages/msgpack_python-0.4.2-py2.7-linux-x86_64.egg’, ‘/usr/local/lib/python2.7/dist-packages/DecisionTree-2.2.5-py2.7.egg’, ‘/usr/local/lib/python2.7/dist-packages/nudepy-0.2-py2.7.egg’, ‘/usr/local/lib/python2.7/dist-packages/wsgilog-0.3-py2.7.egg’, ‘/usr/local/lib/python2.7/dist-packages/distribute-0.7.3-py2.7.egg’, ‘/usr/local/lib/python2.7/dist-packages/PIL-1.1.7-py2.7-linux-x86_64.egg’, ‘/usr/local/lib/python2.7/dist-packages/MySQL_python-1.2.5-py2.7-linux-x86_64.egg’, ‘/usr/local/lib/python2.7/dist-packages/munkres-1.0.7-py2.7.egg’, ‘/usr/local/lib/python2.7/dist-packages/parsedatetime-1.4-py2.7.egg’, ‘/usr/local/lib/python2.7/dist-packages/argparse-1.3.0-py2.7.egg’, ‘/usr/local/lib/python2.7/dist-packages/tusker-0.1-py2.7.egg’, ‘/usr/local/lib/python2.7/dist-packages/SQLAlchemy-1.0.3-py2.7-linux-x86_64.egg’, ‘/usr/local/lib/python2.7/dist-packages/numpy-1.9.2-py2.7-linux-x86_64.egg’, ‘/usr/local/lib/python2.7/dist-packages/turkic-0.2.5-py2.7.egg’, ‘/usr/local/lib/python2.7/dist-packages/scikits.bootstrap-0.3.2-py2.7.egg’, ‘/usr/local/lib/python2.7/dist-packages/pyvision-0.1-py2.7-linux-x86_64.egg’, ‘/home/anand/playspace/languages/python_pkgs/ets’, ‘/usr/local/lib/python2.7/dist-packages/Scrapy-1.1.0dev1-py2.7.egg’, … Read more

What keyword arguments does setuptools.setup() accept?

setuptools.setup() calls distutils.core.setup() and passes it’s own **kwargs as the only parameter, so any keywords that distutils accepts will also be accepted by setuptools. If we go look at distutils setup_keywords = (‘distclass’, ‘script_name’, ‘script_args’, ‘options’, ‘name’, ‘version’, ‘author’, ‘author_email’, ‘maintainer’, ‘maintainer_email’, ‘url’, ‘license’, ‘description’, ‘long_description’, ‘keywords’, ‘platforms’, ‘classifiers’, ‘download_url’, ‘requires’, ‘provides’, ‘obsoletes’, ) Most … Read more

pip install test dependencies for tox from setup.py

I’ve achieved this by committing a slight abuse of extra requirements. You were almost there trying the extras syntax, just that tests_require deps aren’t automatically available that way. With a setup.py like this: from setuptools import setup test_deps = [ ‘coverage’, ‘pytest’, ] extras = { ‘test’: test_deps, } setup( # Other metadata… tests_require=test_deps, extras_require=extras, … Read more

Given the name of a Python package, what is the name of the module to import? [duplicate]

Regrettably, there’s no method to the madness. The name in the package index is independent of the module name you import. Disastrously some packages share module names. If you install both, your application will break with even odds. (Ruby has this problem too) Packaging in Python is generally dire. The root cause is that the … Read more