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

No jupyter_server.prometheus #10

Open
saulshanabrook opened this issue Oct 21, 2019 · 10 comments
Open

No jupyter_server.prometheus #10

saulshanabrook opened this issue Oct 21, 2019 · 10 comments

Comments

@saulshanabrook
Copy link
Contributor

$ phoila install .
Traceback (most recent call last):
  File "/usr/local/miniconda3/envs/ibis-vega-transform/bin/phoila", line 6, in <module>
    from phoila.app import main
  File "/usr/local/miniconda3/envs/ibis-vega-transform/lib/python3.7/site-packages/phoila/app.py", line 5, in <module>
    from .serverapp import ServerApp
  File "/usr/local/miniconda3/envs/ibis-vega-transform/lib/python3.7/site-packages/phoila/serverapp.py", line 70, in <module>
    import jupyter_server.prometheus.metrics
ModuleNotFoundError: No module named 'jupyter_server.prometheus'
$ pip freeze | grep jupyter-server
jupyter-server==0.1.1
$ pip freeze | grep phoila
phoila==0.3.0
@saulshanabrook
Copy link
Contributor Author

If I do a dev install of jupyter server this works. So I guess the most recent released version of phoila depends on an unreleased version of jupyter server?

$ pip install git+https://github.com/jupyter/jupyter_server.git
Collecting git+https://github.com/jupyter/jupyter_server.git
  Cloning https://github.com/jupyter/jupyter_server.git to /private/var/folders/m7/t8dvwtnn32z84333p845tly40000gn/T/pip-req-build-rz6yptc5
  Running command git clone -q https://github.com/jupyter/jupyter_server.git /private/var/folders/m7/t8dvwtnn32z84333p845tly40000gn/T/pip-req-build-rz6yptc5
  Running command git submodule update --init --recursive -q
