Python installation: Difference between revisions
No edit summary |
|||
| (One intermediate revision by the same user not shown) | |||
| Line 1: | Line 1: | ||
Install your very own Python and keep everything under control. | Install your very own Python and keep everything under control. | ||
| Line 35: | Line 29: | ||
There are differnt way to install the ffmpeg binaries (ffmpeg.exe, ffplay.exe, and ffprobe.exe). The easiest way is to put them here: %LOCALAPPDATA% | There are differnt way to install the ffmpeg binaries (ffmpeg.exe, ffplay.exe, and ffprobe.exe). The easiest way is to put them here: %LOCALAPPDATA% | ||
=== Linux === | === Linux === | ||
| Line 89: | Line 81: | ||
<syntaxhighlight lang="shell">pip uninstall numpy numba</syntaxhighlight> | <syntaxhighlight lang="shell">pip uninstall numpy numba</syntaxhighlight> | ||
=== Linux === | === Linux === | ||
| Line 111: | Line 102: | ||
<span id="basic-packages-you-want-to-install"></span> | <span id="basic-packages-you-want-to-install"></span> | ||
== Basic Packages you want to install == | == Basic Packages you want to install == | ||
=== Windows === | === Windows === | ||
<syntaxhighlight lang="shell">pip3 install numpy scipy pandas flake8 pep8-naming black matplotlib seaborn ipython jupyterlab mypy dataclasses-json dataconf ipympl pywavelets scikit-image opencv-python scikit-learn tqdm argh sympy jsmin pybind11 pybind11-stubgen pigar asciichartpy natsort ipykernel </syntaxhighlight> | <syntaxhighlight lang="shell">pip3 install numpy scipy pandas flake8 pep8-naming black matplotlib seaborn ipython jupyterlab mypy dataclasses-json dataconf ipympl pywavelets scikit-image opencv-python scikit-learn tqdm argh sympy jsmin pybind11 pybind11-stubgen pigar asciichartpy natsort ipykernel </syntaxhighlight> | ||
=== Linux === | === Linux === | ||
| Line 210: | Line 198: | ||
| IPython Kernel for Jupyter | | IPython Kernel for Jupyter | ||
|} | |} | ||
=== PyTorch === | === PyTorch === | ||
| Line 217: | Line 203: | ||
'''Note: Even if you don’t want to use TensorFlow, you want to install it too due to the tensorboard package.''' Tensorboard allows to track the progress during learning. | '''Note: Even if you don’t want to use TensorFlow, you want to install it too due to the tensorboard package.''' Tensorboard allows to track the progress during learning. | ||
==== Windows ==== | ==== Windows ==== | ||
===== CPU only ===== | ===== CPU only ===== | ||
<syntaxhighlight lang="shell">pip3 install torch torchvision torchaudio torchtext </syntaxhighlight> | <syntaxhighlight lang="shell">pip3 install torch torchvision torchaudio torchtext </syntaxhighlight> | ||
===== NVidia GPU ===== | ===== NVidia GPU ===== | ||
<syntaxhighlight lang="shell">pip3 install torch torchvision torchaudio torchtext --index-url https://download.pytorch.org/whl/cu121</syntaxhighlight> | <syntaxhighlight lang="shell">pip3 install torch torchvision torchaudio torchtext --index-url https://download.pytorch.org/whl/cu121</syntaxhighlight> | ||
==== Linux ==== | ==== Linux ==== | ||
===== CPU only ===== | ===== CPU only ===== | ||
<syntaxhighlight lang="shell">cd /home/[YOURUSERNAME]/P3.12/bin | <syntaxhighlight lang="shell">cd /home/[YOURUSERNAME]/P3.12/bin | ||
./pip3 install torch torchvision torchaudio torchtext --index-url https://download.pytorch.org/whl/cpu</syntaxhighlight> | ./pip3 install torch torchvision torchaudio torchtext --index-url https://download.pytorch.org/whl/cpu</syntaxhighlight> | ||
===== NVidia GPU ===== | ===== NVidia GPU ===== | ||
| Line 259: | Line 236: | ||
| [https://github.com/pytorch/text Models, data loaders and abstractions for language processing, powered by PyTorch] | | [https://github.com/pytorch/text Models, data loaders and abstractions for language processing, powered by PyTorch] | ||
|} | |} | ||
=== TensorFlow === | === TensorFlow === | ||
==== Windows ==== | ==== Windows ==== | ||
===== CPU only ===== | ===== CPU only ===== | ||
<syntaxhighlight lang="shell">pip3 install tensorflow</syntaxhighlight> | <syntaxhighlight lang="shell">pip3 install tensorflow</syntaxhighlight> | ||
===== NVidia GPU ===== | ===== NVidia GPU ===== | ||
<syntaxhighlight lang="shell">pip3 install tensorflow[and-cuda]</syntaxhighlight> | <syntaxhighlight lang="shell">pip3 install tensorflow[and-cuda]</syntaxhighlight> | ||
==== Linux ==== | ==== Linux ==== | ||
===== CPU only ===== | ===== CPU only ===== | ||
<syntaxhighlight lang="shell">cd /home/[YOURUSERNAME]/P3.12/bin | <syntaxhighlight lang="shell">cd /home/[YOURUSERNAME]/P3.12/bin | ||
./pip3 install tensorflow</syntaxhighlight> | ./pip3 install tensorflow</syntaxhighlight> | ||
===== NVidia GPU ===== | ===== NVidia GPU ===== | ||
Latest revision as of 15:41, 17 October 2025
Install your very own Python and keep everything under control.
Questions to David Rotermund
We need to download a suitable Python version from https://www.python.org. In the case we want to use PyTorch check here or TensorFlow check here we need to check if the Python version is okay.
Windows
I downloaded this file: https://www.python.org/ftp/python/3.12.7/python-3.12.7-amd64.exe
Select “Add python.exe to Path” and then press “Install Now”.
We need to update pip first:
python.exe -m pip install --upgrade pip
ffmpeg
You might need to create mp4 files. E.g. for saving matplotlib animations
Thus you need ffmpeg binaries. You find them here: https://www.gyan.dev/ffmpeg/builds/
I went for https://www.gyan.dev/ffmpeg/builds/packages/ffmpeg-6.0-full_build.7z
There are differnt way to install the ffmpeg binaries (ffmpeg.exe, ffplay.exe, and ffprobe.exe). The easiest way is to put them here: %LOCALAPPDATA%
Linux
Please check the dependencies beforehand!!!
For Fedora:
Honestly, I didn’t get this depencency thing working. And I couldn’t find a solution. However, I am installing a huge amount of packages anyway such that the required stuff is part of it. :-)
sudo dnf install dnf-plugins-core # install this to use 'dnf builddep'
sudo dnf builddep python3
Python installation (after the dependencies are solved):
mkdir PySource
cd PySource
wget https://www.python.org/ftp/python/3.12.7/Python-3.12.7.tgz
tar -xvzf Python-3.12.7.tgz
cd Python-3.12.7
./configure --prefix=/home/[YOURUSERNAME]/P3.12 --enable-optimizations
make -j 10
make install
cd /home/[YOURUSERNAME]/P3.12/bin
./pip3 install --upgrade pip
Bash (.bash_profile)
alias pyhton3=/home/[YOURUSERNAME]/P3.12/bin/python3
alias pyhton=/home/[YOURUSERNAME]/P3.12/bin/python3
alias ipyhton=/home/[YOURUSERNAME]/P3.12/bin/ipython
alias ipyhton3=/home/[YOURUSERNAME]/P3.12/bin/ipython
alias python3=/home/[YOURUSERNAME]/P3.12/bin/python3
alias python=/home/[YOURUSERNAME]/P3.12/bin/python3
alias ipython=/home/[YOURUSERNAME]/P3.12/bin/ipython
alias ipython3=/home/[YOURUSERNAME]/P3.12/bin/ipython
alias pip3=/home/[YOURUSERNAME]/P3.12/bin/pip3
alias pip=/home/[YOURUSERNAME]/P3.12/bin/pip3
And add /home/[YOURUSERNAME]/P3.12/bin to the export PATH= command.
Numba
{: .topic-optional} This is an optional topic!
The question is: Is numba broken in the moment or not? First we install numpy and then numba. We will observe if numba tried to change the numpy version.
Windows
pip install numpy
pip install numba
If so then you have to decide if you want to remove numba and the downgraded numpy version before continuing. I would remove it!
pip uninstall numpy numba
Linux
cd /home/[YOURUSERNAME]/P3.12/bin
./pip install numpy
cd /home/[YOURUSERNAME]/P3.12/bin
./pip install numba
If so then you have to decide if you want to remove numba and the downgraded numpy version before continuing. I would remove it!
cd /home/[YOURUSERNAME]/P3.12/bin
./pip uninstall numpy numba
| Package | |
|---|---|
| numba | Numba is an open source JIT compiler that translates a subset of Python and NumPy code into fast machine code. |
Basic Packages you want to install
Windows
pip3 install numpy scipy pandas flake8 pep8-naming black matplotlib seaborn ipython jupyterlab mypy dataclasses-json dataconf ipympl pywavelets scikit-image opencv-python scikit-learn tqdm argh sympy jsmin pybind11 pybind11-stubgen pigar asciichartpy natsort ipykernel
Linux
cd /home/[YOURUSERNAME]/P3.12/bin
./pip3 install numpy scipy pandas flake8 pep8-naming black matplotlib seaborn ipython jupyterlab mypy dataclasses-json dataconf ipympl pywavelets scikit-image opencv-python scikit-learn tqdm argh sympy jsmin pybind11 pybind11-stubgen pigar asciichartpy natsort ipykernel filelock importlib-metadata regex fsspec
PyTorch
Check here for a installation configurator.
Note: Even if you don’t want to use TensorFlow, you want to install it too due to the tensorboard package. Tensorboard allows to track the progress during learning.
Windows
CPU only
pip3 install torch torchvision torchaudio torchtext
NVidia GPU
pip3 install torch torchvision torchaudio torchtext --index-url https://download.pytorch.org/whl/cu121
Linux
CPU only
cd /home/[YOURUSERNAME]/P3.12/bin
./pip3 install torch torchvision torchaudio torchtext --index-url https://download.pytorch.org/whl/cpu
NVidia GPU
cd /home/[YOURUSERNAME]/P3.12/bin
./pip3 install torch torchvision torchaudio torchtext
TensorFlow
Windows
CPU only
pip3 install tensorflow
NVidia GPU
pip3 install tensorflow[and-cuda]
Linux
CPU only
cd /home/[YOURUSERNAME]/P3.12/bin
./pip3 install tensorflow
NVidia GPU
cd /home/[YOURUSERNAME]/P3.12/bin
./pip3 install tensorflow[and-cuda]
