microsoft / WSL

Issues found on WSL
https://docs.microsoft.com/windows/wsl
MIT License
17.46k stars 821 forks source link

Cannot connect to jupyter/ipython instance #185

Closed jzuhone closed 6 years ago

jzuhone commented 8 years ago

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.

allblues1001 commented 8 years ago

Sure, it says: pip 1.5.4 from /home/allblues1001/tensorflow/local/python2.7/site-packages (python 2.7)

rdodev commented 8 years ago

@allblues1001 and forgive me if this is obvious, but the kernel you're starting in ipython is the same version as the one in bash? try this on both the python REPL and the ipython notebook:

import sys
print sys.version_info

and compare.

allblues1001 commented 8 years ago

@rdodev For python REPL and jupyter notebook it is the same: sys.version_info (major=2, minor=7, micro=6, releaselevel='final', serial=0)

rdodev commented 8 years ago

@allblues1001 try this on both

import sys
sys.path

and see if they are the same.

allblues1001 commented 8 years ago

For python: ['', '/home/allblues/tensorflow/lib/python2.7', '/home/saad-omar/tensorflow/lib/python2.7/plat-x86_64-linux-gnu', '/home/allblues/tensorflow/lib/python2.7/lib-tk', '/home/saad-omar/tensorflow/lib/python2.7/lib-old', '/home/allblues/tensorflow/lib/python2.7/lib-dynload', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/home/allblues/tensorflow/local/lib/python2.7/site-packages', '/home/allblues/tensorflow/lib/python2.7/site-packages', '/usr/local/lib/python2.7/site-packages', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/PILcompat', '/usr/lib/python2.7/dist-packages/gtk-2.0', '/usr/lib/pymodules/python2.7'] For jupyter notebook: ['', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/PILcompat', '/usr/lib/python2.7/dist-packages/gtk-2.0', '/usr/lib/pymodules/python2.7', '/usr/local/lib/python2.7/dist-packages/IPython/extensions', '/home/allblues/.ipython']

rdodev commented 8 years ago

@allblues1001 you left a few 'saad-omar' there :p That said, you have an issue. Both paths should look more or less the same. It would seem tensorflow installed its own version of python? Either way, your issue is not related to Bash on Windows or ipython. I would suggest seeking help from the folks at tensorflow.

allblues1001 commented 8 years ago

thank you!

anandbhattad commented 8 years ago

@RitwikGupta ipython notebook --no-browser says 0 active kernel. I opened http://localhost:8888/tree# in my browser and then when I open a new notebook (python[root]) it says connecting to kernel and closes automatically. Can you please let me know what is the possible solution for this? Thanks! Anand Bhattad


this is what I get image

RitwikGupta commented 8 years ago

Check your console and ensure there are no errors first. If getting the socket error, follow the steps above.

On Wed, Aug 31, 2016 at 11:37 PM -0400, "bhattad2" notifications@github.com<mailto:notifications@github.com> wrote:

@RitwikGuptahttps://github.com/RitwikGupta ipython notebook --no-browser says 0 active kernel. I opened http://localhost:8888/tree# in my browser and then when I open a new notebook (python[root]) it says connecting to kernel and closes automatically. Can you please let me know what is the possible solution for this? Thanks! Anand Bhattad


this is what I get [image]https://cloud.githubusercontent.com/assets/16907734/18154563/5a082604-6fcb-11e6-8ab8-1a488becb7cf.png

You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/Microsoft/BashOnWindows/issues/185#issuecomment-243967211, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AEurpbB0-cTP5_8ULFspO1E6Ytd5OOURks5qlkhMgaJpZM4IG4pi.

anandbhattad commented 8 years ago

There are no console errors. And I'm able to use ipython from the terminal and I am able to import tensorflow, numpy without any error

RitwikGupta commented 8 years ago

This seems like an iPython issue rather than BashOnWindows, so I would suggest taking this issue to that repo, but I think the error is in your kernel config. Is python[root] your kernel? It should be called “Python 2” or “Python 3” for a fresh install.

bobev18 commented 8 years ago

@aseering Please clarify few things about the solution:

Thank you

yasirs commented 8 years ago

Also, shouldn't Microsoft be moving towards an actual solution to this rather than just @aseering's workaround?

On Thu, Sep 1, 2016 at 5:11 PM, bobev18 notifications@github.com wrote:

@aseering https://github.com/aseering Please clarify few things about the solution:

  • does it work only for Python 2.7 or does it cover Python 3.x?
  • you keep referring to IPython rather than Jupyter - does this mean Jupyter is not covered?
  • how should we integrate the solution in case of virtualenv or anaconda environments?

Thank you

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Microsoft/BashOnWindows/issues/185#issuecomment-244213704, or mute the thread https://github.com/notifications/unsubscribe-auth/AAYcmsyDi5NKMFW7XuLE6fuq5Pb3ckW0ks5qlz95gaJpZM4IG4pi .

aseering commented 8 years ago

@bobev18 , maybe this helps to understand the issue: This bug is not a bug in Python. IPython (and Jupyter) Notebook are not pure Python; they contain some native code as well, and that native code links against some third-party native systemwide C libraries. The problem is a bug in one of those libraries, "libzmq". All versions of Notebook link libzmq. Because it's an independent system library, it doesn't matter what version of iPython/Jupyter you're using, nor what version of Python.

But which libzmq do they link? The iPython that comes with Ubuntu uses the libzmq that comes with Ubuntu. I believe pip will try to use the system libzmq as well. My updated patch fixes Ubuntu's version of the library. Anaconda bundles their own copy of libzmq, so you have to use @jzuhone 's solution to get their fix.

aseering commented 8 years ago

@yasirs -- for what it's worth, this is actually a bug in Ubuntu's package. The bug has been acknowledged and fixed upstream. It happens to be much more disruptive on WSL, but it's a bug either way. My "workaround" is simply to backport the fix to Ubuntu 14.04.

Sure, Microsoft should make their code more robust to buggy code. I hope they've gotten that memo :-) But this is a known bug whose fix has been submitted to Ubuntu. They could accept the patch today and ... well, sure, some important edge cases, but it would help a lot of people. So, could some of the enthusiastic folks here go upvote / encourage them to do that?:

https://bugs.launchpad.net/ubuntu/+source/zeromq3/+bug/1602900

fedorzh commented 8 years ago

@aseering Do you mind sharing latest instructions for clean install please? The thread is quite long, and it's not clear if things are changed since your last instructions post

arthurhjorth commented 8 years ago

This worked for me a few weeks ago from a fresh install:

Sudo apt-get update Sudo apt-get install python-pip ipython ipython-notebook ipython3 ipython3-notebook sudo add-apt-repository ppa:aseering/wsl sudo apt-get update sudo apt-get install libzmq3 sudo apt-get install python3-pip sudo pip3 install jupyter sudo pip install jupyter jupyter notebook --no-browser

No reason to believe it wouldn't work now. But it would be great with confirmation if you decide to try this out.

On Tue, Sep 20, 2016, 5:43 PM fedorzh notifications@github.com wrote:

@aseering https://github.com/aseering Do you mind sharing latest instructions for clean install please? The thread is quite long, and it's not clear if things are changed since your last instructions post

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Microsoft/BashOnWindows/issues/185#issuecomment-248457677, or mute the thread https://github.com/notifications/unsubscribe-auth/ABxk66QF7rV31K3PrktrGIdNJDldVELrks5qsGGcgaJpZM4IG4pi .

arthurhjorth commented 8 years ago

(Email client on phone capitalized s couple of sudo there, sorry. Just lowercase the S.)

On Tue, Sep 20, 2016, 5:50 PM Arthur Hjorth arthur.hjorth@stx.oxon.org wrote:

This worked for me a few weeks ago from a fresh install:

Sudo apt-get update Sudo apt-get install python-pip ipython ipython-notebook ipython3 ipython3-notebook

sudo add-apt-repository ppa:aseering/wsl sudo apt-get update sudo apt-get install libzmq3

sudo apt-get install python3-pip sudo pip3 install jupyter sudo pip install jupyter jupyter notebook --no-browser

No reason to believe it wouldn't work now. But it would be great with confirmation if you decide to try this out.

On Tue, Sep 20, 2016, 5:43 PM fedorzh notifications@github.com wrote:

@aseering https://github.com/aseering Do you mind sharing latest instructions for clean install please? The thread is quite long, and it's not clear if things are changed since your last instructions post

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Microsoft/BashOnWindows/issues/185#issuecomment-248457677, or mute the thread https://github.com/notifications/unsubscribe-auth/ABxk66QF7rV31K3PrktrGIdNJDldVELrks5qsGGcgaJpZM4IG4pi .

fedorzh commented 8 years ago

@arthurhjorth Thanks! I am actually trying to install with python 2, as I want to use tensorflow and gym, and they don't support 3 as well as 2 yet. I have tried

apt-get install python-pip ipython ipython-notebook add-apt-repository ppa:aseering/wsl apt-get update apt-get install libzmq3 pip install jupyter jupyter notebook --no-browser

(no sudos didn't give any errors during installation, and I wanted to do anything as myself to avoid permission problems in the future) but that didn't work (as in still the same error "Invalid argument (bundled/zeromq/src/tcp_address.cpp:190")

fedorzh commented 8 years ago

Using @rdodev 's advice exactly (without sudo as I logged in as root) https://github.com/Microsoft/BashOnWindows/issues/185#issuecomment-241515056, with full reinstall of Ubuntu, ipython notebook worked! Further pip install jupyter worked for running jupyter instead.

arthurhjorth commented 8 years ago

After upgrading to 14936, jupyter notebook no longer works on my machine. If you're in this thread, you probably care about that, so don't upgrade unless you have to.

arthurhjorth commented 8 years ago

Reverting back fixed it.

On the new build, I got an error about unsupported operation at tcp_address.cpp:169 and the kernel kept restarting until it had tried five times, and then it gave up.

I am using my computer to do a presentation including some coding, so I can't help with debugging atm or offer any other information.

phobson commented 8 years ago

FWIW, I'm seeing the exact same thing as @arthurhjorth with python and jupyter installed from conda

Yangff commented 8 years ago

@arthurhjorth +1 In 14936,

[I 23:55:53.388 NotebookApp] Kernel started: 99311cb2-a24a-4f51-983b-7187e3fe940d
Operation not supported (tcp_address.cpp:169)
[I 23:55:56.383 NotebookApp] KernelRestarter: restarting kernel (1/5)
Operation not supported (tcp_address.cpp:169)
[I 23:55:59.465 NotebookApp] KernelRestarter: restarting kernel (2/5)
Operation not supported (tcp_address.cpp:169)
[I 23:56:02.523 NotebookApp] KernelRestarter: restarting kernel (3/5)
^C[I 23:56:03.049 NotebookApp] interrupted
Serving notebooks from local directory: /root
1 active kernels
The Jupyter Notebook is running at: http://localhost:8192/
Shutdown this notebook server (y/[n])? ^C[C 23:56:03.195 NotebookApp] recei
Yangff commented 8 years ago

Fix:

In 14936, kernel use EOPNOTSUPP instead of EINVAL.

So, after using https://launchpadlibrarian.net/261891465/zeromq3_4.0.4+dfsg-2_4.0.4+dfsg-2wsl1.diff.gz this patch, EOPNOTSUPP is not ignored.

Line 161 should be if (rc != 0 && (errno == EINVAL || errno == EOPNOTSUPP))

and it should works.

@phobson @arthurhjorth

PS: you may use this libzmq3 (if you trust me), or you can modify that line and build the package

Hint: If you are building & packing this library under WSL, you should skip all tests (some tests may not pass under WSL)

modified_libzmq3.zip

phobson commented 8 years ago

@Yangff Thanks for the information! Very insightful.

I'm less interested in getting this running now than I am in poking the right people (e.g., jupyter, zeromq) so that they are aware of the issue and can support WSL

benhillis commented 8 years ago

Ideally people shouldn't have to make changes to support WSL. It's more a matter of us making sure to return the right error code in this condition. I'll take a look at this tomorrow and see what the problem is.

RitwikGupta commented 8 years ago

@benhillis Thanks for making sure this issue is taken care of :smile:

yasirs commented 8 years ago

Thanks! Can @aseering update his branch with this patch, so people can use the the same instructions to use the patched package?

On Sun, Oct 2, 2016 at 7:57 PM, Ritwik Gupta notifications@github.com wrote:

@benhillis https://github.com/benhillis Thanks for making sure this issue is taken care of 😄

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Microsoft/BashOnWindows/issues/185#issuecomment-251005041, or mute the thread https://github.com/notifications/unsubscribe-auth/AAYcmpleOGQ48MJFtbvLRHzD8F8yZEy_ks5qwEUGgaJpZM4IG4pi .

arthurhjorth commented 8 years ago

@Yangff thanks so much! I have too much work this week to dare do anything other than just stick with the old build for now. Unless there's a WSL fix in sight by some time after next week, I'll use your libzmq. Thank you!!

benhillis commented 8 years ago

I'm having trouble reproducing this issue. Could somebody give me a list of steps / instructions? Here's what I did:

apt-get update
apt-get install python-pip ipython ipython-notebook libzmq3
pip install jupyter
jupyter notebook --no-browser

I then launched a browser and navigated to the URL that was spit out by the jupyter command.

phobson commented 8 years ago

@benhillis can you then start a notebook and execute python?

IME, launching the server seems to work fine. The problems arise when you create a new notebook and try to execute even the most basic code. For example:

import os
print(os.getcwd())

Should trigger a restart to the kernel (if it let's you get that far).

benhillis commented 8 years ago

On the site New, then Terminal and ran python inside of that. Is that what you mean?

image

RitwikGupta commented 8 years ago

Hm, it may be that the Ubuntu trunk libzmq may be working properly now with WSL. @benhillis, can you try the steps listed on https://github.com/Microsoft/BashOnWindows/issues/185#issuecomment-225449188 and see if that breaks it? If so, the libzmq on @aseering's PPA might be borked.

EDIT: Disregard, I misidentified the issue. See @phobson's comment below for repro.

phobson commented 8 years ago

@benhillis

You need to make a new notebook, not a terminal:

create

Then you get stuck in a loop of dead/restarting kernels:

dead

Console output looks like this:

(jup) paul@POR-PHOBSON10:/mnt/c/Users/phobson$ jupyter notebook --no-browser
[W 11:13:39.836 NotebookApp] Widgets are unavailable. Please install widgetsnbextension or ipywidgets 4.0
[I 11:13:39.851 NotebookApp] Serving notebooks from local directory: /mnt/c/Users/phobson
[I 11:13:39.852 NotebookApp] 0 active kernels
[I 11:13:39.852 NotebookApp] The Jupyter Notebook is running at: http://localhost:8888/
[I 11:13:39.852 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[I 11:14:20.160 NotebookApp] 302 GET / (127.0.0.1) 4.28ms
[I 11:15:47.918 NotebookApp] Creating new notebook in
[W 11:15:48.907 NotebookApp] 404 GET /nbextensions/widgets/notebook/js/extension.js?v=20161003111339 (127.0.0.1) 14.75ms referer=http://127.0.0.1:8888/notebooks/Untitled.ipynb?kernel_name=python3
[I 11:15:49.166 NotebookApp] Kernel started: 03a01c40-5d09-444d-a173-bf97447956bd
Invalid argument (src/tcp_address.cpp:172)
[I 11:15:52.165 NotebookApp] KernelRestarter: restarting kernel (1/5)
Invalid argument (src/tcp_address.cpp:172)
[I 11:15:55.232 NotebookApp] KernelRestarter: restarting kernel (2/5)
Invalid argument (src/tcp_address.cpp:172)
[I 11:15:58.295 NotebookApp] KernelRestarter: restarting kernel (3/5)
[W 11:15:59.202 NotebookApp] Timeout waiting for kernel_info reply from 03a01c40-5d09-444d-a173-bf97447956bd
Invalid argument (src/tcp_address.cpp:172)
[I 11:16:01.380 NotebookApp] KernelRestarter: restarting kernel (4/5)
WARNING:root:kernel 03a01c40-5d09-444d-a173-bf97447956bd restarted
Invalid argument (src/tcp_address.cpp:172)
[W 11:16:04.456 NotebookApp] KernelRestarter: restart failed
[W 11:16:04.458 NotebookApp] Kernel 03a01c40-5d09-444d-a173-bf97447956bd died, removing from map.
ERROR:root:kernel 03a01c40-5d09-444d-a173-bf97447956bd restarted failed!
[W 11:16:04.504 NotebookApp] Kernel deleted before session
[W 11:16:04.509 NotebookApp] 410 DELETE /api/sessions/84ce5660-b868-4824-805b-200a40c62596 (127.0.0.1) 12.75ms referer=http://127.0.0.1:8888/notebooks/Untitled.ipynb?kernel_name=python3
[W 11:16:22.342 NotebookApp] Session not found: session_id='84ce5660-b868-4824-805b-200a40c62596'
[W 11:16:22.342 NotebookApp] 404 DELETE /api/sessions/84ce5660-b868-4824-805b-200a40c62596 (127.0.0.1) 2.19ms referer=http://127.0.0.1:8888/notebooks/Untitled.ipynb?kernel_name=python3
[I 11:16:22.398 NotebookApp] Kernel started: 1da56c55-9360-4f85-89b1-76da21623cd6
Invalid argument (src/tcp_address.cpp:172)
[I 11:16:25.397 NotebookApp] KernelRestarter: restarting kernel (1/5)
Invalid argument (src/tcp_address.cpp:172)
[I 11:16:28.432 NotebookApp] KernelRestarter: restarting kernel (2/5)
Invalid argument (src/tcp_address.cpp:172)
[I 11:16:31.489 NotebookApp] KernelRestarter: restarting kernel (3/5)
Invalid argument (src/tcp_address.cpp:172)
[W 11:16:32.421 NotebookApp] Timeout waiting for kernel_info reply from 1da56c55-9360-4f85-89b1-76da21623cd6
[I 11:16:34.568 NotebookApp] KernelRestarter: restarting kernel (4/5)
WARNING:root:kernel 1da56c55-9360-4f85-89b1-76da21623cd6 restarted
Invalid argument (src/tcp_address.cpp:172)
[W 11:16:37.647 NotebookApp] KernelRestarter: restart failed
[W 11:16:37.649 NotebookApp] Kernel 1da56c55-9360-4f85-89b1-76da21623cd6 died, removing from map.
ERROR:root:kernel 1da56c55-9360-4f85-89b1-76da21623cd6 restarted failed!
[W 11:16:37.691 NotebookApp] Kernel deleted before session
[W 11:16:37.694 NotebookApp] 410 DELETE /api/sessions/93443e32-9137-48b4-ba40-2ee6c963ca34 (127.0.0.1) 7.89ms referer=http://127.0.0.1:8888/notebooks/Untitled.ipynb?kernel_name=python3
Carmezim commented 8 years ago

@rdodev you mean /uninstall /full?

By the way, if you are mostly using bash to run TensorFlow there is now an alpha Windows support to run it natively on CPU only here.

Currently, only CPU builds are supported, but we are working on providing a GPU build as well.

JimSEOW commented 8 years ago

ipython kernel keeps dying (bash on ubuntu on windows)

I follow this step, yet the kernel keeps dying

sudo add-apt-repository ppa:aseering/wsl sudo apt-get update sudo apt-get install libzmq3 libzmq3-dev export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu pip install --no-use-wheel -v pyzmq pip install jupyter

applicationframehost_2016-10-18_18-37-29 applicationframehost_2016-10-18_18-37-44

Kernel started: c81deaed-dfc4-4733-8ba7-173dc82d646c Invalid argument (src/tcp_address.cpp:190) KernelRestarter: restarting kernel (1/5) Invalid argument (src/tcp_address.cpp:190) KernelRestarter: restarting kernel (2/5) Invalid argument (src/tcp_address.cpp:190) KernelRestarter: restarting kernel (3/5) Invalid argument (src/tcp_address.cpp:190) Timeout waiting for kernel_info reply from c81deaed-dfc4-4733-8ba7-173dc82d646c KernelRestarter: restarting kernel (4/5) WARNING:root:kernel c81deaed-dfc4-4733-8ba7-173dc82d646c restarted Invalid argument (src/tcp_address.cpp:190) ![applicationframehost_2016-10-18_18-37-29] KernelRestarter: restart failed Kernel c81deaed-dfc4-4733-8ba7-173dc82d646c died, removing from map. ERROR:root:kernel c81deaed-dfc4-4733-8ba7-173dc82d646c restarted failed! Kernel deleted before session 410 DELETE /api/sessions/21a9b67b-1a2c-45cd-8df7-41885ae62f2e (127.0.0.1) 4.49ms referer=http://localhost:8888/notebooks/a.ipynb

JimSEOW commented 8 years ago

@Carmezim

By the way, if you are mostly using bash to run TensorFlow there is now an alpha Windows support to run it natively on CPU only now Most people still have problem getting the CPU only version to work :-(

Carmezim commented 8 years ago

@JimSEOW The native TensorFlow windows support is an alpha as you've read I mentioned, so you are expected to face some instability although it's made progress since then and seems to be working fine. For more information about it check their thread here. There is also a build now running with bazel. I have it running perfectly natively.

Now regarding bash and ipython, did you try to install on a clean bash installation?

JimSEOW commented 8 years ago

In @benhillis case: Invalid argument (src/tcp_address.cpp:172) In my case: Invalid argument (src/tcp_address.cpp:190)

Is this related to Bash on Windows? Any suggestion?

@Carmezim Yes, it is a clean bash installation. Do you have stable Juypter running on bash on Window? If so, I would try again, before moving to Hyper-V Ubuntu.

Carmezim commented 8 years ago

@JimSEOW Yes, I had problems to get it working at first but after a fresh installation and following some instructions above it worked normally.

thwump commented 8 years ago

@Yangff (or others that can help): I don't know what to do with the modified libzmq3 files you uploaded. I tried installing them using sudo dpkg -i filename and then sudo apt-get install -f afterwards, but it didn't seem to work.

How should this library get installed?

Yangff commented 8 years ago

@thwump dpkg -i should work.

Have you reinstalled pyzmq after change libzmq?

aseering commented 8 years ago

For what it's worth, the latest WSL Insider build contains a change that might work around this issue. I'm not at a Windows machine right now but I would be interested to know if the stock libzmq does indeed work now.

phobson commented 8 years ago

@aseering forgive my ignorance. how does one update to the latest build? (I presume it takes more than just sudo apt-get update && sudo apt-get upgrade --yes)

aseering commented 8 years ago

@phobson -- I'm guessing based on your question that you're running the standard stable version of Windows, and are not part of the Insider program? You can learn more about the program here:

https://insider.windows.com/

It's easy (and free) to join. Once you join, updates will automatically appear through Windows Update. But you can't selectively update (you can't just upgrade WSL, for example); you're opting in to receive a pre-release version of all of Windows. This new version contains new features; also new bugs :-)

Features added to the Insider releases eventually make it into the next major Windows release. So, if you don't choose to join the Insider program, you'll get the new features when the next major Windows version ships, probably some number of months from now.

arthurhjorth commented 7 years ago

It works for me, but I need to run all pip install or pip3 install with sudo -H flag so that everything installs in the home directory. I do not use the -H flag when installing things with apt-get. I don't know enough about all this stuff to make sense of why, but doing that makes everything run "out of the box" for me!

(If anyone understands why this would work and can spare the time to explain it or point to a good resource on it, I would love to learn. I've googled around and read stuff online but still can't put together a coherent explanation in my head.)

aseering commented 7 years ago

Hi @arthurhjorth -- what arguments are you running pip with?

sudo -H will not, by itself, cause things to be installed to your home directory. sudo (by default) runs commands as the root user rather than as your normal user account; root has elevated privileges to install things systemwide. sudo -H says, even though you're running as the root user, set the $HOME environment variable to point at your regular user's home directory. This affects programs that try to write to "the current user's home directory".

apt-get always installs software systemwide. (It's the Ubuntu package manager; it installs packages for your Ubuntu system.) Therefore, by default it must be run as root, and the value of the $HOME environment variable (and therefore the -H flag to sudo) doesn't affect it.

pip (and pip3) can install either systemwide or just for your current user account. By default, it decides where to install based on whether you run pip with the --user flag: With that flag, it will install to your home directory; without that flag, it will install systemwide. If you install systemwide, by default it will need to run as root. If you install to your home directory, you should not need to install as root -- this is very useful for users on shared machines who don't have sudo access.

There are a few weird edge cases to consider:

All of the above assumes that you're using the standard version of Python packaged for Ubuntu Linux (which is what WSL uses). If you're running on CentOS, or Mac, or on Ubuntu using an alternative version of Python such as Anaconda or Linuxbrew, or if you compile and install Python yourself from source, then at minimum the number and location of paths in Python's search path will change; also, some of those installations will reconfigure your system to not require root access to install Python packages systemwide.

gencee commented 7 years ago

@jzuhone Hey man thks for the fix. I tried to fix this for days now and your package made it work like a charm! I appreciate it!

spoonsso commented 7 years ago

Sorry, found some issues with the above. Try: conda install -c jzuhone zeromq=4.1.dev0 instead

Aye, also just saved by @jzuhone. For anyone working from an anaconda install, his package totally works. Thanks!