# Pip Installation Error with pytorch-quantization

**URL:** <https://forums.developer.nvidia.com/t/pip-installation-error-with-pytorch-quantization/269905>\
**Category:** TensorRT\
**Created:** [October 18, 2023, 10:44pm UTC](https://forums.developer.nvidia.com/t/pip-installation-error-with-pytorch-quantization/269905 "2023-10-18T22:44:54Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![hamed.t.g](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@hamed.t.g](https://forums.developer.nvidia.com/u/hamed.t.g)\
**Post date:** [October 18, 2023, 10:44pm UTC](https://forums.developer.nvidia.com/t/pip-installation-error-with-pytorch-quantization/269905/1 "2023-10-18T22:44:54Z")

</div>

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](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](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.

> <https://github.com/NVIDIA/TensorRT/tree/release/8.6/tools/pytorch-quantization>
>
> //github.com/NVIDIA/TensorRT/tree/release/8.6/tools/pytorch-quantization

**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.org/simple), [https://pypi.ngc.nvidia.com](https://pypi.ngc.nvidia.com), [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](http://PyPI.org) repository.  
This package is hosted on NVIDIA Python Package Index.

```auto
  This package can be installed as:

```

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

```auto
###########################################################################################

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

---

<div class="post-metadata">

**Author:** ![AakankshaS](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/aakankshas/32/14047_2.png) [@AakankshaS](https://forums.developer.nvidia.com/u/AakankshaS)\
**Post date:** [October 19, 2023, 10:36am UTC](https://forums.developer.nvidia.com/t/pip-installation-error-with-pytorch-quantization/269905/2 "2023-10-19T10:36:58Z")

</div>

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:

> **[Quick Start Guide — NVIDIA TensorRT](https://docs.nvidia.com/deeplearning/tensorrt/latest/getting-started/quick-start-guide.html)**

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.

> **[TensorRT/samples/trtexec at master · NVIDIA/TensorRT](https://github.com/NVIDIA/TensorRT/tree/master/samples/trtexec)**
>
> NVIDIA® TensorRT™ is an SDK for high-performance deep learning inference on NVIDIA GPUs. This repository contains the open source components of TensorRT. - NVIDIA/TensorRT

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

---

<div class="post-metadata">

**Author:** ![hamed.t.g](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@hamed.t.g](https://forums.developer.nvidia.com/u/hamed.t.g)\
**Post date:** [October 19, 2023, 2:26pm UTC](https://forums.developer.nvidia.com/t/pip-installation-error-with-pytorch-quantization/269905/3 "2023-10-19T14:26:06Z")

</div>

@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](https://pypi.ngc.nvidia.com)

---

<div class="post-metadata">

**Author:** ![AakankshaS](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/aakankshas/32/14047_2.png) [@AakankshaS](https://forums.developer.nvidia.com/u/AakankshaS)\
**Post date:** [October 31, 2023, 1:39pm UTC](https://forums.developer.nvidia.com/t/pip-installation-error-with-pytorch-quantization/269905/4 "2023-10-31T13:39:14Z")

</div>

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

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

Please let me know if this works for you.

Thanks

---

<div class="post-metadata">

**Author:** ![hamed.t.g](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@hamed.t.g](https://forums.developer.nvidia.com/u/hamed.t.g)\
**Post date:** [October 31, 2023, 9:39pm UTC](https://forums.developer.nvidia.com/t/pip-installation-error-with-pytorch-quantization/269905/5 "2023-10-31T21:39:35Z")

</div>

Hi @AakankshaS  
I used

> pip install pytorch-quantization --extra-index-url [https://pypi.ngc.nvidia.com](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](https://pypi.ngc.nvidia.com)  
Looking in indexes: [Simple index](https://pypi.org/simple), [https://pypi.ngc.nvidia.com](https://pypi.ngc.nvidia.com), [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](http://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.

---

<div class="post-metadata">

**Author:** ![AakankshaS](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/aakankshas/32/14047_2.png) [@AakankshaS](https://forums.developer.nvidia.com/u/AakankshaS)\
**Post date:** [November 27, 2023, 2:40pm UTC](https://forums.developer.nvidia.com/t/pip-installation-error-with-pytorch-quantization/269905/6 "2023-11-27T14:40:37Z")

</div>

Hi @hamed.t.g ,  
I would hence recommend you to raise it on pytorch forum.  
You may get better assistance there.

Thanks

---

<div class="post-metadata">

**Author:** ![sergehendrickx](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/sergehendrickx/32/299218_2.png) [@sergehendrickx](https://forums.developer.nvidia.com/u/sergehendrickx)\
**Post date:** [November 30, 2023, 1:51pm UTC](https://forums.developer.nvidia.com/t/pip-installation-error-with-pytorch-quantization/269905/7 "2023-11-30T13:51:09Z")

</div>

Also ran into this issue but managed to figure it out.  
So basically your python is trying to install [this](https://pypi.org/project/pytorch-quantization/) “fake” package, which is warning you to download straight from nvidia’s repository instead.

```auto
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:

```auto
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”

---

<div class="post-metadata">

**Author:** ![vlad.bratulescu](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@vlad.bratulescu](https://forums.developer.nvidia.com/u/vlad.bratulescu)\
**Post date:** [December 7, 2023, 12:49pm UTC](https://forums.developer.nvidia.com/t/pip-installation-error-with-pytorch-quantization/269905/8 "2023-12-07T12:49:03Z")

</div>

I have the same problem and tried your solution:

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

```

But now I get:

```auto
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?

---

<div class="post-metadata">

**Author:** ![pijuskri](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/pijuskri/32/163478_2.png) [@pijuskri](https://forums.developer.nvidia.com/u/pijuskri)\
**Post date:** [January 31, 2024, 6:04pm UTC](https://forums.developer.nvidia.com/t/pip-installation-error-with-pytorch-quantization/269905/9 "2024-01-31T18:04:35Z")

</div>

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`

---

<div class="post-metadata">

**Author:** ![yeripark521](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@yeripark521](https://forums.developer.nvidia.com/u/yeripark521)\
**Post date:** [April 25, 2024, 7:19am UTC](https://forums.developer.nvidia.com/t/pip-installation-error-with-pytorch-quantization/269905/10 "2024-04-25T07:19:28Z")

</div>

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