onnxruntime: ModuleNotFoundError: No module named 'packaging' ERROR

Describe the issue

Hi everyone, I’m trying to clone onnxruntime repo and install (in order to later use the run_benchmark.sh script), but facing a really weird issue when I try to install. It errors on a missing package which I do have installed.

I already tried the solutions described here without a success.

Error and Output:

Processing /store/code/gpt2/quant/onnxruntime
  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
  ╰─> [17 lines of output]
      Traceback (most recent call last):
        File "/venv/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 351, in <module>
          main()
        File "/venv/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 333, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/venv/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
        File "/tmp/pip-build-env-31p956_z/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 338, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
        File "/tmp/pip-build-env-31p956_z/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 320, in _get_build_requires
          self.run_setup()
        File "/tmp/pip-build-env-31p956_z/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 484, in run_setup
          super(_BuildMetaLegacyBackend,
        File "/tmp/pip-build-env-31p956_z/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 335, in run_setup
          exec(code, locals())
        File "<string>", line 17, in <module>
      ModuleNotFoundError: No module named 'packaging'
      [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.

Please read To reproduce section to see what I did to have that error.

Expected behavior:

installation complete successfully.

I also attach my installed packages list:

installed_packages.txt

Would really appreciate any help on the topic!

To reproduce

I’m cloning the repo:

git clone https://github.com/microsoft/onnxruntime.git

I try to install:

pip install .

Then errors

And that’s it, here I get the error you can see above in my description…

Urgency

No response

Platform

Linux

OS Version

20.04.4 LTS (Focal Fossa)

ONNX Runtime Installation

Other / Unknown

ONNX Runtime Version or Commit ID

onnxruntime Tag=1.13.1 , Commit ID=#13448

ONNX Runtime API

Python

Architecture

X86

Execution Provider

Other / Unknown

Execution Provider Library Version

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 19 (3 by maintainers)

Most upvoted comments

use: pip install -v --no-build-isolation -- no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext"

I have the same issue when running pip install -v --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" --global-option="--deprecated_fused_adam" --global-option="--xentropy" --global-option="--fast_multihead_attn" ./

from fairseq https://github.com/facebookresearch/fairseq#requirements-and-installation

error:

  Running command Getting requirements to build wheel
  Traceback (most recent call last):
    File "C:\Users\301212298\source\repos\unilm\venv\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 363, in <module>
      main()
    File "C:\Users\301212298\source\repos\unilm\venv\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 345, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "C:\Users\301212298\source\repos\unilm\venv\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 130, in get_requires_for_build_wheel
      return hook(config_settings)
    File "C:\Users\301212~1\AppData\Local\Temp\pip-build-env-rckcnzxb\overlay\Lib\site-packages\setuptools\build_meta.py", line 341, in get_requires_for_build_wheel
      return self._get_build_requires(config_settings, requirements=['wheel'])
    File "C:\Users\301212~1\AppData\Local\Temp\pip-build-env-rckcnzxb\overlay\Lib\site-packages\setuptools\build_meta.py", line 323, in _get_build_requires
      self.run_setup()
    File "C:\Users\301212~1\AppData\Local\Temp\pip-build-env-rckcnzxb\overlay\Lib\site-packages\setuptools\build_meta.py", line 338, in run_setup
      exec(code, locals())
    File "<string>", line 5, in <module>
  ModuleNotFoundError: No module named 'packaging'
  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.
  full command: 'C:\Users\301212298\source\repos\unilm\venv\Scripts\python.exe' 'C:\Users\301212298\source\repos\unilm\venv\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py' get_requires_for_build_wheel 'C:\Users\301212~1\AppData\Local\Temp\tmpxjtt5ljt'
  cwd: C:\Users\301212298\source\repos\unilm\trocr\apex
  Getting requirements to build wheel ... error
error: subprocess-exited-with-error

@belm0 putting packaging into pyproject.toml didn’t help. I also tried installing the package with conda and apt-get. Neither worked. I wonder how one can handle this.

I think this is a regression of onnxruntime 1.13

The setup.py now depends on 3rd party package packaging, without declaring the dependency. I believe it should be specified in pyproject.toml:

[build-system]
requires = ["packaging"]