Getting requirements to build wheel did not run successfully exit code: 1, tensorflow2 windows 11

Trying to install Tensorflow 2, but when i write “python -m pip install .” in anaconda prompt I get an error. I tried different methods to resolve this problem, but nothing… Such of these methods: trying to install on python 3.11 and 3.12, updating and downgrading pip, updating setuptools, setting Cython constrain file and downgrading cython versions… So, i hope, someone know how to resolve this trouble. Very appreciate your answers.
Code of error:

Processing c:\games\tenserflow\models\research
  Preparing metadata (setup.py) ... done
Collecting avro-python3 (from object-detection==0.1)
  Using cached avro-python3-1.10.2.tar.gz (38 kB)
  Preparing metadata (setup.py) ... done
Collecting apache-beam (from object-detection==0.1)
  Using cached apache_beam-2.53.0-cp311-cp311-win_amd64.whl.metadata (6.7 kB)
Collecting pillow (from object-detection==0.1)
  Using cached pillow-10.2.0-cp311-cp311-win_amd64.whl.metadata (9.9 kB)
Collecting lxml (from object-detection==0.1)
  Using cached lxml-5.1.0-cp311-cp311-win_amd64.whl.metadata (3.6 kB)
Collecting matplotlib (from object-detection==0.1)
  Using cached matplotlib-3.8.2-cp311-cp311-win_amd64.whl.metadata (5.9 kB)
Requirement already satisfied: Cython in c:\users\ihor_\anaconda3\envs\tf2\lib\site-packages (from object-detection==0.1) (3.0.8)
Collecting contextlib2 (from object-detection==0.1)
  Using cached contextlib2-21.6.0-py2.py3-none-any.whl (13 kB)
Collecting tf-slim (from object-detection==0.1)
  Using cached tf_slim-1.1.0-py2.py3-none-any.whl (352 kB)
Collecting six (from object-detection==0.1)
  Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Requirement already satisfied: pycocotools in c:\users\ihor_\anaconda3\envs\tf2\lib\site-packages (from object-detection==0.1) (2.0)
Collecting lvis (from object-detection==0.1)
  Using cached lvis-0.5.3-py3-none-any.whl (14 kB)
Collecting scipy (from object-detection==0.1)
  Using cached scipy-1.11.4-cp311-cp311-win_amd64.whl.metadata (60 kB)
Collecting pandas (from object-detection==0.1)
  Using cached pandas-2.1.4-cp311-cp311-win_amd64.whl.metadata (18 kB)
Collecting tf-models-official>=2.5.1 (from object-detection==0.1)
  Using cached tf_models_official-2.15.0-py2.py3-none-any.whl.metadata (1.4 kB)
Collecting tensorflow_io (from object-detection==0.1)
  Using cached tensorflow_io-0.31.0-cp311-cp311-win_amd64.whl (22.9 MB)
Collecting keras (from object-detection==0.1)
  Using cached keras-3.0.2-py3-none-any.whl.metadata (4.8 kB)
Collecting pyparsing==2.4.7 (from object-detection==0.1)
  Using cached pyparsing-2.4.7-py2.py3-none-any.whl (67 kB)
Collecting sacrebleu<=2.2.0 (from object-detection==0.1)
  Using cached sacrebleu-2.2.0-py3-none-any.whl (116 kB)
Collecting portalocker (from sacrebleu<=2.2.0->object-detection==0.1)
  Using cached portalocker-2.8.2-py3-none-any.whl.metadata (8.5 kB)
Collecting regex (from sacrebleu<=2.2.0->object-detection==0.1)
  Using cached regex-2023.12.25-cp311-cp311-win_amd64.whl.metadata (41 kB)
Collecting tabulate>=0.8.9 (from sacrebleu<=2.2.0->object-detection==0.1)
  Using cached tabulate-0.9.0-py3-none-any.whl (35 kB)
