# pip install igraph fails

**URL:** <https://igraph.discourse.group/t/pip-install-igraph-fails/1604>\
**Category:** Installation\
**Tags:** Python\
**Created:** [30 June 2023 15:16 UTC](https://igraph.discourse.group/t/pip-install-igraph-fails/1604 "2023-06-30T15:16:27Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aaa](https://avatars.discourse-cdn.com/v4/letter/a/ea666f/32.png) [@Aaa](https://igraph.discourse.group/u/Aaa)\
**Post date:** [30 June 2023 15:16 UTC](https://igraph.discourse.group/t/pip-install-igraph-fails/1604/1 "2023-06-30T15:16:27Z")

</div>

Hi all,

I was trying to install igraph in python. I followed the tutorial [Installing igraph](https://igraph.org/python/tutorial/0.9.8/install.html#installing-igraph). I use a macbook, anaconda, python 3.

Things I’ve tried:

`$pip install python-igraph`

`$conda install -c conda-forge python-igraph`

installing the C compiler “Xcode”  
Installing homebrew and then  
`$brew install cairo`

However, after I use any one of these installation methods, when I tried to import igraph in python, it says “no module named ‘igraph’.” Can anyone help me please? Thanks a lot!

---

<div class="post-metadata">

**Author:** ![vtraag](https://yyz2.discourse-cdn.com/free1/user_avatar/igraph.discourse.group/vtraag/32/38_2.png) [@vtraag](https://igraph.discourse.group/u/vtraag)\
**Post date:** [30 June 2023 15:26 UTC](https://igraph.discourse.group/t/pip-install-igraph-fails/1604/2 "2023-06-30T15:26:35Z")

</div>

It is quite difficult to know what the problem is with more details.

Could you please try to create a fully reproducible example? Please try to install `igraph` in a clean environment, to see what the problem is exactly.

For instance, using conda, you can do the following:

1. Install `python-igraph` in new environment `test` using `conda create -n test python-igraph`.
2. Activate the `test` environment, `conda activate test`
3. Run `python`
4. In python run `import igraph`

Please report all output if you encounter any problem.

---

<div class="post-metadata">

**Author:** ![Aaa](https://avatars.discourse-cdn.com/v4/letter/a/ea666f/32.png) [@Aaa](https://igraph.discourse.group/u/Aaa)\
**Post date:** [30 June 2023 15:30 UTC](https://igraph.discourse.group/t/pip-install-igraph-fails/1604/3 "2023-06-30T15:30:21Z")

</div>

This is what I get after step 1:

```plaintext
(base) Amyas-MacBook-Pro:~ amyaluo$ conda create -n test python-igraph
Collecting package metadata (current_repodata.json): done
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: failed

PackagesNotFoundError: The following packages are not available from current channels:

  - python-igraph

Current channels:

 (some links to anaconda that this forum does not allow me to post)

To search for alternate channels that may provide the conda package you're
looking for, navigate to

    https://anaconda.org

and use the search bar at the top of the page.

```

---

<div class="post-metadata">

**Author:** ![szhorvat](https://yyz2.discourse-cdn.com/free1/user_avatar/igraph.discourse.group/szhorvat/32/3_2.png) [@szhorvat](https://igraph.discourse.group/u/szhorvat)\
**Post date:** [30 June 2023 19:51 UTC](https://igraph.discourse.group/t/pip-install-igraph-fails/1604/4 "2023-06-30T19:51:39Z")

</div>

A small details was missing from Vincent’s answer. Use

```auto
conda create -n test python-igraph -c conda-forge

```

and otherwise follow Vincent’s instructions. This should work.

---

<div class="post-metadata">

**Author:** ![Aaa](https://avatars.discourse-cdn.com/v4/letter/a/ea666f/32.png) [@Aaa](https://igraph.discourse.group/u/Aaa)\
**Post date:** [30 June 2023 20:07 UTC](https://igraph.discourse.group/t/pip-install-igraph-fails/1604/5 "2023-06-30T20:07:12Z")

</div>

> [@szhorvat](#):
>
> `conda create -n test python-igraph -c conda-forge`

Thanks that works! But after I activated the test environment, it says `(test) Amyas-MacBook-Pro:~ amyaluo$`

And when I run `$import igraph in pycharm`, it still says `"no module named 'igraph'."` I think I’m missing some steps here. Can you help me? Thanks!

---

<div class="post-metadata">

**Author:** ![tamas](https://yyz2.discourse-cdn.com/free1/user_avatar/igraph.discourse.group/tamas/32/1261_2.png) [@tamas](https://igraph.discourse.group/u/tamas)\
**Post date:** [8 July 2023 11:03 UTC](https://igraph.discourse.group/t/pip-install-igraph-fails/1604/6 "2023-07-08T11:03:33Z")

</div>

I’m pretty sure that PyCharm tries to work with a different Python environment than the environment you installed `igraph` in.

Running `import sys; print(sys.path)` tells you which directories the Python interpreter is looking at when it tries to import a module. `import sys; print(sys.executable)` tells you the full path of the Python interpreter that you are using. Please verify that `sys.executable` points to Anaconda Python’s executable and that `sys.path` includes the folder where `igraph` was installed in the Anaconda environment.

---

<div class="post-metadata">

**Author:** ![Aaa](https://avatars.discourse-cdn.com/v4/letter/a/ea666f/32.png) [@Aaa](https://igraph.discourse.group/u/Aaa)\
**Post date:** [12 July 2023 21:24 UTC](https://igraph.discourse.group/t/pip-install-igraph-fails/1604/7 "2023-07-12T21:24:42Z")

</div>

Thanks for the response. You are right that the environment is different. Apparently my laptop has too many things installed in different places. I have it fixed and now it works.
