Issue: I got this error – “error in qiskit-terra setup command: ‘install_requires’ must be a string or list of strings containing valid project/version requirement specifiers; Expected end or semicolon (after version specifier)” while installing Qiskit Terra in an Anaconda python environment on CentOS.
Here’s the complete error message:
$ pip install qiskit-terra-0.20.2.tar.gz Processing ./qiskit-terra-0.20.2.tar.gz Installing build dependencies ... done Getting requirements to build wheel ... error error: subprocess-exited-with-error × Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> [3 lines of output] error in qiskit-terra setup command: 'install_requires' must be a string or list of strings containing valid project/version requirement specifiers; Expected end or semicolon (after version specifier) pillow>=4.2. ~~~~~^ [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. error: subprocess-exited-with-error × Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> See above for output. note: This error originates from a subprocess, and is likely not a problem with pip.
Solution: Fix install_requires must be a string or list of strings
Looking at the above error message, I understand that the setup fails while reading the version number of the package ‘pillow
‘. Generally, pip
relies on the requirements.txt
file to serve the list of packages that need to be installed and I believe that the package being installed is dependent on another package called ‘pillow
‘. Well, here’s the content of the requirements.txt
file.
$unzip qiskit-terra-0.20.2.tar.gz
$ cd qiskit-terra-0.20.2.tar.gz
$ cat qiskit-terra-0.20.2/requirements.txt
retworkx>=0.11.0
numpy>=1.17
ply>=3.10
psutil>=5
scipy>=1.5
sympy>=1.3
dill>=0.3
python-constraint>=1.4
python-dateutil>=2.8.0
stevedore>=3.0.0
symengine>=0.9 ; platform_machine == 'x86_64' or platform_machine == 'aarch64' or platform_machine == 'ppc64le' or platform_machine == 'amd64' or platform_machine == 'arm64'
tweedledum>=1.1,<2.0
jsonschema>=2.6
marshmallow>=2.17.0,<3
marshmallow_polyfield>=3.2,<4
matplotlib>=2.1
pillow>=4.2.
Well, the above output confirms that the version of the package pillow is incomplete – pillow>=4.2., which was missing the minor version no., and a quick search on the internet hinted that this might be the issue.
Hence, I modified the version from pillow>=4.2.
to pillow>=4.2.1
and it worked as well. Surprisingly, along similar lines, numerous syntax and version errors have been reported across different forums.
For example: Change of,
install_requires=[ 'numpy>=1<2', ]
to
install_requires=[ 'numpy>=1', ]
Ref: qpth fails with install_requires must be a string error.
Another example: The syntax of PyJWT
was reported to be incorrect in pyproject.toml
.
PyJWT>=1<2
to
PyJWT >= 1, < 2
Ref: error in lasso setup command failed: install_requires must be string….