pythonhomebrewgraph-tool

Importing modules installed via Homebrew into Python


Installed graph-tool via homebrew using $ brew install graph-tool

Installation was successful. Now, when I try to import the module in the python shell, using from graph_tool.all import *

I receive a ModuleNotFoundError: No module named 'graph_tool' error

Python version info- Python 3.8.5, installed via pyenv at /Users/aamodpant/.pyenv/shims/python

graph-tool installed in /usr/local/Cellar/graph-tool

How do I import this into my python program?


Solution

  • This looks like a very similar issue to the one in this post: How to let python3 import graph-tool installed by Homebrew?

    Have a look at the top answer provided by NatKost where they created a symbolic link between graph-tool and the Python packages:

    ln -s /usr/local/Cellar/graph-tool/2.26_2/lib/python3.6/site-packages/graph_tool /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages
    

    You should be able adapt this for your graph-tool install and your venv.