Skip to main content

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 Fletcher29 Feb 2024
Python - OSError: [Errno 24] Too many open files
The "Too many open files" error in Python typically occurs when your program has opened more file descriptors than the operating system allows. This error is often seen in situations where files are not being properly closed after use, leading to the exhaustion of available file...
Andrew Fletcher17 Feb 2024
How to update installed Python packages
You can use the pip list --outdated command to view a list of installed Python packages that have newer versions available. This command will show you which packages are outdated and can be updated to the latest versions.Here's how you can use itpip list --outdatedThis command will display a list of...