microsoft/WSL

Cannot connect to jupyter/ipython instance

Closed this issue · 122 comments

When attempting to run a jupyter notebook or qtconsole, I get error messages like this:

Invalid argument (bundled/zeromq/src/tcp_address.cpp:171)

The normal ipython prompt works fine.

Hi @gencee and @spoonsso,

Thanks for the appreciation--but my package should be totally unnecessary now if you update to the latest Windows 10 Fast Ring update, as Microsoft has fixed the underlying issue.

Hey, @aseering I'm getting
E: Unable to locate package libzmq3
for some reason. Is it because I use Ubuntu 16.04?
W: The repository 'http://ppa.launchpad.net/aseering/wsl/ubuntu xenial Release' does not have a Release file.
Any ideas?

I reinstalled 14.04 from scratch, but still getting
Invalid argument (bundled/zeromq/src/tcp_address.cpp:199)
after using fix from @aseering

Hi @fedorzh -- for what it's worth, an alternative fix is bundled into the latest Insider build. So if you're willing to run an Insider build (either Fast or Slow Ring is new enough), then you no longer need my fix. (Also, Insider builds have native official support for Ubuntu 16.04, as well as many other WSL fixes and improvements.)

If you are staying with regular Windows, though -- how did you install iPython Notebook? My fix only works if you installed it via sudo apt-get install ipython-notebook. If you have ever installed it any other way, you must fully uninstall it (which can sometimes be tricky), then add my repository, then reinstall it via apt-get.

If you need to use a version of Notebook that's installed from some other source, others on this thread (for example, @jzuhone ) have created packages for other packaging systems.

@aseering
Yes, I tried to upgrade to 16.04 to see if it helps with other issues, but it only becomes more unstable, so decided to go back to 14.04. I can't move to Insider builds unfortunately due to company policy

I install jupyter with
sudo pip3 install jupyter.
Would it work if you provide host to get, compile your fix manually, and install the compiled version (in this case could you please provide some direction)?

@fedorzh -- hm... You could try installing the libzmq-dev package through apt-get; then uninstalling jupyter through pip and reinstalling it as sudo pip3 install --no-binary :all: jupyter. I may have the syntax wrong -- basically, you want to force pip to compile jupyter notebook from source, rather than using pip's precompiled binary. I believe its build scripts will notice that your system already has libzmq, and will use the (fixed) system version rather than the (broken) version bundled in pip's upstream repository.

Also -- if you're installing anything from source on Ubuntu (including the command that I recommended above), first you want to run sudo apt-get install build-essential. It installs a compiler and a bunch of standard build tools that are usually needed to build things from source.

Hi,
Does anybody know how we can use matplotlib (inline) on Jupyter? My kernel dies when I am using this package. I have also tried Xming and it didn't work.

Nima

@nimasasa - Thanks for your post.

My kernel dies...

Which kernel are you referring to? Is your setup on native Linux or WSL/bash?

@sunilmut I ma using WSL. I know it does not support graphical applications officially. But I was able to use Xming. Now, my problem is I can have anaconda and Jupyter on my chrome to run my codes, but when I am trying to plot something, my python kernel dies.

@nimasasa - Thanks for confirming. I was worried that you might be referring to Windows kernel dying :). I would recommend starting a new issue/post for this, using the template. A strace would be useful too.

ggada commented

Thanks @jzuhone!

conda install -c jzuhone zeromq=dev fixed this for me. The apt-get one didn't work probably because I am using conda environment.

Not going for the fast ring because I've faced BSOD's before.. ;)

Thanks @jzuhone!
→ conda install -c jzuhone zeromq=4.1.dev0 works for me!

How to get tensorflow gpu support? I have cuda and tensorflow-gpu installed on Windows but not on Windows bash. Any suggestions on using the GPU with GYM on windows Bash.

@ahsteven it's impossible to run tensorflow with gpu on WSL.

