Home > Software engineering >  How to solve this Error while installing libraries in Python?
How to solve this Error while installing libraries in Python?

Time:01-31

While executing this code pip install simpletransformers datasets tqdm pandas

I'm getting errors. I'm attaching the logs.

Collecting simpletransformers
  Using cached simpletransformers-0.63.9-py3-none-any.whl (250 kB)
Collecting datasets
  Using cached datasets-2.9.0-py3-none-any.whl (462 kB)
Collecting tqdm
  Using cached tqdm-4.64.1-py2.py3-none-any.whl (78 kB)
Collecting pandas
  Using cached pandas-1.5.3-cp311-cp311-win_amd64.whl (10.3 MB)
Collecting numpy
  Using cached numpy-1.24.1-cp311-cp311-win_amd64.whl (14.8 MB)
Requirement already satisfied: requests in d:\program files\python\lib\site-packages (from simpletransformers) (2.28.2)
Collecting regex
  Using cached regex-2022.10.31-cp311-cp311-win_amd64.whl (267 kB)
Collecting transformers>=4.6.0
  Using cached transformers-4.26.0-py3-none-any.whl (6.3 MB)
Collecting scipy
  Using cached scipy-1.10.0-cp311-cp311-win_amd64.whl (42.2 MB)
Collecting scikit-learn
  Using cached scikit_learn-1.2.1-cp311-cp311-win_amd64.whl (8.2 MB)
Collecting seqeval
  Using cached seqeval-1.2.2-py3-none-any.whl
Collecting tensorboard
  Using cached tensorboard-2.11.2-py3-none-any.whl (6.0 MB)
Requirement already satisfied: tokenizers in d:\program files\python\lib\site-packages (from simpletransformers) (0.13.2)
Collecting wandb>=0.10.32
  Using cached wandb-0.13.9-py2.py3-none-any.whl (2.0 MB)
Collecting streamlit
  Using cached streamlit-1.17.0-py2.py3-none-any.whl (9.3 MB)
Collecting sentencepiece
  Using cached sentencepiece-0.1.97.tar.gz (524 kB)
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'
Collecting pyarrow>=6.0.0
  Using cached pyarrow-11.0.0-cp311-cp311-win_amd64.whl (20.5 MB)
Collecting dill<0.3.7
  Using cached dill-0.3.6-py3-none-any.whl (110 kB)
Collecting xxhash
  Using cached xxhash-3.2.0-cp311-cp311-win_amd64.whl (30 kB)
Collecting multiprocess
  Using cached multiprocess-0.70.14-py310-none-any.whl (134 kB)
Collecting fsspec[http]>=2021.11.1
  Using cached fsspec-2023.1.0-py3-none-any.whl (143 kB)
Collecting aiohttp
  Using cached aiohttp-3.8.3-cp311-cp311-win_amd64.whl (317 kB)
Collecting huggingface-hub<1.0.0,>=0.2.0
  Using cached huggingface_hub-0.12.0-py3-none-any.whl (190 kB)
Requirement already satisfied: packaging in d:\program files\python\lib\site-packages (from datasets) (23.0)
Collecting responses<0.19
  Using cached responses-0.18.0-py3-none-any.whl (38 kB)
Requirement already satisfied: pyyaml>=5.1 in d:\program files\python\lib\site-packages (from datasets) (6.0)
Requirement already satisfied: colorama in d:\program files\python\lib\site-packages (from tqdm) (0.4.6)
Requirement already satisfied: python-dateutil>=2.8.1 in d:\program files\python\lib\site-packages (from pandas) (2.8.2)
Requirement already satisfied: pytz>=2020.1 in d:\program files\python\lib\site-packages (from pandas) (2022.7.1)
Requirement already satisfied: attrs>=17.3.0 in d:\program files\python\lib\site-packages (from aiohttp->datasets) (22.2.0)
Collecting charset-normalizer<3.0,>=2.0
  Using cached charset_normalizer-2.1.1-py3-none-any.whl (39 kB)
Collecting multidict<7.0,>=4.5
  Using cached multidict-6.0.4-cp311-cp311-win_amd64.whl (28 kB)
