添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

Do you now how to install numpy or any package to Yunohost JupiterLab venv environment?

When I use pip I get the following error:

Capture%20d%E2%80%99%C3%A9cran%205 906×165 20.4 KB Thanks for your help!

Edit: confirmed working on my virtual machine:

 ⚡ root@vm > ~ > cd /opt/jupyterlab
 ⚡ root@vm > /opt/jupyterlab > pipenv shell
Launching subshell in virtual environment…
 . /opt/jupyterlab/.venv/bin/activate
 ⚡ root@vm > /opt/jupyterlab >  . /opt/jupyterlab/.venv/bin/activate
(jupyterlab)  ⚡ root@vm > /opt/jupyterlab > pip install numpy
Collecting numpy
  Downloading numpy-1.18.2-cp35-cp35m-manylinux1_x86_64.whl (20.0 MB)
     |████████████████████████████████| 20.0 MB 1.1 MB/s
Installing collected packages: numpy
Successfully installed numpy-1.18.2
(jupyterlab)  ⚡ root@vm > /opt/jupyterlab >
              

Which user are you running the command with?
Can you show which user the folder belongs to? ls -la /opt/jupyterlab

Please show all the commands you are using to get to the error. A copy/paste of your screen would be perfect.

One thing, maybe try to install numpy system-wide. exit the virtualenv first, then run pip install numpy

My console output :

admin@ericg:~$ cd /opt/jupyterlab
admin@ericg:/opt/jupyterlab$ pipenv shell
Launching subshell in virtual environment…
admin@ericg:/opt/jupyterlab$  . /opt/jupyterlab/.venv/bin/activate
(jupyterlab) admin@ericandmarie:/opt/jupyterlab$ pip install numpy
Collecting numpy
  Using cached numpy-1.18.2-cp35-cp35m-manylinux1_x86_64.whl (20.0 MB)
Installing collected packages: numpy
ERROR: Could not install packages due to an EnvironmentError: [Errno 13] Permission non accordée: '/opt/jupyterlab/.venv/lib/python3.5/site-packages/numpy-1.18.2.dist-info'
Consider using the `--user` option or check the permissions.
admin@eg:/opt/jupyterlab$ ls -la
total 132
drwxr-xr-x 4 root root   4096 mars  31 14:11 .
drwxr-xr-x 6 root root   4096 mars  19 17:15 ..
drwxr-xr-x 2 root root   4096 mars  27 20:35 config
-rw------- 1 root root     65 mars  19 17:16 jupyterhub_cookie_secret
-rw-r--r-- 1 root root      4 mars  27 20:35 jupyterhub-proxy.pid
-rw-r--r-- 1 root root 102400 mars  31 14:11 jupyterhub.sqlite
-rw-r--r-- 1 root root    228 mars  24 15:49 Pipfile
drwxr-xr-x 7 root root   4096 mars  24 15:49 .venv
admin@ericg:/opt/jupyterlab$ cd
admin@ericg:~$ pip install numpy
Traceback (most recent call last):
  File "/usr/bin/pip", line 9, in <module>
    from pip import main
ImportError: cannot import name main
              

OK the difference between my VM and your server is that I run as root, you as admin, and my jupyterlab folder belongs to admin and yours to root.

chown -R admin: /opt/jupyterlab
cd /opt/jupyterlab
pipenv shell
pip install numpy

As to why your directory does not belong to the same user, I don’t know.

Edit post-solution:
The matter is also discussed on Github: jupyterlab_ynh #35

There may be issues with multi-users with my solution.