HuggingFace Transformers not getting installed in VS Code - python

I'm new in VS code and in coding in general, I've been trying to install transformers with the command pip install transformers and pip install transformers[tf-cpu] both didn't work, with the following error:
Building wheel for tokenizers (pyproject.toml) ... error
ERROR: Command errored out with exit status 1:
command: 'C:\Users\TevaJ\Desktop\Projects\venv\Scripts\python.exe' 'C:\Users\TevaJ\Desktop\Projects\venv\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py' build_wheel 'C:\Users\TevaJ\AppData\Local\Temp\tmps54vamjd'
cwd: C:\Users\TevaJ\AppData\Local\Temp\pip-install-kolpujzg\tokenizers_befed87ed1a749f8a23369cfa56db8a2
Complete output (19 lines):
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-3.10
creating build\lib.win-amd64-3.10\tokenizers
copying tokenizers\__init__.py -> build\lib.win-amd64-3.10\tokenizers
running build_ext
error: can't find Rust compiler
If you are using an outdated pip version, it is possible a prebuilt wheel is available for this package but pip is not able to install from it. Installing from the wheel would avoid the need for a Rust compiler.
To update pip, run:
pip install --upgrade pip
and then retry package installation.
If you did intend to build this package from source, try installing a Rust compiler from your system package manager and ensure it is on the PATH during installation. Alternatively, rustup (available at https://rustup.rs) is the recommended way to download and update the Rust compiler toolchain.
----------------------------------------
ERROR: Failed building wheel for tokenizers
Failed to build tokenizers
ERROR: Could not build wheels for tokenizers, which is required to install pyproject.toml-based projects
(venv) PS C:\Users\TevaJ\Desktop\Projects>
I looked up on google but I can't find a solution.
Does anyone know this error and how to fix it?

Solved.
Just had to install it from source without dependencies with PIP 619.
git clone https://github.com/huggingface/transformers.git
cd transformers
pip install -e .

Another possible solution - is install Rust compiler, make a restart and try pip install again.

I try the following command.It works
conda install -c huggingface transformers

Related

Getting error when i use pip install baselines

conf:mac catalina,MacBook Pro (13-inch, 2019, Two Thunderbolt 3 ports),pycharm.
the error:
ERROR: Failed building wheel for mpi4py
Building wheel for zmq (setup.py) ... done
Created wheel for zmq: filename=zmq-0.0.0-py3-none-any.whl size=1264 sha256=be7f6ab763266c2291f5ca7998e3ad24e48a4e85c04a2aa09a7fd5531823ae5b
Stored in directory: /Users/mac/Library/Caches/pip/wheels/4d/41/3a/bfd4dafaf1c20a4d08ff78bfcab77fcc4cf98e97c7941ce77a
Successfully built baselines zmq
Failed to build mpi4py
ERROR: Could not build wheels for mpi4py, which is required to install pyproject.toml-based projects
Try updating pip before installation :
pip3 install --upgrade pip
Create new virtualenv clear the pip cache like below and try to install it again.
pip cache purge
I checked the documentation, it also says you need to install MPI implementation

Problem Installing azure-pipeline due to ruamel.yaml

I am trying to install azure-pipeline using:
pip install azureml-pipeline
When I do this it installs most dependencies fine until I receive the following error messages:
Building wheel for ruamel.yaml (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
ERROR: Failed building wheel for ruamel.yaml
Running setup.py install for ruamel.yaml did not run successfully.
Note that when I install ruamel.yaml with pip it says all requirements are satisfied and when I try to reinstall the wheel tool all requirements are satisfied:
pip install ruamel.yaml
pip install -U pip setuptools wheel
Has anyone encountered this problem or know something I need to install maybe to get this to work? Note: Azureml is installed on my machine fine.
Edit:
Python Version = 3.9.7
OS = macOS Monterey v12.3.1
Here is a link to the error message in full: https://github.com/bencouser/errormessages/blob/main/error.txt
I am not sure why your environment tries to create a wheel. The documented way to install ruamel.yaml is to do:
pip install ruamel.yaml
that will get you the wheel if it is available.
You should try to run the command above before running pip install azureml-pipeline and see if that solves the proglem. If that doesn't work, provide more information ((link to) full error trace, python version, host platform/architecture).

Python ERROR - could not build wheels for installing QuTiP

(You can look through discussion here for additional context)
I'm trying to run a script that uses Openfermion, PySCF, Openfermionpyscf, and QuTiP packages for Python. I'm running Linux (Ubuntu) 64bit on a virtual machine (off of Win7, 64bit).
Following discussion in the links above I have managed to succesfully install Openfermion and PySCF, but get the following error upon using pip -U install qutip
Building wheels for collected packages: qutip
Building wheel for qutip (PEP 517) ... error
ERROR: Command errored out with exit status 1:
...
ERROR: Failed building wheel for qutip
Failed to build qutip
ERROR: Could not build wheels for qutip which use PEP 517 and cannot be installed directly
The "..." in the above is for the sake of brevity, as the actual error message encompasses some 299 lines.
I tried this installation in an environment with python=3.7, and with nothing else installed, but I run into errors either way.
To recreate my issue; try
$ conda create -n test python=3.7 -y
$ conda activate test
$ pip install -U openfermion openfermionpyscf pyscf qutip
Other things I have tried
Installing via. conda, which led to various errors (being unable to use modules Openfermion.chem or Openfermion.Hamiltonians as described in the original problem.
Removing the entirety of my qutip, openfermion, pyscf installations, making a new environment and reinstalling everything - tried with both conda and pip in a new environment each time.
EDIT: While I have no resolved the pip install QuTiP errors (regarding wheels), even after verying that my conda -V is 4.9.2 as desired, and after attempting an upgrade pip install --upgrade pip setuptools wheel (already up to date) I have found a work-around by install via. Conda.
As long as I install QuTiP with conda, I get no issues. And, as it turns out, the errors I previously had with conda installations were due to an outdated segment of code in the scripts I was trying to run.
While the issue is not resolved (I still cannot install via. pip), it's not imperative any longer.

How to Install freqrade in Anaconda?

I have been trying many methods to install freqtrade in anaconda but I am always getting an error. The most simple code that I thought would work is:
pip install freqtrade
It only gives me the following error:
Building wheel for TA-Lib (setup.py): started
Building wheel for TA-Lib (setup.py): finished with status 'error'
Successfully built sdnotify yarl
Failed to build py-find-1st blosc TA-Lib
How can I install freqtrade directly from my Jupyter Notebook?
I have looked at the installation instructions on: https://www.freqtrade.io/en/2020.7/installation/#windows - Also with no success.
Thank you!
TA-Lib is a library written in C. It must be built on PC to prepare a binary .dll or.so files. The TA-Lib that freqtrade is trying to install is just a Python wrapper for this library. That's why it fail to build if original C library can't be found on PC. You better first build and install ta-lib from C sources, then pip install ta-lib to make sure it works. And then pip install freqtrade
I was able to install TA-Lib and freqtrade on Jupyter Notebook with following:
!wget http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz
!tar -xzf ta-lib-0.4.0-src.tar.gz
%cd ta-lib/
!./configure --prefix=$HOME
!make
!make install
!TA_LIBRARY_PATH=~/lib TA_INCLUDE_PATH=~/include pip install ta-lib
!pip install freqtrade

Getting "Command errored out with exit status 1: python setup.py egg_info" while installing requirements in Google Colab

I am getting an error in a Colab notebook while installing from a requirements.txt file for a speech emotion recognition library.
First of all, I am cloning the Github project for speech emotion recognition:
git clone https://github.com/marcogdepinto/Django-Emotion-Classification-Ravdess-API.git
Then installing the requirements using the following code
%pip install utils
%cd /content/Django-Emotion-Classification-Ravdess-API
%pip install -r requirements.txt
Then the following error is displayed:
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
I have searched everywhere but couldn't find any solution.
You have no choice here, you need to see the logs or a more verbose pip install output.
Try the verbose pip option:
!pip install -vvv -r requirements.txt
At the end of that loooong error message, you'll see the actual problem:
Error: pg_config executable not found.
pg_config is required to build psycopg2 from source. Please add the directory
containing pg_config to the $PATH or specify the full executable path with the
option:
python setup.py build_ext --pg-config /path/to/pg_config build ...
or with the pg_config option in 'setup.cfg'.
If you prefer to avoid building psycopg2 from source, please install the PyPI
'psycopg2-binary' package instead.
For further information please check the 'doc/src/install.rst' file (also at
<http://initd.org/psycopg/docs/install.html>).
You need to install pg_config.
This related post (pg_config executable not found) gives options how to do that based on the platform. Since Google Colab runs on a Linux/Ubuntu-based OS:
!apt install libpq-dev
Note the ! instead of %.
Test it:
!pg_config --version
PostgreSQL 10.10 (Ubuntu 10.10-0ubuntu0.18.04.1)
Then repeat the installation:
%pip install -r requirements.txt
Google Colab will require you to restart the runtime after the installation completes. Do so. Then you may do the installation again just to confirm that "Requirement already satisfied:".
Do take note that while the installation succeeds, there are some warnings that that Django-Emotion-Classification-Ravdess-API may require packages (in requirements.txt) that are not compatible with Colab's pre-install libraries.

Categories