Collecting async-timeout<5.0,>=4.0.0a3
  Using cached async_timeout-4.0.2-py3-none-any.whl (5.8 kB)
Collecting yarl<2.0,>=1.0
  Using cached yarl-1.8.2-cp311-cp311-win_amd64.whl (55 kB)
Collecting frozenlist>=1.1.1
  Using cached frozenlist-1.3.3-cp311-cp311-win_amd64.whl (32 kB)
Collecting aiosignal>=1.1.2
  Using cached aiosignal-1.3.1-py3-none-any.whl (7.6 kB)
Collecting filelock
  Using cached filelock-3.9.0-py3-none-any.whl (9.7 kB)
Collecting typing-extensions>=3.7.4.3
  Using cached typing_extensions-4.4.0-py3-none-any.whl (26 kB)
Requirement already satisfied: six>=1.5 in d:\program files\python\lib\site-packages (from python-dateutil>=2.8.1->pandas) (1.16.0)
Requirement already satisfied: idna<4,>=2.5 in d:\program files\python\lib\site-packages (from requests->simpletransformers) (3.4)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in d:\program files\python\lib\site-packages (from requests->simpletransformers) (1.26.14)
Requirement already satisfied: certifi>=2017.4.17 in d:\program files\python\lib\site-packages (from requests->simpletransformers) (2022.12.7)
Collecting Click!=8.0.0,>=7.0
  Using cached click-8.1.3-py3-none-any.whl (96 kB)
Collecting GitPython>=1.0.0
  Using cached GitPython-3.1.30-py3-none-any.whl (184 kB)
Requirement already satisfied: psutil>=5.0.0 in d:\program files\python\lib\site-packages (from wandb>=0.10.32->simpletransformers) (5.9.4)
Collecting sentry-sdk>=1.0.0
  Using cached sentry_sdk-1.14.0-py2.py3-none-any.whl (178 kB)
Collecting docker-pycreds>=0.4.0
  Using cached docker_pycreds-0.4.0-py2.py3-none-any.whl (9.0 kB)
Collecting pathtools
  Using cached pathtools-0.1.2-py3-none-any.whl
Collecting setproctitle
  Using cached setproctitle-1.3.2-cp311-cp311-win_amd64.whl (11 kB)
Requirement already satisfied: setuptools in d:\program files\python\lib\site-packages (from wandb>=0.10.32->simpletransformers) (65.5.0)
Collecting appdirs>=1.4.3
  Using cached appdirs-1.4.4-py2.py3-none-any.whl (9.6 kB)
Collecting protobuf!=4.21.0,<5,>=3.19.0
  Using cached protobuf-4.21.12-cp310-abi3-win_amd64.whl (527 kB)
Collecting joblib>=1.1.1
  Using cached joblib-1.2.0-py3-none-any.whl (297 kB)
Collecting threadpoolctl>=2.0.0
  Using cached threadpoolctl-3.1.0-py3-none-any.whl (14 kB)
Collecting altair>=3.2.0
  Using cached altair-4.2.2-py3-none-any.whl (813 kB)
Collecting blinker>=1.0.0
  Using cached blinker-1.5-py2.py3-none-any.whl (12 kB)
Collecting cachetools>=4.0
  Using cached cachetools-5.3.0-py3-none-any.whl (9.3 kB)
Collecting importlib-metadata>=1.4
  Using cached importlib_metadata-6.0.0-py3-none-any.whl (21 kB)
Collecting pillow>=6.2.0
  Using cached Pillow-9.4.0-cp311-cp311-win_amd64.whl (2.5 MB)
Collecting protobuf!=4.21.0,<5,>=3.19.0
  Using cached protobuf-3.20.3-py2.py3-none-any.whl (162 kB)
Collecting pympler>=0.9
  Using cached Pympler-1.0.1-py3-none-any.whl (164 kB)
Collecting rich>=10.11.0
  Using cached rich-13.3.1-py3-none-any.whl (239 kB)
Collecting semver
  Using cached semver-2.13.0-py2.py3-none-any.whl (12 kB)