@Yangff Did you try using VcxSrv to run it with 17063? (I'm unable to go Insiders to test myself). You can now run VSCode from WSL so I wouldn't be surprised if other GUI dev tools are able to work now too. It will be interesting to see what now works and what still doesn't and what is preventing them at this point from running.

Despite @jzuhone's herculean efforts on his build of zeromq, my WSL/jupyter installation isn't working with matplotlib.

For example, a notebook consisting simply of:

from matplotlib import pyplot
pyplot.plot([1, 2, 3], [3, 1, 2], 'ko')

Kills the kernel.

Is this still expected on non-Insider builds of Windows 10? Should bug my IT department to let me into the Insider program?

Output of `conda list`
paul@POR-PHOBSON10:/mnt/c/Users/phobson$ conda list
# packages in environment at /home/paul/miniconda:
#
_nb_ext_conf              0.4.0                    py35_1
anaconda-client           1.6.6            py35h6b90917_0
asn1crypto                0.23.0           py35h4ab26a5_0
beautifulsoup4            4.6.0            py35h442a8c9_1
bleach                    2.1.1            py35hd5e75dd_0
ca-certificates           2017.08.26           h1d4fec5_0
certifi                   2017.11.5        py35h9749603_0
cffi                      1.11.2           py35hc7b2db7_0
chardet                   3.0.4            py35hb6e9ddf_1
clyent                    1.2.2            py35h491ffcb_1
conda                     4.4.7                    py35_0
conda-build               3.2.1                    py35_0
conda-env                 2.6.0                h36134e3_1
conda-verify              2.0.0            py35he912c7b_0
cryptography              2.1.4            py35hbeb2da1_0
cycler                    0.10.0           py35hc4d5149_0
dbus                      1.10.22              h3b5a359_0
decorator                 4.1.2            py35h3a268aa_0
entrypoints               0.2.3            py35h48174a2_2
expat                     2.2.5                he0dffb1_0
filelock                  2.0.13           py35h4160c53_0
fontconfig                2.12.4               h88586e7_1
freetype                  2.8                  hab7d2ae_1
glib                      2.53.6               h5d9569c_2
glob2                     0.6              py35hff66265_0
gmp                       6.1.2                h6c8ec71_1
gst-plugins-base          1.12.2               he3457e5_0
gstreamer                 1.12.2               h4f93127_0
html5lib                  1.0.1            py35h2f9c1c0_0
icu                       58.2                 h9c2bf20_1
idna                      2.6              py35h8605a33_1
intel-openmp              2018.0.0             hc7b2577_8
ipykernel                 4.7.0            py35h2f9c1c0_0
ipython                   6.2.1            py35hd850d2a_1
ipython_genutils          0.2.0            py35hc9e07d0_0
ipywidgets                7.0.5            py35h8147dc1_0
jedi                      0.11.0                   py35_2
jinja2                    2.10             py35h480ab6d_0
jpeg                      9b                   h024ee3a_2
jsonschema                2.6.0            py35h4395190_0
jupyter                   1.0.0            py35hd38625c_0
jupyter_client            5.1.0            py35h2bff583_0
jupyter_console           5.2.0            py35h4044a63_1
jupyter_core              4.4.0            py35ha89e94b_0
libedit                   3.1                  heed3624_0
libffi                    3.2.1                hd88cf55_4
libgcc                    7.2.0                h69d50b8_2
libgcc-ng                 7.2.0                h7cc24e2_2
libgfortran-ng            7.2.0                h9f7466a_2
libiconv                  1.15                 h63c8f33_5
libpng                    1.6.32               hbd3595f_4
libsodium                 1.0.15               hf101ebd_0
libstdcxx-ng              7.2.0                h7a57d05_2
libxcb                    1.12                 hcd93eb1_4
libxml2                   2.9.4                h2e8b1d7_6
markupsafe                1.0              py35h4f4fcf6_1
matplotlib                2.1.1            py35ha26af80_0
mistune                   0.8.1            py35h9251d8c_0
mkl                       2018.0.1             h19d6760_4
nb_anacondacloud          1.4.0                    py35_0
nb_conda                  2.2.1            py35hccc8299_0
nb_conda_kernels          2.1.0                    py35_0
nbconvert                 5.3.1            py35hc5194e3_0
nbformat                  4.4.0            py35h12e6e07_0
nbpresent                 3.0.2            py35h9c03491_1
ncurses                   6.0                  h9df7e31_2
notebook                  5.2.2            py35he644770_0
numpy                     1.14.0           py35h3dfced4_0
openssl                   1.0.2n               hb7f436b_0
packaging                 16.8             py35h2260b46_1
pandoc                    1.19.2.1             hea2e7c5_1
pandocfilters             1.4.2            py35h1565a15_1
parso                     0.1.1            py35h1b200a3_0
patchelf                  0.9                  hf79760b_2
path.py                   10.5             py35h39c98c1_0
pcre                      8.41                 hc27e229_1
pexpect                   4.3.0            py35hf410859_0
pickleshare               0.7.4            py35hd57304d_0
pip                       9.0.1            py35h7e7da9d_4
pkginfo                   1.4.1            py35hb526c55_1
prompt_toolkit            1.0.15           py35hc09de7a_0
ptyprocess                0.5.2            py35h38ce0a3_0
pyasn1                    0.4.2            py35h8f845f4_0
pycosat                   0.6.3            py35h6b6bb97_0
pycparser                 2.18             py35h61b3040_1
pycrypto                  2.6.1            py35h9852db7_1
pygments                  2.2.0            py35h0f41973_0
pyopenssl                 17.5.0           py35h4f8b8c8_0
pyparsing                 2.2.0            py35h041ed72_1
pyqt                      5.6.0            py35h0e41ada_5
pysocks                   1.6.7            py35h6aefbb0_1
python                    3.5.4               h417fded_24
python-dateutil           2.6.1            py35h90d5b31_1
pytz                      2017.3           py35hb13c558_0
pyyaml                    3.12             py35h46ef4ae_1
pyzmq                     16.0.2                   py35_0
qt                        5.6.2               h974d657_12
qtconsole                 4.3.1            py35h4626a06_0
readline                  7.0                  ha6073c6_4
requests                  2.18.4           py35hb9e6ad1_1
ruamel_yaml               0.11.14          py35h8e2c16b_2
setuptools                36.5.0           py35ha8c1747_0
simplegeneric             0.8.1            py35h2ec4104_0
sip                       4.18.1           py35h9eaea60_2
six                       1.11.0           py35h423b573_1
sqlite                    3.20.1               hb898158_2
terminado                 0.6              py35hce234ed_0
testpath                  0.3.1            py35had42eaf_0
tk                        8.6.7                hc745277_3
tornado                   4.5.2            py35hf879e1d_0
traitlets                 4.3.2            py35ha522a97_0
urllib3                   1.22             py35h2ab6e29_0
wcwidth                   0.1.7            py35hcd08066_0
webencodings              0.5.1            py35hb6cf162_1
wheel                     0.30.0           py35hd3883cf_1
widgetsnbextension        3.0.8            py35h84cb72a_0
xz                        5.2.3                h55aa19d_2
yaml                      0.1.7                had09818_2
zeromq                    4.1.dev0                      0    jzuhone
zlib                      1.2.11               ha838bed_2

@phobson - Can you clarify what you mean by Kilss the kernel.? Are you getting a blue (or green) screen of death? i.e. Is your Windows crashing? If so, can you please follow the instructions for BSOD here?

Also, which version of Windows are you running. From your WSL bash prompt, output of cmd.exe /c ver

@sunilmut

Sorry I wasn't clear. I meant that trying to plot in a jupyter notebook with matplotlib was killing the ipython kernel. The windows/WSL/linux kernels were fine.

I was just digging back into this and working with my IT department. I'm not sure which if these incantations did the trick, but we upgraded my windows build to 1709 and then uninstalled/reinstalled WSL/Ubuntu via lxrun and and it worked!

🤷‍♂️

@phobson - Thanks for the details. Good to know your issue was resolved. There is significant investment going into WSL. So, staying on the latest Windows release will always give you the most mileage, at least that's what we aim for.

The OP here was:

Invalid argument (bundled/zeromq/src/tcp_address.cpp:171)

Which was:

    //  Get the addresses.
    ifaddrs *ifa = NULL;
    const int rc = getifaddrs (&ifa);
    errno_assert (rc == 0);
    zmq_assert (ifa != NULL);

Which is #308 addressed in 15007 and Creators Update 15063.