Requirement already satisfied: numpy>=1.17 in c:\users\ihor_\anaconda3\envs\tf2\lib\site-packages (from sacrebleu<=2.2.0->object-detection==0.1) (1.26.3)
Requirement already satisfied: colorama in c:\users\ihor_\anaconda3\envs\tf2\lib\site-packages (from sacrebleu<=2.2.0->object-detection==0.1) (0.4.6)
Collecting gin-config (from tf-models-official>=2.5.1->object-detection==0.1)
  Using cached gin_config-0.5.0-py3-none-any.whl (61 kB)
Collecting google-api-python-client>=1.6.7 (from tf-models-official>=2.5.1->object-detection==0.1)
  Using cached google_api_python_client-2.113.0-py2.py3-none-any.whl.metadata (6.6 kB)
Collecting immutabledict (from tf-models-official>=2.5.1->object-detection==0.1)
  Using cached immutabledict-4.1.0-py3-none-any.whl.metadata (3.2 kB)
Collecting kaggle>=1.3.9 (from tf-models-official>=2.5.1->object-detection==0.1)
  Using cached kaggle-1.6.3.tar.gz (84 kB)
  Preparing metadata (setup.py) ... done
Collecting oauth2client (from tf-models-official>=2.5.1->object-detection==0.1)
  Using cached oauth2client-4.1.3-py2.py3-none-any.whl (98 kB)
Collecting opencv-python-headless (from tf-models-official>=2.5.1->object-detection==0.1)
  Using cached opencv_python_headless-4.9.0.80-cp37-abi3-win_amd64.whl.metadata (20 kB)
Collecting psutil>=5.4.3 (from tf-models-official>=2.5.1->object-detection==0.1)
  Using cached psutil-5.9.7-cp37-abi3-win_amd64.whl.metadata (22 kB)
Collecting py-cpuinfo>=3.3.0 (from tf-models-official>=2.5.1->object-detection==0.1)
  Using cached py_cpuinfo-9.0.0-py3-none-any.whl (22 kB)
Collecting pyyaml>=6.0.0 (from tf-models-official>=2.5.1->object-detection==0.1)
  Using cached PyYAML-6.0.1-cp311-cp311-win_amd64.whl.metadata (2.1 kB)
Collecting sentencepiece (from tf-models-official>=2.5.1->object-detection==0.1)
  Using cached sentencepiece-0.1.99-cp311-cp311-win_amd64.whl (977 kB)
Collecting seqeval (from tf-models-official>=2.5.1->object-detection==0.1)
  Using cached seqeval-1.2.2.tar.gz (43 kB)
  Preparing metadata (setup.py) ... done
Collecting tensorflow-datasets (from tf-models-official>=2.5.1->object-detection==0.1)
  Using cached tensorflow_datasets-4.9.4-py3-none-any.whl.metadata (9.2 kB)
Collecting tensorflow-hub>=0.6.0 (from tf-models-official>=2.5.1->object-detection==0.1)
  Using cached tensorflow_hub-0.15.0-py2.py3-none-any.whl.metadata (1.3 kB)
Collecting tensorflow-model-optimization>=0.4.1 (from tf-models-official>=2.5.1->object-detection==0.1)
  Using cached tensorflow_model_optimization-0.7.5-py2.py3-none-any.whl.metadata (914 bytes)
INFO: pip is looking at multiple versions of tf-models-official to determine which version is compatible with other requirements. This could take a while.
Collecting tf-models-official>=2.5.1 (from object-detection==0.1)
  Using cached tf_models_official-2.14.2-py2.py3-none-any.whl.metadata (1.4 kB)
  Using cached tf_models_official-2.14.1-py2.py3-none-any.whl.metadata (1.4 kB)
  Using cached tf_models_official-2.14.0-py2.py3-none-any.whl.metadata (1.4 kB)
  Using cached tf_models_official-2.13.2-py2.py3-none-any.whl.metadata (1.4 kB)
  Using cached tf_models_official-2.13.1-py2.py3-none-any.whl.metadata (1.4 kB)