Collecting toml
  Using cached toml-0.10.2-py2.py3-none-any.whl (16 kB)
Collecting tzlocal>=1.1
  Using cached tzlocal-4.2-py3-none-any.whl (19 kB)
Collecting validators>=0.2
  Using cached validators-0.20.0-py3-none-any.whl
Collecting pydeck>=0.1.dev5
  Using cached pydeck-0.8.0-py2.py3-none-any.whl (4.7 MB)
Requirement already satisfied: tornado>=5.0 in d:\program files\python\lib\site-packages (from streamlit->simpletransformers) (6.2)
Collecting watchdog
  Using cached watchdog-2.2.1-py3-none-win_amd64.whl (78 kB)
Collecting absl-py>=0.4
  Using cached absl_py-1.4.0-py3-none-any.whl (126 kB)
Collecting grpcio>=1.24.3
  Using cached grpcio-1.51.1-cp311-cp311-win_amd64.whl (3.7 MB)
Collecting google-auth<3,>=1.6.3
  Using cached google_auth-2.16.0-py2.py3-none-any.whl (177 kB)
Collecting google-auth-oauthlib<0.5,>=0.4.1
  Using cached google_auth_oauthlib-0.4.6-py2.py3-none-any.whl (18 kB)
Collecting markdown>=2.6.8
  Using cached Markdown-3.4.1-py3-none-any.whl (93 kB)
Collecting tensorboard-data-server<0.7.0,>=0.6.0
  Using cached tensorboard_data_server-0.6.1-py3-none-any.whl (2.4 kB)
Requirement already satisfied: tensorboard-plugin-wit>=1.6.0 in d:\program files\python\lib\site-packages (from tensorboard->simpletransformers) (1.8.1)
Collecting werkzeug>=1.0.1
  Using cached Werkzeug-2.2.2-py3-none-any.whl (232 kB)
Collecting wheel>=0.26
  Using cached wheel-0.38.4-py3-none-any.whl (36 kB)
Collecting entrypoints
  Using cached entrypoints-0.4-py3-none-any.whl (5.3 kB)
Requirement already satisfied: jinja2 in d:\program files\python\lib\site-packages (from altair>=3.2.0->streamlit->simpletransformers) (3.1.2)
Requirement already satisfied: jsonschema>=3.0 in d:\program files\python\lib\site-packages (from altair>=3.2.0->streamlit->simpletransformers) (4.17.3)
Collecting toolz
  Using cached toolz-0.12.0-py3-none-any.whl (55 kB)
Collecting gitdb<5,>=4.0.1
  Using cached gitdb-4.0.10-py3-none-any.whl (62 kB)
Collecting pyasn1-modules>=0.2.1
  Using cached pyasn1_modules-0.2.8-py2.py3-none-any.whl (155 kB)
Collecting rsa<5,>=3.1.4
  Using cached rsa-4.9-py3-none-any.whl (34 kB)
Collecting requests-oauthlib>=0.7.0
  Using cached requests_oauthlib-1.3.1-py2.py3-none-any.whl (23 kB)
Collecting zipp>=0.5
  Using cached zipp-3.12.0-py3-none-any.whl (6.6 kB)
Collecting markdown-it-py<3.0.0,>=2.1.0
  Using cached markdown_it_py-2.1.0-py3-none-any.whl (84 kB)
Requirement already satisfied: pygments<3.0.0,>=2.14.0 in d:\program files\python\lib\site-packages (from rich>=10.11.0->streamlit->simpletransformers) (2.14.0)
Collecting pytz-deprecation-shim
  Using cached pytz_deprecation_shim-0.1.0.post0-py2.py3-none-any.whl (15 kB)
Collecting tzdata
  Using cached tzdata-2022.7-py2.py3-none-any.whl (340 kB)
Requirement already satisfied: decorator>=3.4.0 in d:\program files\python\lib\site-packages (from validators>=0.2->streamlit->simpletransformers) (5.1.1)
Requirement already satisfied: MarkupSafe>=2.1.1 in d:\program files\python\lib\site-packages (from werkzeug>=1.0.1->tensorboard->simpletransformers) (2.1.2)
Collecting smmap<6,>=3.0.1
  Using cached smmap-5.0.0-py3-none-any.whl (24 kB)
