anaconda / nb_conda

Conda environment and package access extension from within Jupyter
BSD 3-Clause "New" or "Revised" License
140 stars 32 forks source link

Error during installation of packages #68

Open Tarick opened 6 years ago

Tarick commented 6 years ago

nb_conda 2.2.1 During installation of the package to env outputs "Internal server error" and stacktrace: screenshot from 2018-02-09 19-34-36

[D 17:34:07.116 NotebookApp] [nb_conda] command: ['conda', 'install', '-y', '-q', '--json', '-n', 'root', '_license'] --skipped-- [D 17:34:15.545 NotebookApp] [nb_conda] ... [W 17:34:15.545 NotebookApp] [nb_conda] JSON parse fail: Extra data: line 2 column 1 (char 73) [E 17:34:15.546 NotebookApp] Uncaught exception POST /conda/environments/root/packages/install (172.17.0.1) HTTPServerRequest(protocol='http', host='0.0.0.0:8000', method='POST', uri='/conda/environments/root/packages/install', version='HTTP/1.1', remote_ip='172.17.0.1', headers={'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:58.0) Gecko/20100101 Firefox/58.0', 'Accept': 'application/json, text/javascript, /; q=0.01', 'Dnt': '1', 'Referer': 'http://0.0.0.0:8000/tree', 'X-Requested-With': 'XMLHttpRequest', 'Content-Length': '23', 'Cookie': '_xsrf=2|6040c158|5a3a5c8ddd7a44ac49ee58f268ab3254|1518191782; username-0-0-0-0-8000="2|1:0|10:1518197622|21:username-0-0-0-0-8000|44:ZDYxMGU4OWUwOGQzNGY5NWJhM2VlNjNiOWJjNzBmN2M=|2a1244bbe538c07c0e4d9478c4ebbf1b9a3f840383405c3738b06a8cbdf76a0a"', 'Accept-Encoding': 'gzip, deflate', 'Accept-Language': 'en-US,en;q=0.7,uk;q=0.3', 'Host': '0.0.0.0:8000', 'X-Xsrftoken': '2|6040c158|5a3a5c8ddd7a44ac49ee58f268ab3254|1518191782', 'Connection': 'keep-alive', 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'}) Traceback (most recent call last): File "/opt/conda/lib/python3.5/site-packages/tornado/web.py", line 1509, in _execute result = method(*self.path_args, self.path_kwargs) File "/opt/conda/lib/python3.5/site-packages/tornado/web.py", line 2897, in wrapper return method(self, *args, *kwargs) File "/opt/conda/lib/python3.5/site-packages/notebook/base/handlers.py", line 670, in wrapper return method(self, args, kwargs) File "/opt/conda/lib/python3.5/site-packages/nb_conda/handlers.py", line 136, in post resp = self.env_manager.install_packages(env, packages) File "/opt/conda/lib/python3.5/site-packages/nb_conda/envmanager.py", line 160, in install_packages return self.clean_conda_json(output) File "/opt/conda/lib/python3.5/site-packages/nb_conda/envmanager.py", line 101, in clean_conda_json lines = [line for line in lines if re.match(JSONISH_RE)] File "/opt/conda/lib/python3.5/site-packages/nb_conda/envmanager.py", line 101, in lines = [line for line in lines if re.match(JSONISH_RE)] TypeError: match() missing 1 required positional argument: 'string' [W 17:34:15.550 NotebookApp] Unhandled error [E 17:34:15.551 NotebookApp] { "User-Agent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:58.0) Gecko/20100101 Firefox/58.0", "Accept": "application/json, text/javascript, /; q=0.01", "Dnt": "1", "Referer": "http://0.0.0.0:8000/tree", "X-Requested-With": "XMLHttpRequest", "Content-Length": "23", "Cookie": "_xsrf=2|6040c158|5a3a5c8ddd7a44ac49ee58f268ab3254|1518191782; username-0-0-0-0-8000=\"2|1:0|10:1518197622|21:username-0-0-0-0-8000|44:ZDYxMGU4OWUwOGQzNGY5NWJhM2VlNjNiOWJjNzBmN2M=|2a1244bbe538c07c0e4d9478c4ebbf1b9a3f840383405c3738b06a8cbdf76a0a\"", "Accept-Encoding": "gzip, deflate", "Accept-Language": "en-US,en;q=0.7,uk;q=0.3", "Host": "0.0.0.0:8000", "X-Xsrftoken": "2|6040c158|5a3a5c8ddd7a44ac49ee58f268ab3254|1518191782", "Connection": "keep-alive", "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8" } [E 17:34:15.551 NotebookApp] 500 POST /conda/environments/root/packages/install (172.17.0.1) 8436.62ms referer=http://0.0.0.0:8000/tree

To reproduce - run jupyter-notebook with debug, in conda tab chose environment, chose new package, click icon to install. Note that fixing re.match in envmanager.py#L101 doesn't fixes the issue - I've got other stacktrace trying to create new env after that, as well as "error: True" in the end for the installation of packages.

Tarick commented 6 years ago

Conda produces invalid json when using log-level DEBUG, related issue is https://github.com/conda/conda/issues/1162 . So parsing json will be invalid and clean_conda_json will return "error: True" anyway, however, re.match still should be fixed to avoid failing with an exception.

Tarick commented 6 years ago

https://github.com/conda/conda/issues/6642 - related to broken json even in INFO mode - progress bar is not suppressed during the installation of packages in conda 4.4.