Requirement already satisfied: jinja2 in /usr/local/miniconda3/envs/ibis-vega-transform/lib/python3.7/site-packages (from jupyter-server==0.2.0.dev0) (2.10.1)
Requirement already satisfied: tornado>=5.0 in /usr/local/miniconda3/envs/ibis-vega-transform/lib/python3.7/site-packages (from jupyter-server==0.2.0.dev0) (5.1.1)
Requirement already satisfied: pyzmq>=17 in /usr/local/miniconda3/envs/ibis-vega-transform/lib/python3.7/site-packages (from jupyter-server==0.2.0.dev0) (18.0.2)
Requirement already satisfied: ipython_genutils in /usr/local/miniconda3/envs/ibis-vega-transform/lib/python3.7/site-packages (from jupyter-server==0.2.0.dev0) (0.2.0)
Requirement already satisfied: traitlets>=4.2.1 in /usr/local/miniconda3/envs/ibis-vega-transform/lib/python3.7/site-packages (from jupyter-server==0.2.0.dev0) (4.3.2)
Requirement already satisfied: jupyter_core>=4.4.0 in /usr/local/miniconda3/envs/ibis-vega-transform/lib/python3.7/site-packages (from jupyter-server==0.2.0.dev0) (4.4.0)
Requirement already satisfied: jupyter_client>=5.3.1 in /usr/local/miniconda3/envs/ibis-vega-transform/lib/python3.7/site-packages (from jupyter-server==0.2.0.dev0) (5.3.1)
Requirement already satisfied: nbformat in /usr/local/miniconda3/envs/ibis-vega-transform/lib/python3.7/site-packages (from jupyter-server==0.2.0.dev0) (4.4.0)
Requirement already satisfied: nbconvert in /usr/local/miniconda3/envs/ibis-vega-transform/lib/python3.7/site-packages (from jupyter-server==0.2.0.dev0) (5.6.0)
Requirement already satisfied: ipykernel in /usr/local/miniconda3/envs/ibis-vega-transform/lib/python3.7/site-packages (from jupyter-server==0.2.0.dev0) (5.1.2)
Requirement already satisfied: Send2Trash in /usr/local/miniconda3/envs/ibis-vega-transform/lib/python3.7/site-packages (from jupyter-server==0.2.0.dev0) (1.5.0)
Requirement already satisfied: terminado>=0.8.1 in /usr/local/miniconda3/envs/ibis-vega-transform/lib/python3.7/site-packages (from jupyter-server==0.2.0.dev0) (0.8.2)
Requirement already satisfied: prometheus_client in /usr/local/miniconda3/envs/ibis-vega-transform/lib/python3.7/site-packages (from jupyter-server==0.2.0.dev0) (0.7.1)
Requirement already satisfied: MarkupSafe>=0.23 in /usr/local/miniconda3/envs/ibis-vega-transform/lib/python3.7/site-packages (from jinja2->jupyter-server==0.2.0.dev0) (1.1.1)
Requirement already satisfied: six in /usr/local/miniconda3/envs/ibis-vega-transform/lib/python3.7/site-packages (from traitlets>=4.2.1->jupyter-server==0.2.0.dev0) (1.12.0)
Requirement already satisfied: decorator in /usr/local/miniconda3/envs/ibis-vega-transform/lib/python3.7/site-packages (from traitlets>=4.2.1->jupyter-server==0.2.0.dev0) (4.4.0)
Requirement already satisfied: python-dateutil>=2.1 in /usr/local/miniconda3/envs/ibis-vega-transform/lib/python3.7/site-packages (from jupyter_client>=5.3.1->jupyter-server==0.2.0.dev0) (2.8.0)
Requirement already satisfied: jsonschema!=2.5.0,>=2.4 in /usr/local/miniconda3/envs/ibis-vega-transform/lib/python3.7/site-packages (from nbformat->jupyter-server==0.2.0.dev0) (3.0.2)
Requirement already satisfied: mistune<2,>=0.8.1 in /usr/local/miniconda3/envs/ibis-vega-transform/lib/python3.7/site-packages (from nbconvert->jupyter-server==0.2.0.dev0) (0.8.4)
Requirement already satisfied: pandocfilters>=1.4.1 in /usr/local/miniconda3/envs/ibis-vega-transform/lib/python3.7/site-packages (from nbconvert->jupyter-server==0.2.0.dev0) (1.4.2)
Requirement already satisfied: pygments in /usr/local/miniconda3/envs/ibis-vega-transform/lib/python3.7/site-packages (from nbconvert->jupyter-server==0.2.0.dev0) (2.4.2)
Requirement already satisfied: defusedxml in /usr/local/miniconda3/envs/ibis-vega-transform/lib/python3.7/site-packages (from nbconvert->jupyter-server==0.2.0.dev0) (0.5.0)
Requirement already satisfied: bleach in /usr/local/miniconda3/envs/ibis-vega-transform/lib/python3.7/site-packages (from nbconvert->jupyter-server==0.2.0.dev0) (3.1.0)
Requirement already satisfied: entrypoints>=0.2.2 in /usr/local/miniconda3/envs/ibis-vega-transform/lib/python3.7/site-packages (from nbconvert->jupyter-server==0.2.0.dev0) (0.3)
Requirement already satisfied: testpath in /usr/local/miniconda3/envs/ibis-vega-transform/lib/python3.7/site-packages (from nbconvert->jupyter-server==0.2.0.dev0) (0.4.2)
Requirement already satisfied: ipython>=5.0.0 in /usr/local/miniconda3/envs/ibis-vega-transform/lib/python3.7/site-packages (from ipykernel->jupyter-server==0.2.0.dev0) (7.7.0)
Requirement already satisfied: setuptools in /usr/local/miniconda3/envs/ibis-vega-transform/lib/python3.7/site-packages (from jsonschema!=2.5.0,>=2.4->nbformat->jupyter-server==0.2.0.dev0) (41.2.0)
Requirement already satisfied: attrs>=17.4.0 in /usr/local/miniconda3/envs/ibis-vega-transform/lib/python3.7/site-packages (from jsonschema!=2.5.0,>=2.4->nbformat->jupyter-server==0.2.0.dev0) (19.1.0)
Requirement already satisfied: pyrsistent>=0.14.0 in /usr/local/miniconda3/envs/ibis-vega-transform/lib/python3.7/site-packages (from jsonschema!=2.5.0,>=2.4->nbformat->jupyter-server==0.2.0.dev0) (0.15.4)
Requirement already satisfied: webencodings in /usr/local/miniconda3/envs/ibis-vega-transform/lib/python3.7/site-packages (from bleach->nbconvert->jupyter-server==0.2.0.dev0) (0.5.1)
Requirement already satisfied: backcall in /usr/local/miniconda3/envs/ibis-vega-transform/lib/python3.7/site-packages (from ipython>=5.0.0->ipykernel->jupyter-server==0.2.0.dev0) (0.1.0)
Requirement already satisfied: jedi>=0.10 in /usr/local/miniconda3/envs/ibis-vega-transform/lib/python3.7/site-packages (from ipython>=5.0.0->ipykernel->jupyter-server==0.2.0.dev0) (0.15.1)
Requirement already satisfied: pexpect; sys_platform != "win32" in /usr/local/miniconda3/envs/ibis-vega-transform/lib/python3.7/site-packages (from ipython>=5.0.0->ipykernel->jupyter-server==0.2.0.dev0) (4.7.0)
Requirement already satisfied: prompt-toolkit<2.1.0,>=2.0.0 in /usr/local/miniconda3/envs/ibis-vega-transform/lib/python3.7/site-packages (from ipython>=5.0.0->ipykernel->jupyter-server==0.2.0.dev0) (2.0.9)
Requirement already satisfied: pickleshare in /usr/local/miniconda3/envs/ibis-vega-transform/lib/python3.7/site-packages (from ipython>=5.0.0->ipykernel->jupyter-server==0.2.0.dev0) (0.7.5)
Requirement already satisfied: appnope; sys_platform == "darwin" in /usr/local/miniconda3/envs/ibis-vega-transform/lib/python3.7/site-packages (from ipython>=5.0.0->ipykernel->jupyter-server==0.2.0.dev0) (0.1.0)
Requirement already satisfied: parso>=0.5.0 in /usr/local/miniconda3/envs/ibis-vega-transform/lib/python3.7/site-packages (from jedi>=0.10->ipython>=5.0.0->ipykernel->jupyter-server==0.2.0.dev0) (0.5.1)
Requirement already satisfied: ptyprocess>=0.5 in /usr/local/miniconda3/envs/ibis-vega-transform/lib/python3.7/site-packages (from pexpect; sys_platform != "win32"->ipython>=5.0.0->ipykernel->jupyter-server==0.2.0.dev0) (0.6.0)
Requirement already satisfied: wcwidth in /usr/local/miniconda3/envs/ibis-vega-transform/lib/python3.7/site-packages (from prompt-toolkit<2.1.0,>=2.0.0->ipython>=5.0.0->ipykernel->jupyter-server==0.2.0.dev0) (0.1.7)
Building wheels for collected packages: jupyter-server
  Building wheel for jupyter-server (setup.py) ... done
  Created wheel for jupyter-server: filename=jupyter_server-0.2.0.dev0-cp37-none-any.whl size=202596 sha256=0a45308568e11edae7482b636c0da9f848ac9d4827adceb1279b333d443654e2
  Stored in directory: /private/var/folders/m7/t8dvwtnn32z84333p845tly40000gn/T/pip-ephem-wheel-cache-apothcgw/wheels/06/bb/12/cf3ac7f4f4bcceff670c9ff94c71df2d48e8fdead10435845e
