Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot install: No module named 'graph_notebook' #41

Closed
wdduncan opened this issue Dec 3, 2020 · 13 comments
Closed

Cannot install: No module named 'graph_notebook' #41

wdduncan opened this issue Dec 3, 2020 · 13 comments
Assignees
Labels
bug Something isn't working

Comments

@wdduncan
Copy link

wdduncan commented Dec 3, 2020

Describe the bug
I cannot install your graph notebook. I receive the error No module named 'graph_notebook' when following your installation steps.

To Reproduce
Steps to reproduce the behavior:

  1. Create virtual environment with venv: python -m venv .env
  2. Activate the virtual environment (.e.g, source .env/bin/activate).
  3. Upgrade pip to 20.3.1: pip install -U pip)
  4. Install requirements: pip install -r requirements.txt
  5. Per instructions, install and enable the visualization widget: jupyter nbextension install --py --sys-prefix graph_notebook.widgets
    I receive the ERROR: ModuleNotFoundError: No module named 'graph_notebook'

I have tried running the jupyter nbextension install --py --sys-prefix graph_notebook.widgets command from the src directory and I received the same error.

Desktop (please complete the following information):

  • OS: OS X 11 (Big Sur)
  • Browser Safari
  • terminal: running zsh
@wdduncan wdduncan added the bug Something isn't working label Dec 3, 2020
@austinkline
Copy link
Contributor

Usually I see this issue if jupyter is referencing a different environment than the virtualenv you have activated, you can please check the following commands:

  1. Check where jupyter is located:
(venv) ➜  ~ which jupyter
/Users/austinkline/venv/bin/jupyter
  1. Look for installed jupyter kernels (activate your virtual environment):
(venv) ➜  ~ jupyter kernelspec list
Available kernels:
  python3    /Users/austinkline/venv/share/jupyter/kernels/python3
  1. Check the contents of the kernel json:
(venv) ➜  ~ cat /Users/austinkline/venv/share/jupyter/kernels/python3/kernel.json
{
 "argv": [
  "python",
  "-m",
  "ipykernel_launcher",
  "-f",
  "{connection_file}"
 ],
 "display_name": "Python 3",
 "language": "python"
}

My guess it that the version of jupyter referenced in the commands:

jupyter nbextension install --py --sys-prefix graph_notebook.widgets
jupyter nbextension enable  --py --sys-prefix graph_notebook.widgets

Is using a different version of python than what you have in your activated virtual environment. This can happen if you already had jupyter installed to your user when you install the graph-notebook package

@wdduncan
Copy link
Author

wdduncan commented Dec 3, 2020

Thanks for the reply. Yes. I think your right. See my output from #3 below.
How do I specify which kernel to use when running the commands?:

jupyter nbextension install --py --sys-prefix graph_notebook.widgets
jupyter nbextension enable  --py --sys-prefix graph_notebook.widgets

My output using your commands:

  1. Jupyter is installed in the venv environment.
(.env)% which jupyter 
-> /Users/wdduncan/repos/aws/graph-notebook/.env/bin/jupyter
  1. Installed jupyter kernels.
(.env)% jupyter kernelspec list
-> Available kernels:
  clojupyter       /Users/wdduncan/Library/Jupyter/kernels/clojupyter
  ir               /Users/wdduncan/Library/Jupyter/kernels/ir
  python3          /Users/wdduncan/repos/aws/graph-notebook/.env/share/jupyter/kernels/python3
  spylon-kernel    /usr/local/share/jupyter/kernels/spylon-kernel
  1. Contents of the kernel json.
(.env)% cat /Users/wdduncan/repos/aws/graph-notebook/.env/share/jupyter/kernels/python3/kernel.json
-> {
 "argv": [
  "python",
  "-m",
  "ipykernel_launcher",
  "-f",
  "{connection_file}"
 ],
 "display_name": "Python 3",
 "language": "python"
}

@austinkline
Copy link
Contributor

Well actually it looks like the jupyter installable is in your .env so that doesn't seem to be what's going on here. The problem I thought we were seeing would be confirmed if the jupyter path was not in the same virtual environment as the installed package.

