Pip Installation Error with pytorch-quantization

I attempted to install pytorch-quantization using pip on both Windows and Ubuntu and received the following error:

I used this command:

pip install --no-cache-dir --extra-index-url https://pypi.nvidia.com pytorch-quantization

I also tried another command line option:

pip install pytorch-quantization --extra-index-url https://pypi.ngc.nvidia.com

In addition, I’ve referred to the following source for installation guidance but had no luck when attempting to install from the source.

On windows and Ubuntu:
I use Miniconda and created a virtual env with python 3.10
pip install pytorch-quantization --extra-index-url https://pypi.ngc.nvidia.com

Looking in indexes: Simple index, https://pypi.ngc.nvidia.com, https://pypi.ngc.nvidia.com
Collecting pytorch-quantization
Downloading pytorch-quantization-2.2.0.tar.gz (6.8 kB)
Preparing metadata (setup.py) … error
error: subprocess-exited-with-error

× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [16 lines of output]
Traceback (most recent call last):
File “”, line 2, in
File “”, line 34, in
File “C:\Users\Hamed\AppData\Local\Temp\pip-install-baj4elms\pytorch-quantization_5e9c44491e6f4b17b90915ddf1cf38be\setup.py”, line 137, in
raise RuntimeError(open(“ERROR.txt”, “r”).read())
RuntimeError:
###########################################################################################
The package you are trying to install is only a placeholder project on PyPI.org repository.
This package is hosted on NVIDIA Python Package Index.

  This package can be installed as:

$ pip install --no-cache-dir --extra-index-url https://pypi.nvidia.com pytorch-quantization

###########################################################################################

[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.

Could you please help me with that?

Hi,
Request you to share the ONNX model and the script if not shared already so that we can assist you better.
Alongside you can try few things:

  1. validating your model with the below snippet

check_model.py

import sys
import onnx
filename = yourONNXmodel
model = onnx.load(filename)
onnx.checker.check_model(model).
2) Try running your model with trtexec command.

In case you are still facing issue, request you to share the trtexec “”–verbose"" log for further debugging
Thanks!

@AakankshaS My question is something else. I cannot install pytorch-quantization. It seems the issue could be the provided link in:

pip install pytorch-quantization --extra-index-url https://pypi.ngc.nvidia.com

Hi @hamed.t.g ,
Can you please try a reinstall

  • pip install pytorch-quantization --extra-index-url https://pypi.ngc.nvidia.com
  • cd tools/pytorch-quantization && python setup.py install

Please let me know if this works for you.

Thanks

Hi @AakankshaS
I used

pip install pytorch-quantization --extra-index-url https://pypi.ngc.nvidia.com

but the same error.

(test) C:\Users\Hamed>pip install pytorch-quantization --extra-index-url https://pypi.ngc.nvidia.com
Looking in indexes: Simple index, https://pypi.ngc.nvidia.com, https://pypi.ngc.nvidia.com
Collecting pytorch-quantization
Downloading pytorch-quantization-2.2.0.tar.gz (6.8 kB)
Preparing metadata (setup.py) … error
error: subprocess-exited-with-error

× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [16 lines of output]
Traceback (most recent call last):
File “”, line 2, in
File “”, line 34, in
File “C:\Users\Hamed\AppData\Local\Temp\pip-install-wp1odgx8\pytorch-quantization_54d024d65dcd495d9e8c978476d1ab5d\setup.py”, line 137, in
raise RuntimeError(open(“ERROR.txt”, “r”).read())
RuntimeError:
###########################################################################################
The package you are trying to install is only a placeholder project on PyPI.org repository.
This package is hosted on NVIDIA Python Package Index.

  This package can be installed as:
  ```
  $ pip install --no-cache-dir --extra-index-url https://pypi.nvidia.com pytorch-quantization
  ```
  ###########################################################################################

  [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 @hamed.t.g ,
I would hence recommend you to raise it on pytorch forum.
You may get better assistance there.

Thanks

Also ran into this issue but managed to figure it out.
So basically your python is trying to install this “fake” package, which is warning you to download straight from nvidia’s repository instead.

This package can be installed as:
 
  $ pip install --no-cache-dir --extra-index-url https://pypi.nvidia.com pytorch-quantization

This command tells pip to ignore the cache, and to look for pytorch-quantization in the nvidia repository.
But when you run this command you can see this line being printed:
Looking in indexes: [Simple index](https://pypi.org/simple), https://pypi.ngc.nvidia.com, https://pypi.ngc.nvidia.com

The order of these repositories is important, so what happens is pip will look for pytorch-quantization in the first repo (pypi), and it will find a match and download and install it. But the match that it finds is again that same fake package that warned us in the first place.

So we need to use –index-url instead of –extra-index-url, this forces pip to look for pytorch-quantization only in the nvidia repository.

So this command should solve your issues:

pip install --no-cache-dir --index-url https://pypi.nvidia.com pytorch-quantization

if for some reason it tries to download from cache, you can always run a “pip cache purge”

1 Like

I have the same problem and tried your solution:

pip install --no-cache-dir --index-url https://pypi.nvidia.com pytorch-quantization

But now I get:

ERROR: Cannot install pytorch-quantization==2.1.2 and pytorch-quantization==2.1.3 because these package versions have conflicting dependencies.

The conflict is caused by:
    pytorch-quantization 2.1.3 depends on sphinx-glpi-theme
    pytorch-quantization 2.1.2 depends on sphinx-glpi-theme

To fix this you could try to:
1. loosen the range of package versions you've specified
2. remove package versions to allow pip attempt to solve the dependency conflict

ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts

How can I fix this?

Seems the issue was the forced use of nvidia pip repository while trying to find dependencies, so re-adding the default pip repo afterwards made it work for me:
pip install --no-cache-dir --index-url https://pypi.nvidia.com --index-url https://pypi.org/simple pytorch-quantization==2.1.3

10 Likes

It worked for me, too! Thank your for your tips!