SageMath used to be a client side only math engine. The math prof that led the main support for it over the last 10 or so years decided to take a teaching sabbatical and move SageMath to a cloud only model which, as a side option, generated support income for him. The main target is other math teachers who enroll their students on that cloud under their supervision. SM incorporates several open source math tools, including the calculus engine Maxima, gnuplot, R and others. Nice system, but too much complication for my needs. I can continue using the last stand alone version and lose out on patches and upgrades, or ....
I could move to Python, which is what I decided to do. I have several projects that I'm working on and they all don't need the same libraries, extensions or plugins. Working on the projects in the same environment often results in a library for one project conflicting with another library used in another project. The solution is to follow in WINE's footsteps and create different "wine bottles" for different applications so that changing, adding or removing libraries to one project won't kill another project. In Python these "wine bottles" are called virutal environments. Here is how you set them up.
Make sure your system is updated:
sudo apt update
sudo apt full-upgrade
See if Python is already installed and what version.
python3 -V
More than likely, like my system, both python 2.7.18 and python 3.8.5 are already installed.
Install python's pip command:
sudo apt install python3-pip
That will allow you to install python packages using "pip3 install somepackage".
Now install some dev tools:
sudo apt install build-essential libssl-dev libffi-dev python3-dev
Install python's virtual environment creator:
sudo apt install python3-venv
Now, create a directory which will hold all of your python projects. I called mine
~/Documents/PythonProjects
cd into PythonProjects (or what ever you named yours) and issue:
python3 -m venv firstproject (or what ever you named it)
Under PythonProjects you can continue to create other environments. Each environment is actually its own directory, using the name you gave it, under PythonProjects (or what ever name you made it)
To activate a virtual environment, from PythonProjects issue:
source firstproject/bin/activate
The prompt will immediately change to (in my case):
(pythonpractice) jerry@jerryAspire-V3-771:~/Documents/PythonProjects$
showing that I am in my pythonpractice environment. From that prompt I can start python:
(pythonpractice) jerry@jerryAspire-V3-771:~/Documents/PythonProjects$ python
Python 3.8.5 (default, Jul 28 2020, 12:59:40)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
I am now in the pythonpractice subdirectory running Python in the interactive mode. Inside the PythonProjects directory I could use "python3 -m venv secondproject" to create another subdirectory of PythonProjects called secondproject. Using "source secondproject/bin/activate" I could then work in a second project simultaneously without fear of messing up my pythonpractice environment or having it mess up my secondproject environment.
To leave the interactive mode use Ctl+D or "quit()". To leave a virtual environment use "deactivate".
Your normal prompt will return.
While in a python environment you can install IDE's or other libraries or tools and run them from there. The repository has the spyder3 Python IDE, version 3.8. Once you install it you can use pip3 to install spider=4.1.5, which is what I have running. Inside my pythonpractice environment I typed "spyder3" (even though I am running version 4):
(pythonpractice) jerry@jerryAspire-V3-771:~/Documents/PythonProjects$ spyder3
<spyder.otherplugins._ModuleMock object at 0x7fac88846670>: 'bool' object is not callable
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/spyder/app/mainwindow.py", line 995, in setup
plugin = mod.PLUGIN_CLASS(self)
TypeError: 'bool' object is not callable
This error occurs inside an environment or out, and probably when called from the application menu. Even though a "bool" object error was listed in the console spyder3 ran normally as far as I could tell. If I run into a problem I'll post it in this thread.
A word of caution. When I typed "python" in a Konsole I get
But, inside a virtual environment "python" is assigned to the version used to create the virtual environment.
I decided to configure python to allow me to choose the default version so that when I typed "python -V" it responded with the correct version and number. I am not going to explain how I did that, instructions are easily available on the web, but in doing so it broke spyder3, which no longer would fire, and worse, it broke apt and muon, preventing me from adding or removing packages because "only root can do that". When I logged into root and ran either again, I still got the same message. Fortunately it took only a couple minutes to roll back to before the modification.
I could move to Python, which is what I decided to do. I have several projects that I'm working on and they all don't need the same libraries, extensions or plugins. Working on the projects in the same environment often results in a library for one project conflicting with another library used in another project. The solution is to follow in WINE's footsteps and create different "wine bottles" for different applications so that changing, adding or removing libraries to one project won't kill another project. In Python these "wine bottles" are called virutal environments. Here is how you set them up.
Make sure your system is updated:
sudo apt update
sudo apt full-upgrade
See if Python is already installed and what version.
python3 -V
More than likely, like my system, both python 2.7.18 and python 3.8.5 are already installed.
Install python's pip command:
sudo apt install python3-pip
That will allow you to install python packages using "pip3 install somepackage".
Now install some dev tools:
sudo apt install build-essential libssl-dev libffi-dev python3-dev
Install python's virtual environment creator:
sudo apt install python3-venv
Now, create a directory which will hold all of your python projects. I called mine
~/Documents/PythonProjects
cd into PythonProjects (or what ever you named yours) and issue:
python3 -m venv firstproject (or what ever you named it)
Under PythonProjects you can continue to create other environments. Each environment is actually its own directory, using the name you gave it, under PythonProjects (or what ever name you made it)
To activate a virtual environment, from PythonProjects issue:
source firstproject/bin/activate
The prompt will immediately change to (in my case):
(pythonpractice) jerry@jerryAspire-V3-771:~/Documents/PythonProjects$
showing that I am in my pythonpractice environment. From that prompt I can start python:
(pythonpractice) jerry@jerryAspire-V3-771:~/Documents/PythonProjects$ python
Python 3.8.5 (default, Jul 28 2020, 12:59:40)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
I am now in the pythonpractice subdirectory running Python in the interactive mode. Inside the PythonProjects directory I could use "python3 -m venv secondproject" to create another subdirectory of PythonProjects called secondproject. Using "source secondproject/bin/activate" I could then work in a second project simultaneously without fear of messing up my pythonpractice environment or having it mess up my secondproject environment.
To leave the interactive mode use Ctl+D or "quit()". To leave a virtual environment use "deactivate".
Your normal prompt will return.
While in a python environment you can install IDE's or other libraries or tools and run them from there. The repository has the spyder3 Python IDE, version 3.8. Once you install it you can use pip3 to install spider=4.1.5, which is what I have running. Inside my pythonpractice environment I typed "spyder3" (even though I am running version 4):
(pythonpractice) jerry@jerryAspire-V3-771:~/Documents/PythonProjects$ spyder3
<spyder.otherplugins._ModuleMock object at 0x7fac88846670>: 'bool' object is not callable
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/spyder/app/mainwindow.py", line 995, in setup
plugin = mod.PLUGIN_CLASS(self)
TypeError: 'bool' object is not callable
This error occurs inside an environment or out, and probably when called from the application menu. Even though a "bool" object error was listed in the console spyder3 ran normally as far as I could tell. If I run into a problem I'll post it in this thread.
A word of caution. When I typed "python" in a Konsole I get
Code:
$ python Command 'python' not found, did you mean: command 'python3' from deb python3 command 'python' from deb python-is-python3
I decided to configure python to allow me to choose the default version so that when I typed "python -V" it responded with the correct version and number. I am not going to explain how I did that, instructions are easily available on the web, but in doing so it broke spyder3, which no longer would fire, and worse, it broke apt and muon, preventing me from adding or removing packages because "only root can do that". When I logged into root and ran either again, I still got the same message. Fortunately it took only a couple minutes to roll back to before the modification.
Comment