1

I implemented python bindings for a C++ project. I want the extension module to be installable via pip. I managed to get a setupfile working, that compiles the module : https://gitlab.com/cytosim/cytosim/-/tree/pybind

So I can python3 setup.py sdist bdist_wheel and then pip3 install cytosim.xxxxx.whl without error. However, the module lands in /home/xxxx/anaconda3/module/lib instead of arriving in anaconda3/lib/python3.9/site-packages.

The relevant part of the setup.py file is :

setup(
    name="cytosim",
    version=version,
    packages=find_packages(where="module"),
    package_dir={"": "module"},
    cmake_install_dir="module",
    description=DOCLINES[0],
    long_description=open("README.md", encoding="utf8").read(),
    long_description_content_type="text/markdown",
    platforms=["Windows", "Linux", "Mac OS-X", "Unix"],
    keywords="simulation actin microtubule polymer",
    cmake_args=cmake_args,
    zip_safe=False,
)

How do I put the compiled extension module in site-packages ?

SergeD
  • 44
  • 9
  • Try to run pip with sudo. – unddoch Dec 21 '22 at 09:22
  • 1
    I don't think there is any reason to do that. It's not a matter of permissions. – SergeD Dec 21 '22 at 10:44
  • If you don't give it specific flags, pip chooses whether to install in user env or globally based on the permissions it has. – unddoch Dec 21 '22 at 11:32
  • It does go into the user env. However, instead of the right place in the env (/home/xxxx/anaconda3/lib/python3.9/site-packages) it goes into a weird place in the user env (/home/xxxx/anaconda3/module/lib) – SergeD Jan 10 '23 at 10:02

0 Answers0