8

I made a virtualenv, and a new blank django project. I want to install Channels. I'm using Python 3.6.3. I typed pip install -U channels and this is output:

...
Failed building wheel for twisted
...
Command "/home/marcin/Documents/django_projects/channels/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-ic8ux9ei/twisted/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-ox6bclm5-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/marcin/Documents/django_projects/channels/include/site/python3.6/twisted" failed with error code 1 in /tmp/pip-build-ic8ux9ei/twisted/

pip list OUTPUT:

...
Django (1.11.6)
...
pip (9.0.1)
...
setuptools (36.6.0)
...
wheel (0.29.0)
...

I see that I don't have Twisted, so I typed: pip install twisted. This is the output:

...
 Failed building wheel for twisted
...
Command "/home/marcin/Documents/django_projects/channels/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-a54n37_z/twisted/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-9p23ehnv-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/marcin/Documents/django_projects/channels/include/site/python3.6/twisted" failed with error code 1 in /tmp/pip-build-a54n37_z/twisted/

As you can see, the outputs are almost the same. How can I install Channels?

muru
  • 193,181
  • 53
  • 473
  • 722
gongarek
  • 317
  • 1
  • 3
  • 11
  • You might be missing a few packages that are installed using apt. Try `sudo apt install python3.6-dev` and then repeat the installation process for pip. – edwinksl Oct 20 '17 at 23:41
  • Sounds good; I will write an answer in case there are other people who face the same problem :) – edwinksl Oct 21 '17 at 08:54

3 Answers3

13

The error message is not particularly helpful but it seems you are missing the python3.6-dev package, which is installed using apt:

sudo apt update
sudo apt install python3.6-dev

After this, repeat your installation using pip as before.

edwinksl
  • 23,569
  • 16
  • 74
  • 100
6

You also need to the build-essential package if it hasn't been installed already. The complete install command is:

sudo apt-get install build-essential python3.6-dev
-1

Faced a similar issue while installing rasa_core.

Resolved an issue in a couple of steps:

sudo apt-get update
sudo apt-get install build-esssential python3.6-dev

Finally able to install rasa_core successfully.

David Foerster
  • 35,754
  • 55
  • 92
  • 145
neel
  • 99
  • 1
    Hello and welcome to AU. Please refrain from posting answers similar or equal to existing ones. Instead, upvote the one(s) that you solved the problem. This ensures future readers to easily get to the most satisfying answer instead of reading mutiple time the same story. – Marc Vanhoomissen Oct 11 '18 at 11:01