How to apt install python-pybind11?
Asked Answered
T

4

6

I see form my project document that I need to install python-pybind11 by using

sudo apt -y install python-pybind11

but I got error like this:

Reading package lists... Done

Building dependency tree
Reading state information... Done

E: Unable to locate package python-pybind11

I'm not sure if python-pybind11 is a valid package, where can I check it?

Thadeus answered 15/2, 2019 at 7:38 Comment(2)
Welcome , the python-pybind11 is a valid package for Ubuntu 18.04 and higher.Baronage
@Felix Xu, You should accept correct answer.Emblem
E
6

Use this to install pybind11:

pip install pybind11

Refer from Here.

Emblem answered 15/2, 2019 at 7:41 Comment(4)
after I run the comand, I got: Collecting pybind11 Downloading https://files.pythonhosted.org/packages/f2/7c/e71995e59e108799800cb0fce6c4b4927914d7eada0723dd20bae3b51786/pybind11-2.2.4-py2.py3-none-any.whl (145kB) 100% |████████████████████████████████| 153kB 13kB/s Installing collected packages: pybind11 Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/pybind11' Consider using the --user` option or check the permissions. `Thadeus
@FeilixXu, Seems to be a permission issue. Run this with “sudo”.Emblem
now another error: Traceback (most recent call last): File "/usr/bin/pip", line 9, in <module> from pip import main ImportError: cannot import name main . I'm using ubuntu16, is that related?Thadeus
Peanut gallery comment: Please don't sudo pip install! Consider pip install --user, but really, just try using a virtualenv!Churchy
M
7

In some systems, you may need

sudo apt -y install python3-pybind11
Milda answered 22/7, 2022 at 15:1 Comment(0)
E
6

Use this to install pybind11:

pip install pybind11

Refer from Here.

Emblem answered 15/2, 2019 at 7:41 Comment(4)
after I run the comand, I got: Collecting pybind11 Downloading https://files.pythonhosted.org/packages/f2/7c/e71995e59e108799800cb0fce6c4b4927914d7eada0723dd20bae3b51786/pybind11-2.2.4-py2.py3-none-any.whl (145kB) 100% |████████████████████████████████| 153kB 13kB/s Installing collected packages: pybind11 Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/pybind11' Consider using the --user` option or check the permissions. `Thadeus
@FeilixXu, Seems to be a permission issue. Run this with “sudo”.Emblem
now another error: Traceback (most recent call last): File "/usr/bin/pip", line 9, in <module> from pip import main ImportError: cannot import name main . I'm using ubuntu16, is that related?Thadeus
Peanut gallery comment: Please don't sudo pip install! Consider pip install --user, but really, just try using a virtualenv!Churchy
R
5

In Ubuntu 18.04

apt-get install python-pybind11

On Mac,

brew install pybind11

In Ubuntu 16.04, you'll need to install yourself. One way is as follows:

# Some prerequisites (but not all of them)
apt-get install cmake
pip3 install pytest

# Clone, build and install 
git clone https://github.com/pybind/pybind11.git 
cd pybind11 
mkdir build 
cd build 
cmake .. 
make install

Reference

Roxannaroxanne answered 11/6, 2019 at 23:3 Comment(1)
I used your instructions herePare
N
0

OS Way

dnf --enablerepo=crb -y install pybind11-devel

or

yum install pybind11

Pybind installation docs: https://pybind11.readthedocs.io/en/stable/installing.html

Pip way

pip install wheel setuptools pip --upgrade

Needlecraft answered 30/11, 2023 at 0:55 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.