'install_requires' must be a string or list of strings containing valid project/version requirement specifiers

6.7k Views Asked by At

Getting error 'install_requires' must be a string or list of strings containing valid project/version requirement specifiers when installing a package with pip. The package is an internal package but seems to error when installing one of the dependencies. Any idea how to solve this error?

My python version is 3.8.2, pip version 23.1.2, mac OS Ventura 13.1

Here is a little more info on the error

Running command Preparing metadata (pyproject.toml)
  error in lasso 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)
      PyJWT>=1<2 
2

There are 2 best solutions below

1
Irish Dev On BEST ANSWER

The syntax of PyJWT>=1<2 is not correct versioning in pyproject.toml

You can write it as follows:

PyJWT >= 1, < 2

or

PyJWT = "^1.0.0"
0
mbenhalima On

From: pip install -e . fails with "Expected end or semicolon" for git+https in requirements, but pip install -r succeeds

It looks like setuptools requires the package name to be supplied as a prefix, then the fetch URL after an @, e.g.

# requirements.txt
mypackage @ git+https://github.com/myorg/[email protected]#egg=mypackage