datactive / bigbang

Scientific analysis of collaborative communities
http://datactive.github.io/bigbang/
MIT License
149 stars 52 forks source link

ModuleNotFoundError: No module named 'graph' // multiple notebook issue #426

Closed nllz closed 3 years ago

nllz commented 3 years ago

Several notebooks, such as notebooks/InteractionNetwork.ipynb, rely on:

import bigbang.graph as graph

but

----> 6 import graph

fails with:

ModuleNotFoundError: No module named 'graph'

sbenthall commented 3 years ago

Ok. I've figured this out.

Recall the earlier problem with sudo. That had to do with one command that for some reason is not in the conda installation, but remains in the pip installation.

python setup.py develop installs the package into the environment locally with hooks so that when you edit the source code in the development directory, it changes the Python environment.

A complication with this is that by default, it installs this into a root package. To avoid this, you can install in a user's directory.

python setup.py develop --user

See discussion here.

Note that there is a conda develop command that is supposed to do the same thing, but the consensus is it is not well documented or maintained.

pip install -e . is supposed to do the same thing as python setup.py develop. We do include this line in the requirements, but for some reason it is not working.

https://github.com/datactive/bigbang/blob/master/requirements.txt#L1

Reasons might be:

Note also that when I tried this, I got an error with the Levenshtein package installation, which is resolved by installing the development version of Python. See here.

A tricky thing about this is that we have been providing installation instructions assuming that somebody is installing it to develop the software. That is a different use case from somebody who wants to install it to use it for analysis. Ideally, there would be two instruction sets. Of course, at this stage we don't have many pure "users" ...