# FindPythonLibs and pypy

**URL:** https://discourse.cmake.org/t/findpythonlibs-and-pypy/1050
**Category:** Usage
**Created:** [April 17, 2020, 10:56pm UTC](https://discourse.cmake.org/t/findpythonlibs-and-pypy/1050 "2020-04-17T22:56:57Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![KrisThielemans](https://discourse.cmake.org/user_avatar/discourse.cmake.org/kristhielemans/32/532_2.png) [@KrisThielemans](https://discourse.cmake.org/u/KrisThielemans)
#### Post date: [April 17, 2020, 10:56pm UTC](https://discourse.cmake.org/t/findpythonlibs-and-pypy/1050/1 "2020-04-17T22:56:57Z")

</div>

I’m somewhat out of my depth here, but trying to get a auto-generated conda PR [https://github.com/conda-forge/stir-feedstock/pull/16](https://github.com/conda-forge/stir-feedstock/pull/16) to work with pypy.

Our [CMakeLists.txt](https://github.com/UCL/STIR/blob/29133a3ffa690b444894b4392aa710e8bb33a42e/src/swig/CMakeLists.txt#L65-L68) uses simply

```auto
  find_package(PythonInterp)
  FIND_PACKAGE(PythonLibs REQUIRED)

```

but this fails on the find `PythonLibs`. Checking with (command line) `find` I get

```auto
$PREFIX/bin/python
$PREFIX/include/Python.h
$PREFIX/include/Python.h
$PREFIX/bin/libpypy3-c.so.debug
$PREFIX/lib/libpypy3-c.so

```

anyone any suggestions for handling pypy (portably?)

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [April 17, 2020, 11:26pm UTC](https://discourse.cmake.org/t/findpythonlibs-and-pypy/1050/2 "2020-04-17T23:26:40Z")

</div>

I suggest using the new `find_package(Python)` (or Python3 if you don’t need 2). That probably behaves better with other implementations.

---

<div class="post-metadata">

### Author: ![KrisThielemans](https://discourse.cmake.org/user_avatar/discourse.cmake.org/kristhielemans/32/532_2.png) [@KrisThielemans](https://discourse.cmake.org/u/KrisThielemans)
#### Post date: [April 18, 2020, 7:25am UTC](https://discourse.cmake.org/t/findpythonlibs-and-pypy/1050/3 "2020-04-18T07:25:52Z")

</div>

thanks Ben. I haven’t tried yet, but I had quick a look at the [FindPython.cmake](https://github.com/Kitware/CMake/blob/master/Modules/FindPython.cmake) and [FindPython/Support.cmake](https://github.com/Kitware/CMake/blob/master/Modules/FindPython/Support.cmake) source and can’t find any mention of pypy. Although I guess that doesn’t mean it won’t work of course… Anyone any experience with that?

---

<div class="post-metadata">

### Author: ![marc.chevrier](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/m/ecb155/32.png) [@marc.chevrier](https://discourse.cmake.org/u/marc.chevrier)
#### Post date: [April 18, 2020, 9:21am UTC](https://discourse.cmake.org/t/findpythonlibs-and-pypy/1050/4 "2020-04-18T09:21:18Z")

</div>

`pypy` is not yet supported but you can specify manually the library by setting variable `Python3_LIBRARY` **before** calling `find_package(Python3 ...)`. Note the support of input variables was introduced in v3.16.
