Closed RobinL closed 5 years ago
Weird, it installs fine for me without sudo:
jovyan@jupyter-lab-davidread-ju-d869bf94-ch4s5:~$ pip install lxml
Collecting lxml
Downloading https://files.pythonhosted.org/packages/03/a4/9eea8035fc7c7670e5eab97f34ff2ef0ddd78a491bf96df5accedb0e63f5/lxml-4.2.5-cp36-cp36m-manylinux1_x86_64.whl (5.8MB)
100% |████████████████████████████████| 5.8MB 107kB/s
Installing collected packages: lxml
Successfully installed lxml-4.2.5
You are using pip version 9.0.3, however version 18.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
jovyan@jupyter-lab-davidread-ju-d869bf94-ch4s5:~$ python -c 'import lxml; print(lxml)'
<module 'lxml' from '/home/jovyan/.local/lib/python3.6/site-packages/lxml/__init__.py'>
But I have xmllib2 installed by conda already (in /opt/conda
):
$ conda list |grep xml
libxml2 2.9.8 h422b904_2 conda-forge
But I can't edit the install of course:
$ conda uninstall libxml2
Solving environment: failed
NotWritableError: The current user does not have write permissions to a required path.
path: /home/jovyan/.conda/pkgs/urls.txt
uid: 1001
gid: 100
If you feel that permissions on this path are set incorrectly, you can manually
change them by executing
$ sudo chown 1001:100 /home/jovyan/.conda/pkgs/urls.txt
In general, it's not advisable to use 'sudo conda'.
Could we give users sudo access? Without it conda wouldn't let them install system libraries. It seems concerning.
Ideas:
Robin suggested we focus on making sure our standard image includes all the common python/R libraries with any system packages installed, e.g. anaconda.
I guess there will come a situation when this is not enough. e.g. you need a more recent version of libxml than the default, and want to install it with sudo to be the default system package, so that the R/python library uses it? For the time being an admin can do this by editing the dockerfile, but when that becomes unsustainable then we can see about letting users manage it.
@RobinL The error you got originally is:
zlib.error: Error -3 while decompressing data: invalid literal/length code
Doesn't seem like a permissions error. Could that simply be a one-off network error?
Robin said this wasn't a one off. I can reproduce the error by execing into his jupyter container.
Ah, I've solved it now. In Robin's container I managed to install lxml fine by telling pip not to use its cached copy of the .whl:
pip install lxml --no-cache-dir -v
The cached copy must have been corrupt - an empty file I suspect.
I was not able to install lxml without sudo permissions (which only I have).
We probably need to spend some time thinking about how to install libs. For instance, do we want users using conda?