Why is the wheel package not installed by default in Python 3.6?

Viewed 573

Here is my problem: I need to distribute Python packages that I created. I would like to create wheels, as this is now the preferred way of distributing Python packages.

On my machine: no problem.

On my client server, however, I do not have control over the Python (3.6.3) used to create the wheels. And - surprise! - the wheel package is not included by default in Python 3.6!

And yes, I know I can do: sudo pip install wheel but I do not have sudo rights in that environment.

I could create a virtualenv, install wheel in that virtual environment, ans then create my packages (and I will probably end up doing just that), but what a pain in the neck!!

Am I missing something here?

If not, there is an inconsistency, in my mind: on the one hand, we are told to use wheels, but on the other hand the "preferred" mechanism is not available in a vanilla Python (at least in Python 3.6)

Any thoughts on that?

1 Answers

There is a an intermediate between installing packages system-wise via sudo pip and installing in virtual environment: install packages for your user!

$ pip --user install --upgrade pip wheel

(in some platforms pip automatically selects --user when invoked without sudo)

Packages that ship binaries (such as pip and wheel) will have them installed by default at ~/.local/bin, so make sure that dir is in your $PATH. The default /etc/profile or ~/.profile in most distros already do that if dir exists, so you might have to logout/login once for $PATH to be updated after installing your first package.

Now you can enjoy wheel (and latest pip) just like as if they were any other system package, and without any the of trouble of dealing with virtualenvs.

Related