Requirement already satisfied: pyrsistent!=0.17.0,!=0.17.1,!=0.17.2,>=0.14.0 in d:\program files\python\lib\site-packages (from jsonschema>=3.0->altair>=3.2.0->streamlit->simpletransformers) (0.19.3)
Collecting mdurl~=0.1
  Using cached mdurl-0.1.2-py3-none-any.whl (10.0 kB)
Collecting pyasn1<0.5.0,>=0.4.6
  Using cached pyasn1-0.4.8-py2.py3-none-any.whl (77 kB)
Collecting oauthlib>=3.0.0
  Using cached oauthlib-3.2.2-py3-none-any.whl (151 kB)
Installing collected packages: sentencepiece, pyasn1, pathtools, appdirs, zipp, xxhash, wheel, werkzeug, watchdog, validators, tzdata, typing-extensions, tqdm, toolz, toml, threadpoolctl, tensorboard-data-server, smmap, setproctitle, sentry-sdk, semver, rsa, regex, pympler, pyasn1-modules, protobuf, pillow, oauthlib, numpy, multidict, mdurl, markdown, joblib, grpcio, fsspec, frozenlist, filelock, entrypoints, docker-pycreds, dill, Click, charset-normalizer, cachetools, blinker, async-timeout, absl-py, yarl, scipy, pytz-deprecation-shim, pydeck, pyarrow, pandas, multiprocess, markdown-it-py, importlib-metadata, google-auth, gitdb, aiosignal, tzlocal, scikit-learn, rich, responses, requests-oauthlib, huggingface-hub, GitPython, altair, aiohttp, wandb, transformers, streamlit, seqeval, google-auth-oauthlib, tensorboard, datasets, simpletransformers
  Running setup.py install for sentencepiece: started
  Running setup.py install for sentencepiece: finished with status 'error'
Note: you may need to restart the kernel to use updated packages.
  DEPRECATION: sentencepiece is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
  error: subprocess-exited-with-error
  
  Running setup.py install for sentencepiece did not run successfully.
  exit code: 1
  
  [15 lines of output]
  running install
  D:\Program Files\Python\Lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
    warnings.warn(
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-cpython-311
  creating build\lib.win-amd64-cpython-311\sentencepiece
  copying src\sentencepiece/__init__.py -> build\lib.win-amd64-cpython-311\sentencepiece
  copying src\sentencepiece/_version.py -> build\lib.win-amd64-cpython-311\sentencepiece
  copying src\sentencepiece/sentencepiece_model_pb2.py -> build\lib.win-amd64-cpython-311\sentencepiece
  copying src\sentencepiece/sentencepiece_pb2.py -> build\lib.win-amd64-cpython-311\sentencepiece
  running build_ext
  building 'sentencepiece._sentencepiece' extension
  error: Microsoft Visual C   14.0 or greater is required. Get it with "Microsoft C   Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
  [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

Encountered error while trying to install package.

sentencepiece

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

screenshot I'm new to Python, please help. System Windows 10, with MS VC installed & updated.

CodePudding user response:

Welcome to Python! The error message says what the problem is:

 error: Microsoft Visual C   14.0 or greater is required. Get it with "Microsoft C   Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
  [end of output]

Try to pip install every package separately so you have a better picture of which of those requires VC 14. And don't forget to update your VC of course!

CodePudding user response:

For error message of this type, though the error points to VC , on the contrary, to resolve

  1. Update pip: pip install --upgrade pip
  2. Install version of sentencepiece compatible with your Python version.
    For Python 3.10, see Pip install results in this error " cl.exe' failed with exit code 2"

Others worth giving a try:

  1. Give pipwin a try.
    PS: pipwin is essentially a complementary tool for pip on Windows. Beware: pipwin installs unofficial python package binaries for windows

  2. You may consider having MS Build: Visual C build tools, and check the options "C /CLI support". (NB: might require hefty GB install!)
    For MS Build, you might need to also install or upgrade pip install setuptools --upgrade

  • Related