Howdy! Sorry, you're having trouble. To expedite your experience,
provide some basics for me:
Operating system: Ubuntu 18.04
Python version: 3.6.5
Black version: black.py, version 18.4a3
Does also happen on master: I don't know
To answer the last question, follow these steps:
pip install -e .;python setup.py test; andblack like you did last time.I am trying to install black to neovim via vundle, this is what I have:

The same error happens after nstallation. The command Black works fine
I will need help with this as I'm not a NeoVim user.
I have the same problem. Debian Stretch, using neovim NVIM v0.2.3-313-gdee78a409 and having neovim virtualenv with pyenv present, so my neovim command :python3 import sys; sys.version prints version 3.6.5.
Did you try to create the virtualenv yourself and set g:black_virtualenv = <path-to-venv> in your .vimrc instead of relying on auto clone/install?
What worked for me was:
Edit .vimrc and let ambv/black plugin to install.
Using pyenv I have virtualenv named neovim3 with python3 (version 3.6.5) and withing that I keep package neovim installed. This one is required by neovim for python3 based plugins and I have in my .vimrc path:
let g:python3_host_prog = '/home/javl/.pyenv/versions/neovim3/bin/python'
I had problem as described above until I installed black into neovim3 pydev virtualenv:
$ pydev activate neovim3
$ pip install black
Since then I have black working and the project it works within does not have to have black installed (nor is the black installed globally).
I will try to use g:black_virtualenv as proposed by @Lukas0907 as it seems cleaner than dropping black into neovim created virtualenv.
The `let g:black_virtualenv = '/home/javl/.local/venvs/black' resolved the issue.
My neovim3 pydev virtualenv does not include black any more and the home/javl/.local/venvs/black' is the only one containing it (I created bypipsi`, but any other virtualenv creation method shall be sufficient).
black for `neovimInstall black into separate virtualenv. Note, that this plugin requires python 3.6
Install ambv/black as neovim plugin using your favourite method (vundle, pathogen, minpac or whatever else)
Add let g:black_virtualenv = '<path-to-your-black-virtualenv>' into your .vimrc
This shall be all.
Thank you guys,
I created a venv with python3.6.5, reinstalled ambv/black by PluginClean/PluginInstall and added:
let g:black_virtualenv = '/home/zhukovgreen/.local/share/virtualenvs/black-tD_IXG1O'
:Black works, but the same error when :BlackUpgrade.
I also tried to point `let g:python3_host_prog = '/home/zhukovgreen/.local/share/virtualenvs/black-tD_IXG1O/bin/python' - no progress
Seems to be related to this line: https://github.com/ambv/black/blob/master/plugin/black.vim#L81
I think it's because neovim uses stdout for msgpack communication and we're not capturing that stream. Submitting PR :)
This is fixed by #197. Thanks, Codey! ✨ 🍰 ✨
Most helpful comment
Seems to be related to this line: https://github.com/ambv/black/blob/master/plugin/black.vim#L81
I think it's because neovim uses
stdoutformsgpackcommunication and we're not capturing that stream. Submitting PR :)