Collecting pyyaml<5.4.0,>=5.1 (from tf-models-official>=2.5.1->object-detection==0.1)
  Using cached PyYAML-5.3.1.tar.gz (269 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [51 lines of output]
      C:\Users\ihor_\anaconda3\envs\tf2\Lib\site-packages\setuptools\config\setupcfg.py:293: _DeprecatedConfig: Deprecated config in `setup.cfg`
      !!

              ********************************************************************************
              The license_file parameter is deprecated, use license_files instead.

              This deprecation is overdue, please update your project and remove deprecated
              calls to avoid build errors in the future.

              See https://setuptools.pypa.io/en/latest/userguide/declarative_config.html for details.
              ********************************************************************************

      !!
        parsed = self.parsers.get(option_name, lambda x: x)(value)
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "C:\Users\ihor_\AppData\Local\Temp\pip-install-hjp9n2rr\pyyaml_81e9f1c73d0243d993d666633bec91be\setup.py", line 291, in <module>
          setup(
        File "C:\Users\ihor_\anaconda3\envs\tf2\Lib\site-packages\setuptools\_distutils\core.py", line 185, in setup
          return run_commands(dist)
                 ^^^^^^^^^^^^^^^^^^
        File "C:\Users\ihor_\anaconda3\envs\tf2\Lib\site-packages\setuptools\_distutils\core.py", line 201, in run_commands
          dist.run_commands()
        File "C:\Users\ihor_\anaconda3\envs\tf2\Lib\site-packages\setuptools\_distutils\dist.py", line 969, in run_commands
          self.run_command(cmd)
        File "C:\Users\ihor_\anaconda3\envs\tf2\Lib\site-packages\setuptools\dist.py", line 989, in run_command
          super().run_command(command)
        File "C:\Users\ihor_\anaconda3\envs\tf2\Lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
          cmd_obj.run()
        File "C:\Users\ihor_\anaconda3\envs\tf2\Lib\site-packages\setuptools\command\egg_info.py", line 318, in run
          self.find_sources()
        File "C:\Users\ihor_\anaconda3\envs\tf2\Lib\site-packages\setuptools\command\egg_info.py", line 326, in find_sources
          mm.run()
        File "C:\Users\ihor_\anaconda3\envs\tf2\Lib\site-packages\setuptools\command\egg_info.py", line 548, in run
          self.add_defaults()
        File "C:\Users\ihor_\anaconda3\envs\tf2\Lib\site-packages\setuptools\command\egg_info.py", line 586, in add_defaults
          sdist.add_defaults(self)
        File "C:\Users\ihor_\anaconda3\envs\tf2\Lib\site-packages\setuptools\command\sdist.py", line 113, in add_defaults
          super().add_defaults()
        File "C:\Users\ihor_\anaconda3\envs\tf2\Lib\site-packages\setuptools\_distutils\command\sdist.py", line 251, in add_defaults
          self._add_defaults_ext()
        File "C:\Users\ihor_\anaconda3\envs\tf2\Lib\site-packages\setuptools\_distutils\command\sdist.py", line 336, in _add_defaults_ext
          self.filelist.extend(build_ext.get_source_files())
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\ihor_\AppData\Local\Temp\pip-install-hjp9n2rr\pyyaml_81e9f1c73d0243d993d666633bec91be\setup.py", line 199, in get_source_files
          self.cython_sources(ext.sources, ext)
          ^^^^^^^^^^^^^^^^^^^
        File "C:\Users\ihor_\anaconda3\envs\tf2\Lib\site-packages\setuptools\_distutils\cmd.py", line 107, in __getattr__
          raise AttributeError(attr)
      AttributeError: cython_sources
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

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

Hi Vlad what if you treid using a venv and the problem seems to be brought up by PyYAML version

You’ve only shown one result. Are you sure that it turns out exactly the same way, no matter what you try from those options?

Because if it makes some difference, then those differences could give useful clues. (Although I really expect that only the Python version is relevant.)

Hello guys, thx for your answers, I worked in environment, so env was not a problem. I tried to use requirements txt file and install all packages in that file, this thing helped me. I copy info from file here:

tf-models-official==2.3.0
# tensorflow-hub is to load Hub model. Specific version is required by TFJS.
tensorflow-hub>=0.7.0,<0.13; python_version >= "3"
numpy>=1.17.3,<1.23.4
pillow>=7.0.0
sentencepiece>=0.1.91
tensorflow-datasets>=2.1.0
fire>=0.3.1
flatbuffers>=2.0
absl-py>=0.10.0
urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1
tflite-support>=0.4.2
tensorflow>=2.6.0
# b/196287362: This Numba + Librosa combination works for numpy 1.19, introduced
# by TensorFlow 2.6.0.
numba>=0.53
librosa==0.8.1
lxml>=4.6.1
PyYAML>=5.1
# The following are the requirements of efficientdet.
matplotlib>=3.0.3,<3.5.0
six>=1.12.0
tensorflow-addons>=0.11.2
neural-structured-learning>=1.3.1
tensorflow-model-optimization>=0.5
Cython>=0.29.13
scann==1.2.6

And now I have file with all working for me packages:

anyio==4.2.0
apache-beam==2.53.0
argon2-cffi==23.1.0
argon2-cffi-bindings==21.2.0
arrow==1.3.0
asttokens==2.4.1
astunparse==1.6.3
async-lru==2.0.4
attrs==23.2.0
avro-python3==1.10.2
Babel==2.14.0
beautifulsoup4==4.12.2
bleach==6.1.0
build==1.0.3
cachetools==5.3.2
certifi==2023.11.17
cffi==1.16.0
charset-normalizer==3.3.2
click==8.1.7
cloudpickle==2.2.1
colorama==0.4.6
comm==0.2.1
contextlib2==21.6.0
contourpy==1.2.0
crcmod==1.7
cycler==0.12.1
Cython==0.29.37
debugpy==1.8.0
decorator==5.1.1
defusedxml==0.7.1
dill==0.3.1.1
dm-tree==0.1.8
dnspython==2.4.2
docopt==0.6.2
etils==1.6.0
executing==2.0.1
fastavro==1.9.3
fasteners==0.19
fastjsonschema==2.19.1
flatbuffers==23.5.26
fonttools==4.47.2
fqdn==1.5.1
fsspec==2023.12.2
gast==0.5.4
gin-config==0.5.0
google-api-core==2.15.0
google-api-python-client==2.113.0
google-auth==2.26.2
google-auth-httplib2==0.2.0
google-auth-oauthlib==1.2.0
google-pasta==0.2.0
googleapis-common-protos==1.62.0
grpcio==1.60.0
h5py==3.10.0
hdfs==2.7.3
httplib2==0.22.0
idna==3.6
importlib-resources==6.1.1
ipykernel==6.28.0
ipython==8.20.0
ipywidgets==8.1.1
isoduration==20.11.0
jedi==0.19.1
Jinja2==3.1.3
joblib==1.3.2
Js2Py==0.74
json5==0.9.14
jsonpickle==3.0.2
jsonpointer==2.4
jsonschema==4.20.0
jsonschema-specifications==2023.12.1
jupyter==1.0.0
jupyter-console==6.6.3
jupyter-events==0.9.0
jupyter-lsp==2.2.1
jupyter_client==8.6.0
jupyter_core==5.7.1
jupyter_server==2.12.4
jupyter_server_terminals==0.5.1
jupyterlab==4.0.10
jupyterlab-widgets==3.0.9
jupyterlab_pygments==0.3.0
jupyterlab_server==2.25.2
kaggle==1.6.3
keras==2.15.0
kiwisolver==1.4.5
labelImg==1.8.6
libclang==16.0.6
lvis==0.5.3
lxml==5.1.0
Markdown==3.5.2
MarkupSafe==2.1.3
matplotlib==3.8.2
matplotlib-inline==0.1.6
mistune==3.0.2
mkl-service==2.4.0
ml-dtypes==0.2.0
nbclient==0.9.0
nbconvert==7.14.1
nbformat==5.9.2
nest-asyncio==1.5.9
notebook==7.0.6
notebook_shim==0.2.3
numpy==1.24.4
oauth2client==4.1.3
oauthlib==3.2.2
objsize==0.6.1
opencv-python==4.9.0.80
opencv-python-headless==4.9.0.80
opt-einsum==3.3.0
orjson==3.9.10
overrides==7.4.0
packaging==23.2
pandas==2.1.4
pandocfilters==1.5.0
parso==0.8.3
pillow==10.2.0
pip-tools==7.3.0
platformdirs==4.1.0
portalocker==2.8.2
prometheus-client==0.19.0
promise==2.3
prompt-toolkit==3.0.43
proto-plus==1.23.0
protobuf==3.20.3
psutil==5.9.7
pure-eval==0.2.2
py-cpuinfo==9.0.0
pyarrow==11.0.0
pyarrow-hotfix==0.6
pyasn1==0.5.1
pyasn1-modules==0.3.0
pycocotools @ git+https://github.com/philferriere/cocoapi.git@2929bd2ef6b451054755dfd7ceb09278f935f7ad#subdirectory=PythonAPI
pycparser==2.21
pydot==1.4.2
Pygments==2.17.2
pyjsparser==2.7.1
pymongo==4.6.1
pyparsing==2.4.7
pyproject_hooks==1.0.0
PyQt5==5.15.10
PyQt5-Qt5==5.15.2
PyQt5-sip==12.13.0
python-dateutil==2.8.2
python-json-logger==2.0.7
python-slugify==8.0.1
pytz==2023.3.post1
pywin32==306
pywinpty==2.0.12
PyYAML==5.3.1
pyzmq==25.1.2
qtconsole==5.5.1
QtPy==2.4.1
referencing==0.32.1
regex==2023.12.25
requests==2.31.0
requests-oauthlib==1.3.1
rfc3339-validator==0.1.4
rfc3986-validator==0.1.1
rpds-py==0.17.1
rsa==4.9
sacrebleu==2.2.0
scikit-learn==1.3.2
scipy==1.11.4
Send2Trash==1.8.2
sentencepiece==0.1.99
seqeval==1.2.2
six==1.16.0
sniffio==1.3.0
soupsieve==2.5
spyder-kernels==2.5.0
stack-data==0.6.3
tabulate==0.9.0
tensorboard==2.15.1
tensorboard-data-server==0.7.2
tensorflow==2.15.0
tensorflow-addons==0.22.0
tensorflow-datasets==4.9.4
tensorflow-estimator==2.15.0
tensorflow-hub==0.15.0
tensorflow-intel==2.15.0
tensorflow-io==0.31.0
tensorflow-io-gcs-filesystem==0.31.0
tensorflow-metadata==1.14.0
tensorflow-model-optimization==0.7.5
termcolor==2.4.0
terminado==0.18.0
text-unidecode==1.3
tf-models-official==2.5.1
tf-slim==1.1.0
threadpoolctl==3.2.0
tinycss2==1.2.1
toml==0.10.2
tornado==6.4
tqdm==4.66.1
traitlets==5.14.1
typeguard==2.13.3
types-python-dateutil==2.8.19.20240106
typing_extensions==4.9.0
tzdata==2023.4
tzlocal==5.2
uri-template==1.3.0
uritemplate==4.1.1
urllib3==2.1.0
wcwidth==0.2.13
webcolors==1.13
webencodings==0.5.1
websocket-client==1.7.0
Werkzeug==3.0.1
wget==3.2
widgetsnbextension==4.0.9
wrapt==1.14.1
zipp==3.17.0
zstandard==0.22.0

u can resolve the problem installing these packages, but it also worked for me…
But after all I have another problem, while i trying to train my tensorflow model, but it is about a new topic…

That’s cool if it worked

1 Like