can we also check that this package is in the virtual environment?

# from your activated virtual environment..
pip freeze | grep graph-notebook

Are there any repro steps that I can try to replicate your setup? What version of python are you on currently?

@wdduncan
Copy link
Author

wdduncan commented Dec 4, 2020

Here's the info:

(.env)% pip freeze | grep graph-notebook
-> graph-notebook==2.0.1

I'm running Python 3.7.8.

@wdduncan
Copy link
Author

wdduncan commented Dec 4, 2020

Update: I was able to install by explicitly using the jupyter in my venv. E.g.:

.env/bin/jupyter nbextension install --py --sys-prefix graph_notebook.widgets
.env/bin/jupyter nbextension enable  --py --sys-prefix graph_notebook.widgets

I still need to test the notebook ...

@austinkline
Copy link
Contributor

So the original thought might be right, then. Is jupyter installed outside of the virtual environment? Could you run

which jupyter

without the activated environment? If jupyter is indeed also installed on the user level, then uninstalling it might fix the issue.

@wdduncan
Copy link
Author

wdduncan commented Dec 4, 2020

I just tried to connect to a local blazegraph instance using:

%%graph_notebook_config
{
  "host": "localhost",
  "port": 9999,
  "auth_mode": "DEFAULT",
  "iam_credentials_provider_type": "ROLE",
  "load_from_s3_arn": "",
  "ssl": false,
  "aws_region": "us-east-1"
}

I received the error:

UsageError: Cell magic `%%graph_notebook_config` not found.

Perhaps I need to use Python 3.6 (as specified in the README)?

@wdduncan
Copy link
Author

wdduncan commented Dec 4, 2020

Could you run

which jupyter

without the activated environment? If jupyter is indeed also installed on the user level, then uninstalling it might fix the issue.

Without running the venv, jupyter runs out of my anaconda install:

/Users/wdduncan/opt/anaconda3/bin/jupyter

@austinkline
Copy link
Contributor

austinkline commented Dec 4, 2020

3.7.x versions have not been fully tested, but they have worked for myself and others.

Looks like we have a good hint to this issue, though. Jupyter is also installed at /Users/wdduncan/opt/anaconda3/bin/jupyter.

Could be that the system is confused on which one to use. Is it possible to uninstall it for now and see if a fresh install afterwards would fix the issue? We could also confirm this mismatch if we check for the installed packages from inside of the running jupyter server.

Run the following cell:

%%bash
pip freeze | grep graph-notebook

@wdduncan
Copy link
Author

wdduncan commented Dec 5, 2020

I ran the command pip freeze | grep graph-notebook from within the venv and without the venv.
In the venv:

(.env)% which jupyter
-> /Users/wdduncan/repos/aws/graph-notebook/.env/bin/jupyter

(.env)% pip freeze | grep graph-notebook
->graph-notebook==2.0.1

Without the venv I get an error. But that is what I expected since I only installed graph-notebook in the venv.

% which jupyter
-> /Users/wdduncan/opt/anaconda3/bin/jupyter # this is what I expected

% pip freeze | grep graph-notebook
-> CalledProcessError: Command 'b'pip freeze | grep graph-notebook\n'' returned non-zero exit status 1.  

@wdduncan
Copy link
Author

wdduncan commented Dec 5, 2020

Ok ... I think I might have fixed the source of my error. I did not run the commands:

python -m graph_notebook.static_resources.install
python -m graph_notebook.nbextensions.install

from within my venv.

Not this command executes:

%%graph_notebook_config
{
  "host": "localhost",
  "port": 8182,
  "auth_mode": "DEFAULT",
  "iam_credentials_provider_type": "ROLE",
  "load_from_s3_arn": "",
  "ssl": false,
  "aws_region": "us-east-1"
}

Sorry for the confusion!!! User error :(

I still need to test against the triple store :)

@wdduncan
Copy link
Author

wdduncan commented Dec 5, 2020

It is working if you want to close the ticket.

@beebs-systap
Copy link
Member

Thanks @wdduncan. Let us know how it goes with your triple store! :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants