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

raise KeyError #19

Open
nlynn12 opened this issue Mar 29, 2019 · 3 comments
Open

raise KeyError #19

nlynn12 opened this issue Mar 29, 2019 · 3 comments

Comments

@nlynn12
Copy link

nlynn12 commented Mar 29, 2019

I've just tried to test your system but I fail when running the example code (here scikit)

$ python3 scikit_example.py 
Traceback (most recent call last):
  File "scikit_example.py", line 2, in <module>
    from modelchimp import Tracker
  File "/home/nily/.local/lib/python3.6/site-packages/modelchimp/__init__.py", line 2, in <module>
    logging.config.fileConfig('modelchimp/logging_config.ini')
  File "/usr/lib/python3.6/logging/config.py", line 76, in fileConfig
    formatters = _create_formatters(cp)
  File "/usr/lib/python3.6/logging/config.py", line 109, in _create_formatters
    flist = cp["formatters"]["keys"]
  File "/usr/lib/python3.6/configparser.py", line 959, in __getitem__
    raise KeyError(key)
KeyError: 'formatters'

I'm on Ubuntu 18.04 LTS

@samzer
Copy link
Member

samzer commented Mar 29, 2019

Thanks for reporting!

Just install the latest modelchimp python package, that should fix it.

pip3 install --no-cache-dir -U modelchimp

@nlynn12
Copy link
Author

nlynn12 commented Apr 1, 2019

Thank you for your fast response @samzer.

It works when installing it natively, but if I run this process inside a Docker container, then I simply get ModuleNotFoundError: No module named 'modelchimp'

To reproduce:

  • Server:
$ cd modelchimp/
$ bash docker.sh
  • Run PyTorch Docker container:
$ cd ModelChimpExamples/
$ docker run --runtime=nvidia -it --rm -v $PWD:/examples -w /examples pytorch/pytorch:0.4.1-cuda9-cudnn7-runtime bash
  • Inside the container:
root@4db27a514406:/examples# apt update && apt install python3-pip -y
(...)
root@4db27a514406:/examples# pip3 install --no-cache-dir -U modelchimp
Collecting modelchimp
  Downloading https://files.pythonhosted.org/packages/a1/b4/7c7ab210267eb79c49aa3af9ffc99b72d0cdbd8309a320bdeac38256c25e/modelchimp-0.5.5.tar.gz
Collecting requests (from modelchimp)
  Downloading https://files.pythonhosted.org/packages/7d/e3/20f3d364d6c8e5d2353c72a67778eb189176f08e873c9900e10c0287b84b/requests-2.21.0-py2.py3-none-any.whl (57kB)
    100% |################################| 61kB 2.0MB/s 
Collecting future (from modelchimp)
  Downloading https://files.pythonhosted.org/packages/90/52/e20466b85000a181e1e144fd8305caf2cf475e2f9674e797b222f8105f5f/future-0.17.1.tar.gz (829kB)
    100% |################################| 829kB 7.4MB/s 
Collecting six (from modelchimp)
  Downloading https://files.pythonhosted.org/packages/73/fb/00a976f728d0d1fecfe898238ce23f502a721c0ac0ecfedb80e0d88c64e9/six-1.12.0-py2.py3-none-any.whl
Collecting websocket-client==0.47.0 (from modelchimp)
  Downloading https://files.pythonhosted.org/packages/9d/fb/f51a03e232e00d6c504dfe815aed090c894ba3f8d3f7fd9612f3e227bf24/websocket_client-0.47.0-py2.py3-none-any.whl (200kB)
    100% |################################| 204kB 13.5MB/s 
Collecting pytz (from modelchimp)
  Downloading https://files.pythonhosted.org/packages/61/28/1d3920e4d1d50b19bc5d24398a7cd85cc7b9a75a490570d5a30c57622d34/pytz-2018.9-py2.py3-none-any.whl (510kB)
    100% |################################| 512kB 8.1MB/s 
Collecting cloudpickle (from modelchimp)
  Downloading https://files.pythonhosted.org/packages/6e/bc/67f13115adcce4efc5e4d7f8220fb9a50aaa2b5c7ed460b26cbb76aa76ad/cloudpickle-0.8.1-py2.py3-none-any.whl
Collecting click (from modelchimp)
  Downloading https://files.pythonhosted.org/packages/fa/37/45185cb5abbc30d7257104c434fe0b07e5a195a6847506c074527aa599ec/Click-7.0-py2.py3-none-any.whl (81kB)
    100% |################################| 81kB 13.8MB/s 
Collecting certifi>=2017.4.17 (from requests->modelchimp)
  Downloading https://files.pythonhosted.org/packages/60/75/f692a584e85b7eaba0e03827b3d51f45f571c2e793dd731e598828d380aa/certifi-2019.3.9-py2.py3-none-any.whl (158kB)
    100% |################################| 163kB 8.4MB/s 
Collecting idna<2.9,>=2.5 (from requests->modelchimp)
  Downloading https://files.pythonhosted.org/packages/14/2c/cd551d81dbe15200be1cf41cd03869a46fe7226e7450af7a6545bfc474c9/idna-2.8-py2.py3-none-any.whl (58kB)
    100% |################################| 61kB 9.0MB/s 
Collecting chardet<3.1.0,>=3.0.2 (from requests->modelchimp)
  Downloading https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl (133kB)
    100% |################################| 143kB 10.1MB/s 
Collecting urllib3<1.25,>=1.21.1 (from requests->modelchimp)
  Downloading https://files.pythonhosted.org/packages/62/00/ee1d7de624db8ba7090d1226aebefab96a2c71cd5cfa7629d6ad3f61b79e/urllib3-1.24.1-py2.py3-none-any.whl (118kB)
    100% |################################| 122kB 7.1MB/s 
Installing collected packages: certifi, idna, chardet, urllib3, requests, future, six, websocket-client, pytz, cloudpickle, click, modelchimp
  Running setup.py install for future ... done
  Running setup.py install for modelchimp ... done
Successfully installed certifi-2019.3.9 chardet-3.0.4 click-7.0 cloudpickle-0.8.1 future-0.17.1 idna-2.8 modelchimp-0.5.5 pytz-2018.9 requests-2.21.0 six-1.12.0 urllib3-1.24.1 websocket-client-0.47.0
You are using pip version 8.1.1, however version 19.0.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

root@4db27a514406:/examples# python3 main.py 
Traceback (most recent call last):
  File "main.py", line 3, in <module>
    from modelchimp import Tracker
ModuleNotFoundError: No module named 'modelchimp'

What is wrong?

@samzer
Copy link
Member

samzer commented Apr 2, 2019

Just reproduced this and quite interesting what was happening.

Basically, the pytorch image uses anaconda python which is of version 3. When the following command is executed, pip3 is installed outside of the conda environment.

apt update && apt install python3-pip -y

And when modelchimp is installed with pip3, the module is installed outside of the conda environment also because of which python does not recognize the module.

sagemathinc/cocalc#2403

--- FIX ---
Since the default python is version 3

  • Ignore --> apt update && apt install python3-pip -y
  • pip install modelchimp

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