Andrew Fletcher published: 3 October 2023 2 minutes read
Python3 error
None of PyTorch, TensorFlow >= 2.0, or Flax have been found. Models won't be available and only tokenizers, configuration and file/data utilities can be used.
You need one of them PyTorch or Tensorflow. You can check if tensorflow is installed or you can reinstall it
pip uninstall tensorflow
pip install tensorflow==2.2.0
pip uninstall transformers
pip install transformers==3.3.1
If a Python package isn't installed, when you run uninstall, you well see the following message
WARNING: Skipping tensorflow as it is not installed.
pip install transformers
The response post running the installer script for transformers
Collecting transformers==3.3.1
Downloading transformers-3.3.1-py3-none-any.whl (1.1 MB)
|████████████████████████████████| 1.1 MB 17.5 MB/s
Requirement already satisfied: filelock in /home/{user}/.local/lib/python3.8/site-packages (from transformers==3.3.1) (3.12.4)
Requirement already satisfied: requests in /home/{user}/.local/lib/python3.8/site-packages (from transformers==3.3.1) (2.31.0)
Collecting tokenizers==0.8.1.rc2
Downloading tokenizers-0.8.1rc2-cp38-cp38-manylinux1_x86_64.whl (3.0 MB)
|████████████████████████████████| 3.0 MB 55.9 MB/s
Requirement already satisfied: packaging in /home/{user}/.local/lib/python3.8/site-packages (from transformers==3.3.1) (23.2)
Requirement already satisfied: tqdm>=4.27 in /home/{user}/.local/lib/python3.8/site-packages (from transformers==3.3.1) (4.66.1)
Collecting sacremoses
Downloading sacremoses-0.0.53.tar.gz (880 kB)
|████████████████████████████████| 880 kB 59.9 MB/s
Requirement already satisfied: numpy in /home/{user}/.local/lib/python3.8/site-packages (from transformers==3.3.1) (1.24.3)
Requirement already satisfied: regex!=2019.12.17 in /home/{user}/.local/lib/python3.8/site-packages (from transformers==3.3.1) (2023.8.8)
Collecting sentencepiece!=0.1.92
Downloading sentencepiece-0.1.99-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.3 MB)
|████████████████████████████████| 1.3 MB 63.4 MB/s
Requirement already satisfied: charset-normalizer<4,>=2 in /home/{user}/.local/lib/python3.8/site-packages (from requests->transformers==3.3.1) (3.3.0)
Requirement already satisfied: certifi>=2017.4.17 in /home/{user}/.local/lib/python3.8/site-packages (from requests->transformers==3.3.1) (2023.7.22)
Requirement already satisfied: idna<4,>=2.5 in /usr/lib/python3/dist-packages (from requests->transformers==3.3.1) (2.8)
Requirement already satisfied: urllib3<3,>=1.21.1 in /usr/lib/python3/dist-packages (from requests->transformers==3.3.1) (1.25.8)
Requirement already satisfied: click in /home/{user}/.local/lib/python3.8/site-packages (from sacremoses->transformers==3.3.1) (8.1.7)
Collecting joblib
Downloading joblib-1.3.2-py3-none-any.whl (302 kB)
|████████████████████████████████| 302 kB 79.1 MB/s
Requirement already satisfied: six in /usr/lib/python3/dist-packages (from sacremoses->transformers==3.3.1) (1.14.0)
Building wheels for collected packages: sacremoses
Building wheel for sacremoses (setup.py) ... done
Created wheel for sacremoses: filename=sacremoses-0.0.53-py3-none-any.whl size=895255 sha256=65bcab53f0aeae99135a5d1b99ca15ebca1f4694c3bfd1f6a9b1f0a5f1c96343
Stored in directory: /home/{user}/.cache/pip/wheels/82/ab/9b/c15899bf659ba74f623ac776e861cf2eb8608c1825ddec66a4
Successfully built sacremoses
Installing collected packages: tokenizers, joblib, sacremoses, sentencepiece, transformers
Attempting uninstall: tokenizers
Found existing installation: tokenizers 0.13.3
Uninstalling tokenizers-0.13.3:
Successfully uninstalled tokenizers-0.13.3
Attempting uninstall: transformers
Found existing installation: transformers 4.33.3
Uninstalling transformers-4.33.3:
Successfully uninstalled transformers-4.33.3
Successfully installed joblib-1.3.2 sacremoses-0.0.53 sentencepiece-0.1.99 tokenizers-0.8.1rc2 transformers-3.3.1
MarkupSafe
MarkupSafe was able to be downgraded to 2.0.1
pip install markupsafe==2.0.1
However, reading the installer response
Collecting markupsafe==2.0.1
Using cached MarkupSafe-2.0.1-cp38-cp38-manylinux2010_x86_64.whl (30 kB)
ERROR: werkzeug 3.0.0 has requirement MarkupSafe>=2.1.1, but you'll have markupsafe 2.0.1 which is incompatible.
Installing collected packages: markupsafe
Attempting uninstall: markupsafe
Found existing installation: MarkupSafe 2.1.3
Uninstalling MarkupSafe-2.1.3:
Successfully uninstalled MarkupSafe-2.1.3
Successfully installed markupsafe-2.0.1
werkzeug
However, not the same could be said for werkzeug. It was running at 3.0.0 and to function needed MarkupSafe to be >= 2.1.1
Time to downgrade. Eventually I found the package that worked being 2.1.2
pip install werkzeug==2.1.2
Response
Collecting werkzeug==2.1.2
Downloading Werkzeug-2.1.2-py3-none-any.whl (224 kB)
|████████████████████████████████| 224 kB 22.4 MB/s
Installing collected packages: werkzeug
Attempting uninstall: werkzeug
Found existing installation: Werkzeug 2.2.0
Uninstalling Werkzeug-2.2.0:
Successfully uninstalled Werkzeug-2.2.0
Successfully installed werkzeug-2.1.2
Back to installing MarkupSafe
pip install markupsafe==2.0.1
Accordingly the response was
Requirement already satisfied: markupsafe==2.0.1 in /home/fdrc_drupal_dev/.local/lib/python3.8/site-packages (2.0.1)
Related articles
Andrew Fletcher
•
17 Mar 2025
Refining text analysis for research data from regex to Python automation
IntroductionData extraction and filtering are crucial for developers working with large research datasets. Whether you're working on government archives, industry reports, or academic research projects, extracting meaningful insights efficiently can be challenging. I'm going to explore how we...
Andrew Fletcher
•
13 Feb 2025
Deploying a Python project from UAT to production using Git
When deploying a Python project from a User Acceptance Testing (UAT) environment to Production, it’s essential to ensure that all dependencies and configurations remain consistent. Particularly in our situation where this was going to be the first deployment of AI semantic search functionality to...
Andrew Fletcher
•
07 Dec 2024
Navigating technical infrastructure hiccups when running Python packages in virtual environments
Seemingly minor technical misconfigurations can escalate into major organisational inefficiencies. Consider a scenario where a Python-based web application experiences repeated errors due to missing dependencies, incorrect permissions, and environment mismanagement. Although these challenges appear...