Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"No module named pybind11" after installing pybind11

I have installed pybind11 (several different ways, including pip and the package manager) on my Ubuntu 18.04.3 machine, but when I try to specify include files the recommended way:

python3 -m pybind11 --includes

I get this error:

/usr/bin/python3: No module named pybind11.__main__; 'pybind11' is a package and cannot be directly executed

The only place I've found this error mentioned is a Chinese web page which wasn't helpful in resolving the problem. How do I get pybind11 to work?

To answer some of the questions below:

>>> import pybind11; print(pybind11.__file__)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'pybind11' has no attribute '__file__'
> python3 -m pip install pybind11
WARNING: The directory '/home/<username>/.cache/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Requirement already satisfied: pybind11 in /usr/local/lib/python3.6/dist-packages (2.5.0)
> sudo pip3 -V
pip 20.0.2 from /usr/local/lib/python3.6/dist-packages/pip (python 3.6)
> python3 -V
Python 3.6.8
like image 527
Madwand Avatar asked May 06 '26 18:05

Madwand


1 Answers

pybind11 was already installed. Fasttext installation was not able to find pybind11 until I ran this:

pip install wheel setuptools pip --upgrade

like image 58
gndps Avatar answered May 09 '26 13:05

gndps



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!