Successfully built jupyter-server
ERROR: voila 0.1.13 has requirement jupyter-server<0.2.0,>=0.1.0, but you'll have jupyter-server 0.2.0.dev0 which is incompatible.
Installing collected packages: jupyter-server
  Found existing installation: jupyter-server 0.1.1
    Uninstalling jupyter-server-0.1.1:
      Successfully uninstalled jupyter-server-0.1.1
Successfully installed jupyter-server-0.2.0.dev0
$ phoila install .
Building jupyterlab assets (build:dev:minimize)

@saulshanabrook
Copy link
Contributor Author

One option would be to wait for jupyter server to make a release(jupyter-server/jupyter_server#89)

Another would be to allow running on an older version of jupyter server.

If it's just this logging stuff, @vidartf what do you think about putting it behind an try .... except ImportError: so it can work with the released version? Pip makes it really hard to depend on a version from github.

@saulshanabrook
Copy link
Contributor Author

It look likes comm_open messages are not allowed?

[W 12:09:29.182 PhoilaApp] Received message of type "comm_open", which is not allowed. Ignoring.

@vidartf
Copy link
Owner

vidartf commented Oct 21, 2019

@saulshanabrook Ah, I missed that option in the metric grid (I added support for the new prometheus module in server + metrics OR prometheus in notebook). I'll add that.

@vidartf
Copy link
Owner

vidartf commented Oct 21, 2019

It look likes comm_open messages are not allowed?

I think I just copy pasted that code from voila, so it is likely to be an issue there as well:

https://github.com/voila-dashboards/voila/blob/d8c040fcbec2ba826d0985d2a1a126116b86ae7a/voila/app.py#L381-L391

@saulshanabrook
Copy link
Contributor Author

I think I just copy pasted that code from voila, so it is likely to be an issue there as well:

I added it in #11. Sorry I should have posted that error in the other thread about comms, to keep these issues separate.

@vidartf
Copy link
Owner

vidartf commented Oct 21, 2019

Does 77d9008 fix the metrics issue?

@saulshanabrook
Copy link
Contributor Author

It did, but I had to downgrade my version of notebook as well. with pip install "notebook<6.0"

Otherwise I got:

$ phoila examples/Charting\ Example.ipynb
Traceback (most recent call last):
  File "/usr/local/miniconda3/envs/ibis-vega-transform/lib/python3.7/site-packages/phoila/serverapp.py", line 77, in <module>
    import notebook.prometheus.metrics
  File "/usr/local/miniconda3/envs/ibis-vega-transform/lib/python3.7/site-packages/notebook/prometheus/metrics.py", line 15, in <module>
    ['method', 'handler', 'status_code'],
  File "/usr/local/miniconda3/envs/ibis-vega-transform/lib/python3.7/site-packages/prometheus_client/metrics.py", line 499, in __init__
    labelvalues=labelvalues,
  File "/usr/local/miniconda3/envs/ibis-vega-transform/lib/python3.7/site-packages/prometheus_client/metrics.py", line 107, in __init__
    registry.register(self)
  File "/usr/local/miniconda3/envs/ibis-vega-transform/lib/python3.7/site-packages/prometheus_client/registry.py", line 29, in register
    duplicates))
