1 | initial version |
Try using the "SageMath Py3" kernel in CoCalc, which uses a Python3-based SageMath, rather than a Python2-based one.
2 | No.2 Revision |
Try using the "SageMath Py3" kernel in CoCalc, which Sage uses a preparser, which transforms the "75" in your input into the Sage integer 75;
quotients with this "75" as a numerator or denominator thereafter become rationals
instead of floats.
The workaround for you is to input "75r" which stands for the raw Python integer 75, not to be preparsed by the Sage preparser.
So this will work (after installing tqdm for the Python of the Sage you are using):
from tqdm import tqdm_notebook as tqdm
for i in tqdm(range(50), total=75r):
print(i)
Note: if you want to use a Python3-based SageMath, rather than Sage in CoCalc, you can select the kernel
"SageMath (development, Py3)" from the list of kernels in CoCalc's Jupyter notebook.
To install extra pip packages for that Sage, do the following in a Python2-based one.
Select the development version of Sage:
~$ sage_select develop
Making default sage /ext/bin/sage-develop by creating ~/bin/sage symbolic link:
Restart your project server!
Then restart your project server (go to the project settings, and click "Restart Project" halfway down the right column).
Reopen the CoCalc terminal and check you have the right version of Sage:
~$ sage --version
SageMath version 8.8.beta1, Release Date: 2019-04-07
and that it is Python3-based:
~$ sage --python --version
Python 3.7.3
Then you can install extra Python packages for it:
~$ sage --pip install --user tqdm
Collecting tqdm
Downloading https://files.pythonhosted.org/packages/6c/4b/c38b5144cf167c4f52288517436ccafefe9dc01b8d1c190e18a6b154cd4a/tqdm-4.31.1-py2.py3-none-any.whl (48kB)
100% |████████████████████████████████| 51kB 5.6MB/s
Installing collected packages: tqdm
Successfully installed tqdm-4.31.1
Then in Jupyter worksheets using the "SageMath (development, Py3)" kernel you can import tqdm and use it.