# Help! Failed to install package 'filterpy'

**URL:** <https://discuss.python.org/t/help-failed-to-install-package-filterpy/49608>\
**Category:** Python Help\
**Tags:** help\
**Created:** [March 27, 2024, 2:01am UTC](https://discuss.python.org/t/help-failed-to-install-package-filterpy/49608 "2024-03-27T02:01:50Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![eJudy](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/ejudy/32/21539_2.png) [@eJudy](https://discuss.python.org/u/eJudy)\
**Post date:** [March 27, 2024, 2:01am UTC](https://discuss.python.org/t/help-failed-to-install-package-filterpy/49608/1 "2024-03-27T02:01:50Z")

</div>

I am a beginner in python, and I have trouble installing package ‘filterpy’…

Environment: pip version: 24.0, python version: 3.8, OS: Win 10.0.19045.4170

At first, I tried to install Real-ESRGAN ([GitHub - xinntao/Real-ESRGAN: Real-ESRGAN aims at developing Practical Algorithms for General Image/Video Restoration.](https://github.com/xinntao/Real-ESRGAN#-dependencies-and-installation)) following the instruction:

```python
# Install basicsr - https://github.com/xinntao/BasicSR
# We use BasicSR for both training and inference
pip install basicsr
# facexlib and gfpgan are for face enhancement
pip install facexlib
pip install gfpgan
pip install -r requirements.txt
python setup.py develop

```

The installation of basicsr was successful, but after typing `pip install facexlib`, an error occured:

```python
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting facexlib
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/36/7b/2147339dafe1c4800514c9c21ee4444f8b419ce51dfc7695220a8e0069a6/facexlib-0.3.0-py3-none-any.whl (59 kB)
Collecting filterpy (from facexlib)
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/f6/1d/ac8914360460fafa1990890259b7fa5ef7ba4cd59014e782e4ab3ab144d8/filterpy-1.4.5.zip (177 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [6 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "C:\Users\xxx\AppData\Local\Temp\pip-install-c2s08o0f\filterpy_4d567f49cadb405fa28fab3d300eebf4\setup.py", line 4, in <module>
          import filterpy
      ModuleNotFoundError: No module named 'filterpy'
      [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.

```

It seems that I should install filterpy first. So I typed `pip install filterpy`, but almost the same error occurred:

```python
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting filterpy
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/f6/1d/ac8914360460fafa1990890259b7fa5ef7ba4cd59014e782e4ab3ab144d8/filterpy-1.4.5.zip (177 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [6 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "C:\Users\xxx\AppData\Local\Temp\pip-install-gcrncr7c\filterpy_b52f458dbe1640e1b0dfbaaa48b8d46a\setup.py", line 4, in <module>
          import filterpy
      ModuleNotFoundError: No module named 'filterpy'
      [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.

```

I got confused because it said “No module named ‘filterpy’” when installing filterpy. I have tried to change the source of pip many times by `pip config set global.index-url http://mirrors.cloud.tencent.com/pypi/simple`.

I also tried to download the zip from pypi and used `pip install D:\...\filterpy-1.4.5.zip`, but just encountered the same error…

I tried to download the source code from github ([GitHub - rlabbe/filterpy: Python Kalman filtering and optimal estimation library. Implements Kalman filter, particle filter, Extended Kalman filter, Unscented Kalman filter, g-h (alpha-beta), least squares, H Infinity, smoothers, and more. Has companion book 'Kalman and Bayesian Filters in Python'.](https://github.com/rlabbe/filterpy)) and used `python setup.py install`, and it said

```python
Traceback (most recent call last):
  File "setup.py", line 4, in <module>
    import filterpy
ModuleNotFoundError: No module named 'filterpy'

```

Now I have no idea about what to do next…

I want to install the filterpy package correctly, and then install other requirements of Real-ESRGAN. Glad to hear any suggestion on this post, my English grammar and other aspects 🙂

---

<div class="post-metadata">

**Author:** ![csm10495](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/csm10495/32/9731_2.png) [@csm10495](https://discuss.python.org/u/csm10495)\
**Post date:** [March 28, 2024, 4:01am UTC](https://discuss.python.org/t/help-failed-to-install-package-filterpy/49608/2 "2024-03-28T04:01:01Z")

</div>

Maybe try using the default pypi index if possible?

```python
https://pypi.org/simple

```

If it still doesn’t work, try again in a fresh venv: [venv — Creation of virtual environments — Python 3.12.2 documentation](https://docs.python.org/3/library/venv.html#creating-virtual-environments) should help with that

---

<div class="post-metadata">

**Author:** ![FelixLeg](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/felixleg/32/18439_2.png) [@FelixLeg](https://discuss.python.org/u/FelixLeg)\
**Post date:** [March 28, 2024, 7:15am UTC](https://discuss.python.org/t/help-failed-to-install-package-filterpy/49608/3 "2024-03-28T07:15:26Z")

</div>

> [@eJudy](#):
>
> python version: 3.8

I’m not sure about this, so I’m asking Python Developers here: Does THIS version of Python have got different rules for locating packages than the newest version? Because I tried to install the OP’s package on my own and I didn’t get that error. I don’t remember that well but something tells me these rules was changed in the mean time.

As for You Brian, can you update your Python to a newer one? Or you have to work with this version?

---

<div class="post-metadata">

**Author:** ![eJudy](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/ejudy/32/21539_2.png) [@eJudy](https://discuss.python.org/u/eJudy)\
**Post date:** [March 28, 2024, 1:08pm UTC](https://discuss.python.org/t/help-failed-to-install-package-filterpy/49608/4 "2024-03-28T13:08:12Z")

</div>

Thanks for all helps above!

I changed the version of my python to 3.12.2(I didn’t use venv, but installed the newer version in another directory), and it worked. The installation of filterpy(and facexlib, which depends on filterpy) was successful, but I now encounter new problems…

As it says:

```python
# Install basicsr - https://github.com/xinntao/BasicSR
# We use BasicSR for both training and inference
pip install basicsr
# facexlib and gfpgan are for face enhancement
pip install facexlib
pip install gfpgan
pip install -r requirements.txt
python setup.py develop

```

I need to install basicsr, facexlib and gfpgan. Now the installation of them is almost done, but pip warns me:

```python
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
basicsr 1.4.2 requires lmdb, which is not installed.
gfpgan 1.3.8 requires lmdb, which is not installed.

```

So I typed `pip install lmdb -i https://pypi.org/simple`, then something went wrong:

```python
Collecting lmdb
  Using cached lmdb-1.4.1.tar.gz (881 kB)
  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
  ╰─> [27 lines of output]
      py-lmdb: Using bundled liblmdb with py-lmdb patches; override with LMDB_FORCE_SYSTEM=1 or LMDB_PURE=1.
      Traceback (most recent call last):
        File "<string>", line 92, in <module>
      ModuleNotFoundError: No module named 'patch_ng'

      During handling of the above exception, another exception occurred:

      Traceback (most recent call last):
       ...
      Exception: Building py-lmdb from source on Windows requires the "patch-ng" python module.
      [end of output]

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

```

Missing `patch-ng`? I’ve installed it!

```python
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting patch_ng
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/c1/b2/ad3cd464101435fdf642d20e0e5e782b4edaef1affdf2adfc5c75660225b/patch-ng-1.17.4.tar.gz (17 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: patch_ng
  Building wheel for patch_ng (pyproject.toml) ... done
  Created wheel for patch_ng: filename=patch_ng-1.17.4-py3-none-any.whl size=16101 sha256=d11742b3d41e7a2117087a629fd7624681d6b0464951432cf2d73c78b37a8228
  Stored in directory: c:\users\xxx\appdata\local\pip\cache\wheels\83\e2\18\fb2a67897706b15a5569a8a9fd3d8e5c6e24c49605da66880d
Successfully built patch_ng
Installing collected packages: patch_ng
Successfully installed patch_ng-1.17.4

```

Now I get a little crazy, is it normal to be so tough to deploy a working environment or install packages? Desparate to read your replies:)

---

<div class="post-metadata">

**Author:** ![FelixLeg](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/felixleg/32/18439_2.png) [@FelixLeg](https://discuss.python.org/u/FelixLeg)\
**Post date:** [March 28, 2024, 1:17pm UTC](https://discuss.python.org/t/help-failed-to-install-package-filterpy/49608/5 "2024-03-28T13:17:54Z")

</div>

Hmm, have you tried to install `lmdb` without `patch_ng`? The pip gives you a hint here:

```txt
py-lmdb: Using bundled liblmdb with py-lmdb patches; override with LMDB_FORCE_SYSTEM=1 or LMDB_PURE=1.

```

On Windows try:

```txt
set "LMDB_PURE=1" & pip install lmdb -i https://pypi.org/simple

```

On Linux:

```python
LMDB_PURE=1 pip install lmdb -i https://pypi.org/simple

```

Hope that helps 🫰

---

<div class="post-metadata">

**Author:** ![eJudy](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/ejudy/32/21539_2.png) [@eJudy](https://discuss.python.org/u/eJudy)\
**Post date:** [March 28, 2024, 1:24pm UTC](https://discuss.python.org/t/help-failed-to-install-package-filterpy/49608/6 "2024-03-28T13:24:54Z")

</div>

Thanks a lot! It works. Now the error is:

```python
Collecting lmdb
  Using cached lmdb-1.4.1.tar.gz (881 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: lmdb
  Building wheel for lmdb (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for lmdb (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [16 lines of output]
      py-lmdb: Using bundled unmodified liblmdb; override with LMDB_FORCE_SYSTEM=1.
      py-lmdb: Using CPython extension; override with LMDB_FORCE_CFFI=1.
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build\lib.win-amd64-cpython-312
      creating build\lib.win-amd64-cpython-312\lmdb
      copying lmdb\cffi.py -> build\lib.win-amd64-cpython-312\lmdb
      copying lmdb\tool.py -> build\lib.win-amd64-cpython-312\lmdb
      copying lmdb\_config.py -> build\lib.win-amd64-cpython-312\lmdb
      copying lmdb\ __init__.py -> build\lib.win-amd64-cpython-312\lmdb
      copying lmdb\ __main__.py -> build\lib.win-amd64-cpython-312\lmdb
      running build_ext
      building 'cpython' extension
      error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for lmdb
Failed to build lmdb
ERROR: Could not build wheels for lmdb, which is required to install pyproject.toml-based projects

```

It seems I have to install MSVC++ 14.0 or so. Unfortunately the time is 21:30 here, so I may handle this problem tomorrow…

Thank you again for your reply 😉

---

<div class="post-metadata">

**Author:** ![csm10495](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/csm10495/32/9731_2.png) [@csm10495](https://discuss.python.org/u/csm10495)\
**Post date:** [March 28, 2024, 3:32pm UTC](https://discuss.python.org/t/help-failed-to-install-package-filterpy/49608/7 "2024-03-28T15:32:02Z")

</div>

Follow the link it gave to install the build tools and try again
