sagemathinc / cocalc-docker

DEPRECATED (was -- Docker setup for running CoCalc as downloadable software on your own computer)
https://cocalc.com
Other
398 stars 103 forks source link

Installing pip packages to sagemath #154

Closed Kr1zA closed 1 year ago

Kr1zA commented 2 years ago

Hello.

I have docker installation of cocalc. I am trying to install some packages to sagemath. When trying to install from cocalc web "!pip install sigfig" I get permission denied: PermissionError: [Errno 13] Permission denied: '/usr/local/sage/local/var/lib/sage/venv-python3.8/lib/python3.8/site-packages/sortedcontainers-2.4.0.dist-info'

When installing from terminal as root with: pip install sigfig or sage --pip install sigfig or root@c2479002b3bc:/usr/local/sage/local/var/lib/sage/venv-python3.8# bin/pip3 install sigfig Collecting sigfig Using cached sigfig-1.2.0-py3-none-any.whl (8.8 kB) Requirement already satisfied: SortedContainers in ./lib/python3.8/site-packages (from sigfig) (2.4.0) Installing collected packages: sigfig Successfully installed sigfig-1.2.0

I can see sage -installed | grep sigfig sigfig..................................? (1.2.0)

When using in terminal: root@c2479002b3bc:/usr/local/sage/local/var/lib/sage/venv-python3.8# bin/python3 Python 3.8.10 (default, Nov 26 2021, 20:14:08) [GCC 9.3.0] on linux Type "help", "copyright", "credits" or "license" for more information.

import sigfig as sf sf.round(1234, 1) 1000

It is working.

But when trying in cocalc web in jypyter using sage python kernel or sage kernel I get: import sigfig as sf sf.round(1234, 1)

AttributeError Traceback (most recent call last) /tmp/ipykernel_18774/2693895983.py in ----> 1 sf.round(1234, 1)

AttributeError: module 'sigfig' has no attribute 'round'

So it is imported but there are no methods: from inspect import getmembers, isfunction print(getmembers(sf, isfunction)) []

Where is the problem? Thank you for your replies.

williamstein commented 1 year ago

This seems like a general Sage problem. You probably need to do docker exec -it cocalc bash and maybe su - sage ?