setuptools vs. distutils: why is distutils still a thing?

Have a look at this SO question. It explains all the packaging methods very well, and might help answer your question to some extent: Differences between distribute, distutils, setuptools and distutils2? Distutils is still the standard tool for packaging in Python. It is included in the standard library (Python 2 and Python 3.0 to 3.3). … Read more

How can I get the version defined in setup.py (setuptools) in my package?

Interrogate version string of already-installed distribution To retrieve the version from inside your package at runtime (what your question appears to actually be asking), you can use: import pkg_resources # part of setuptools version = pkg_resources.require(“MyProject”)[0].version Store version string for use during install If you want to go the other way ’round (which appears to … Read more

“pip install –editable ./” vs “python setup.py develop”

Try to avoid calling setup.py directly, it will not properly tell pip that you’ve installed your package. With pip install -e: For local projects, the “SomeProject.egg-info” directory is created relative to the project path. This is one advantage over just using setup.py develop, which creates the “egg-info” directly relative the current working directory. More: docs … Read more

What’s the proper way to install pip, virtualenv, and distribute for Python?

You can do this without installing anything into python itself. You don’t need sudo or any privileges. You don’t need to edit any files. Install virtualenv into a bootstrap virtual environment. Use the that virtual environment to create more. Since virtualenv ships with pip and distribute, you get everything from one install. Download virtualenv: http://pypi.python.org/pypi/virtualenv … Read more

Explain Python entry points?

An “entry point” is typically a function (or other callable function-like object) that a developer or user of your Python package might want to use, though a non-callable object can be supplied as an entry point as well (as correctly pointed out in the comments!). The most popular kind of entry point is the console_scripts … Read more

Reference requirements.txt for the install_requires kwarg in setuptools setup.py file

On the face of it, it does seem that requirements.txt and setup.py are silly duplicates, but it’s important to understand that while the form is similar, the intended function is very different. The goal of a package author, when specifying dependencies, is to say “wherever you install this package, these are the other packages you … Read more

Python setup.py develop vs install

python setup.py install is used to install (typically third party) packages that you’re not going to develop/modify/debug yourself. For your own stuff, you want to first install your package and then be able to frequently edit the code without having to re-install the package every time — and that is exactly what python setup.py develop … Read more

No module named pkg_resources

July 2018 Update Most people should now use pip install setuptools (possibly with sudo). Some may need to (re)install the python-setuptools package via their package manager (apt-get install, yum install, etc.). This issue can be highly dependent on your OS and dev environment. See the legacy/other answers below if the above isn’t working for you. … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)