ValueError: Duplicated timeseries in CollectorRegistry: {'http_request_duration_seconds_bucket', 'http_request_duration_seconds_created', 'http_request_duration_seconds_count', 'http_request_duration_seconds_sum'}

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/miniconda3/envs/ibis-vega-transform/lib/python3.7/site-packages/phoila/serverapp.py", line 87, in <module>
    sys.modules['notebook.prometheus.metrics'] = sys.modules['jupyter_server.prometheus.metrics']
KeyError: 'jupyter_server.prometheus.metrics'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/miniconda3/envs/ibis-vega-transform/bin/phoila", line 6, in <module>
    from phoila.app import main
  File "/usr/local/miniconda3/envs/ibis-vega-transform/lib/python3.7/site-packages/phoila/app.py", line 5, in <module>
    from .serverapp import ServerApp
  File "/usr/local/miniconda3/envs/ibis-vega-transform/lib/python3.7/site-packages/phoila/serverapp.py", line 91, in <module>
    'Cannot use an older version of jupyter_server with a newer version of notebook'
RuntimeError: Cannot use an older version of jupyter_server with a newer version of notebook

@vidartf
Copy link
Owner

vidartf commented Oct 22, 2019

Yeah, that is expected (I don't know how to correct "split" a sys.modules entry into two, PRs welcome 😉).

@saulshanabrook
Copy link
Contributor Author

(I don't know how to correct "split" a sys.modules entry into two, PRs welcome 😉).

Hah I don't even know what that means! Not the end of the world to require an old version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants